mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-11-29 01:17:52 +01:00
Fix missing new on PermissionError in access.can()
The catch block in `access.can()` constructed `errs.PermissionError` without `new`. The error constructors in `backend/lib/error.js` are plain constructor functions that assign to `this` and return nothing, so calling one without `new` evaluates to `undefined`. The statement therefore did `throw undefined`, the express error handler in `backend/app.js` received undefined (and could not read `.status` or `.public` off it), and the request fell through to the catch-all 404 handler in `backend/routes/main.js`. Net effect: every authorization failure raised by `access.can(...)` was reported to clients as `404 Not Found` instead of `403 Forbidden`. Line 45 of the same file already used `new` correctly, which shows this was an oversight rather than deliberate resource-existence hiding. A grep over `backend/` confirms this was the only error constructor invoked without `new`.
This commit is contained in:
1 file changed
+1
-1
@@ -271,7 +271,7 @@ export default function (tokenString) {
|
|||||||
err.permission = permission;
|
err.permission = permission;
|
||||||
err.permission_data = data;
|
err.permission_data = data;
|
||||||
logger.error(permission, data, err.message);
|
logger.error(permission, data, err.message);
|
||||||
throw errs.PermissionError("Permission Denied", err);
|
throw new errs.PermissionError("Permission Denied", err);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user