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

Revel tests and CSRF protected application #11

Closed
ghost opened this issue Aug 11, 2014 · 1 comment
Closed

Revel tests and CSRF protected application #11

ghost opened this issue Aug 11, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 11, 2014

Has anybody ever used Revel tests with CSRF protected application? How tests can get CSRF token?

I can come up with the following solutions:

  1. Parse some page and get token
  2. Create an action which will return token when in dev mode.

Is there a better (less workaroundish) solution? How is this problem being solved in other frameworks?

Here is what I've managed to find:

  1. Node.js/Express related solution: http://stackoverflow.com/questions/18773846/how-to-test-endpoints-protected-by-csrf-in-node-js-express
    • Parse cookie received by tests and find token there
    • When in dev mode use a constant for token rather than a random string
  2. SAP in response to GET request with header X-CSRF-Token Value : Fetch returns token: https://scn.sap.com/thread/3484244
@ghost
Copy link
Author

ghost commented Oct 27, 2014

There is an official CSRF protection module now. I'm closing this in favor of a discussion in Revel issues.

@ghost ghost closed this as completed Oct 27, 2014
This issue was closed.
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

0 participants