Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security vulnerability with /* wildcard #282

Open
vlad-pisanov opened this issue Sep 26, 2024 · 1 comment
Open

Security vulnerability with /* wildcard #282

vlad-pisanov opened this issue Sep 26, 2024 · 1 comment

Comments

@vlad-pisanov
Copy link

Say I grant access to /data/*:

allow do
  origins '*'
  resource '/data/*'
end

In actuality, this also grants access to /data_private, /database/foo/bar, and essentially any resource whose path starts with /data. ⚠️

This is because the constructed regex makes the slash optional, and effectively behaves like *:

rx = compile('/data/*')    # /^\/data\/?(.*?)$/
rx === '/data'             # true
rx === '/database'         # true
rx === '/database/foo/bar' # true
@luke-zhou
Copy link

I can create a PR, if no one creates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants