mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 14:56:01 +00:00
timg safe compare token fixes #91
This commit is contained in:
@@ -31,6 +31,7 @@ const scheduler = require('./controllers/scheduler');
|
||||
const { rundir } = require('./utility/directories');
|
||||
const platformInfo = require('./utility/platformInfo');
|
||||
const processArgs = require('./utility/processArgs');
|
||||
const timingSafeCheckToken = require('./utility/timingSafeCheckToken');
|
||||
|
||||
let authorization = null;
|
||||
let checkLocalhostOrigin = null;
|
||||
@@ -56,7 +57,7 @@ function start() {
|
||||
}
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
if (authorization && req.headers.authorization != authorization) {
|
||||
if (authorization && !timingSafeCheckToken(req.headers.authorization, authorization)) {
|
||||
return res.status(403).json({ error: 'Not authorized!' });
|
||||
}
|
||||
if (checkLocalhostOrigin) {
|
||||
|
||||
Reference in New Issue
Block a user