mirror of
https://github.com/trufflesecurity/xsshunter
synced 2024-11-24 13:23:04 +00:00
Better path checking
This commit is contained in:
parent
2f35dd9a84
commit
56bb44ed90
1 changed files with 9 additions and 1 deletions
10
api.js
10
api.js
|
@ -94,9 +94,17 @@ async function set_up_api_server(app) {
|
||||||
constants.API_BASE_PATH + 'settings',
|
constants.API_BASE_PATH + 'settings',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Check if the path being accessed required authentication
|
||||||
|
var requires_authentication = false;
|
||||||
|
AUTHENTICATION_REQUIRED_ROUTES.map(authenticated_route => {
|
||||||
|
if(req.path.toLowerCase().startsWith(authenticated_route)) {
|
||||||
|
requires_authentication = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// If the route is not one of the authentication required routes
|
// If the route is not one of the authentication required routes
|
||||||
// then we can allow it through.
|
// then we can allow it through.
|
||||||
if(!AUTHENTICATION_REQUIRED_ROUTES.includes(req.path)) {
|
if(!requires_authentication) {
|
||||||
next();
|
next();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue