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

Actions from input filter #15

Open
mebjas opened this issue Jul 26, 2014 · 6 comments
Open

Actions from input filter #15

mebjas opened this issue Jul 26, 2014 · 6 comments

Comments

@mebjas
Copy link
Owner

mebjas commented Jul 26, 2014

To validate CSRF Token against token stored in database (for that session), the request body is read in input filter. Currently I'm able to read & retrieve csrf_token from the request body & validate it. however I'm unable to take further actions if validations fails:

this is the point where actions need to be taken

@mebjas
Copy link
Owner Author

mebjas commented Jul 26, 2014

One idea is to leave all these complications in reading POST data, and switch csrf_token logic completely to urls. The idea is, even for POST requests the token is sent along with url as an argument.
Is it insecure, we are using per request tokens?

@abiusx
Copy link

abiusx commented Jul 26, 2014

What was the previous approach that let you stop the request but stopped feeding PHP?

@mebjas
Copy link
Owner Author

mebjas commented Jul 26, 2014

it was to generate a key-value pair of whole POST body from request buffer. code is available at: http://cistoner.org/blog/minhaz/2014/06/17/parse-post-request-in-apache-2-2/

@abiusx
Copy link

abiusx commented Jul 26, 2014

why dont you do this when you find an invalid token using the filter approach?
On Jul 26, 2014, at 6:47 PM, minhaz [email protected] wrote:

it was to generate a key-value pair of whole POST body from request buffer. code is available at: http://cistoner.org/blog/minhaz/2014/06/17/parse-post-request-in-apache-2-2/


Reply to this email directly or view it on GitHub.

@mebjas
Copy link
Owner Author

mebjas commented Jul 26, 2014

I used this method from a general header parser hook, and its like further actions on that request is based on return value of the hook. So all I had to do, was to return HTTP_FORBIDDEN (or others) in case of failed validation.

However in case of input filter this approach didn't work.

If there could be some way I could call a similar hook from input filter or terminate the connection from input filter, things would get easier

@mebjas
Copy link
Owner Author

mebjas commented Jul 27, 2014

input filter based approach to -> https://github.com/mebjas/mod_csrfprotector/tree/input-filter-based branch

csrf token as GET token approach -> master

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

No branches or pull requests

2 participants