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 · May be fixed by #284
Open

Security vulnerability with /* wildcard #282

vlad-pisanov opened this issue Sep 26, 2024 · 1 comment · May be fixed by #284

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

fsanggang added a commit to fsanggang/rack-cors that referenced this issue Nov 27, 2024
fsanggang added a commit to fsanggang/rack-cors that referenced this issue Nov 27, 2024
fsanggang added a commit to fsanggang/rack-cors that referenced this issue Nov 27, 2024
@fsanggang fsanggang linked a pull request Nov 27, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants