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

Contenttype field name "token" collides with csrf token #2734

Closed
rarila opened this issue Feb 6, 2015 · 5 comments
Closed

Contenttype field name "token" collides with csrf token #2734

rarila opened this issue Feb 6, 2015 · 5 comments
Assignees
Labels
blocking release bug A bug that has been verified

Comments

@rarila
Copy link
Contributor

rarila commented Feb 6, 2015

In _csrf_token.twig we have

<input type="hidden" name="token" value="{{ token() }}" />

which badly collides on post when you have a contenttype field named token.

Possible solutions:

  • Rename it to something like bolt_csrf_token or something and disallow fieldnames starting withbolt_
  • Add token to the list of not allowed keywords.

Any other internal used post names known?

@GwendolenLynch GwendolenLynch added the bug A bug that has been verified label Feb 6, 2015
@GwendolenLynch
Copy link
Contributor

What about the suggestion you made on IRC to prefix internals with an underscore (or two) and disallow those as contenttype names?

@rarila
Copy link
Contributor Author

rarila commented Feb 6, 2015

Is _ allowed for the start of a name attribute? Gotta check.

@rarila
Copy link
Contributor Author

rarila commented Feb 6, 2015

Also I can't really find the location where this token is used/compared in our codebase…

Ah: https://github.com/bolt/bolt/blob/master/src/Users.php#L334
Is that the only place where it is read/used?

It seems the token also lives in cookies, named bolt_authtoken there. It would heavily reduce the possibilty of a collition with this name, even without prefix and cecking for it. token alone is just too general.

@rarila
Copy link
Contributor Author

rarila commented Feb 6, 2015

Looks like @tobias2k initially added this stuff, but i got some interations meanwhile.

@bobdenotter bobdenotter added this to the Bolt 2.1 - Feature release milestone Feb 7, 2015
@bobdenotter
Copy link
Member

"bolt_token" would work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocking release bug A bug that has been verified
Projects
None yet
Development

No branches or pull requests

3 participants