Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.

Commit 62d0960

Browse files
authored
Merge pull request #197 from PerimeterX/bugfix/enforced-routes
enforced routes bug fix
2 parents 0df7c38 + bb95083 commit 62d0960

File tree

2 files changed

+3
-30
lines changed

2 files changed

+3
-30
lines changed

lib/pxenforcer.js

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ class PxEnforcer {
133133
}
134134

135135
shouldFilterRequest(req) {
136-
let shouldFilterRoute = false;
137-
138136
if (pxUtil.checkForStatic(req, this._config.STATIC_FILES_EXT)) {
139137
this.logger.debug(`Found whitelist ext in path: ${req.originalUrl}`);
140138
return true;
@@ -153,33 +151,8 @@ class PxEnforcer {
153151
}
154152
}
155153
}
156-
157-
if (this._config.ENFORCED_ROUTES && this._config.ENFORCED_ROUTES.length > 0) {
158-
for (const enforceRoute of this._config.ENFORCED_ROUTES) {
159-
if (enforceRoute instanceof RegExp && req.originalUrl.match(enforceRoute)) {
160-
return false;
161-
}
162-
if (typeof enforceRoute === 'string' && req.originalUrl.startsWith(enforceRoute)) {
163-
return false;
164-
}
165-
}
166-
this.logger.debug(`Route ${req.originalUrl} is not listed in specific routes to enforce`);
167-
shouldFilterRoute = true;
168-
}
169-
170-
if (this._config.MONITORED_ROUTES && this._config.MONITORED_ROUTES.length > 0) {
171-
for (const monitorRoute of this._config.MONITORED_ROUTES) {
172-
if (monitorRoute instanceof RegExp && req.originalUrl.match(monitorRoute)) {
173-
return false;
174-
}
175-
if (typeof monitorRoute === 'string' && req.originalUrl.startsWith(monitorRoute)) {
176-
return false;
177-
}
178-
}
179-
this.logger.debug(`Route ${req.path} is not listed in specific routes to monitor`);
180-
}
181-
182-
return shouldFilterRoute;
154+
155+
return false;
183156
}
184157

185158
verifyUserScore(ctx, callback) {

lib/pxutil.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ function generateHMAC(cookieSecret, payload) {
249249

250250
function isReqInMonitorMode(pxConfig, pxCtx) {
251251
return (
252-
(pxConfig.MODULE_MODE === ModuleMode.MONITOR && !pxCtx.shouldBypassMonitor) || pxCtx.monitoredRoute
252+
(pxConfig.MODULE_MODE === ModuleMode.MONITOR && !pxCtx.shouldBypassMonitor && !pxCtx.enforcedRoute) || pxCtx.monitoredRoute
253253
);
254254
}
255255

0 commit comments

Comments
 (0)