mirror of
https://github.com/HeyPuter/puter.git
synced 2026-09-25 22:55:58 +00:00
dev: regex rules for undefined origin allowed
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test (18.x) (push) Has been cancelled
test / test (20.x) (push) Has been cancelled
test / test (22.x) (push) Has been cancelled
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test (18.x) (push) Has been cancelled
test / test (20.x) (push) Has been cancelled
test / test (22.x) (push) Has been cancelled
This commit allows using a regex to specify a route that's allowed to not have an "Origin" header specified. This is necessary for parametized URLs.
This commit is contained in:
@@ -518,7 +518,11 @@ class WebServerService extends BaseService {
|
||||
}
|
||||
|
||||
// rules that don't apply to notification endpoints
|
||||
if ( ! this.undefined_origin_allowed.includes(req.path) ) {
|
||||
const undefined_origin_allowed = this.undefined_origin_allowed.some(rule => {
|
||||
if ( typeof rule === 'string' ) return rule === req.path;
|
||||
return rule.test(req.path);
|
||||
});
|
||||
if ( ! undefined_origin_allowed ) {
|
||||
// check if no origin
|
||||
if ( req.method === 'POST' && req.headers.origin === undefined ) {
|
||||
event.allow = false;
|
||||
|
||||
Reference in New Issue
Block a user