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

Add lockTo parameter to validateRequest method #47

Merged
merged 1 commit into from
May 12, 2022

Conversation

enfoqueNativo
Copy link
Contributor

Tries to solve single access point web apps use case, where final URL semantics may not be determined only by REQUEST_URI server variable.

A couple of examples:

  • parameter travels in a hidden field, web app knows how to route the request
curl -X POST -d "_CSRF_INDEX=hashedval" -d "_CSRF_TOKEN=hashedval2" -d "op=CB3FD" http://domain/application.php
curl -X POST -d "_CSRF_INDEX=hashedval" -d "_CSRF_TOKEN=hashedval2" -d "op=B4A3FF" http://domain/application.php

Those two request may seem the same to the lib, but they're intended to different operations/forms.

  • parameter travels in URL, but it's not the only one
curl -X POST -d "_CSRF_INDEX=hashedval" -d "_CSRF_TOKEN=hashedval2" http://domain/application.php?_sq=hashedval&op=CB3FD

Here i may need op to route the request but _sq it's generating noise in the lockTo comparison.

I know the proposed solution in this PR may leave some spaces to misuse (would require proper documentation), but if i lock the Token to a specific application parameter, i should be able to provide it too in the validation stage.

If you think there's a better way to solve this use case, please feel free to mention it.

Regards.

@paragonie-security paragonie-security merged commit 8f1b1a8 into paragonie:master May 12, 2022
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 this pull request may close these issues.

2 participants