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

ButtonTo() doesn't support CSRF #808

Closed
neokoenig opened this issue Jul 15, 2017 · 2 comments
Closed

ButtonTo() doesn't support CSRF #808

neokoenig opened this issue Jul 15, 2017 · 2 comments
Labels
Milestone

Comments

@neokoenig
Copy link
Contributor

As buttonTo() creates a form, it should automatically include appropriate CSRF tokens if required?

 #buttonTo(
  text="Delete",
  route="myRoute",
  key=id,
  method="delete",
  encode="attributes"                  
 )#

Results in

<form action="/admin/roles/3" method="post">
  <input id="_method" name="_method" type="hidden" value="delete">
  <input class="btn btn-primary" type="submit" value="Delete">
</form>

Without the CSRF token

@neokoenig neokoenig added the bug label Jul 15, 2017
@perdjurner perdjurner added this to the 2.0.0 Beta 2 milestone Jul 15, 2017
@chapmandu
Copy link
Contributor

I'm wondering if the startFormTag() could be used here rather than this element helper..

return $element(name="form", skip=local.skip, content=local.content, attributes=arguments, encode=local.encode, encodeExcept=local.encodeExcept);

@perdjurner
Copy link
Contributor

Using startFormTag would be a good approach for later but for additional beta releases like this one we should minimize any possibility of adding more bugs. Best way to do that is to just add in the authenticityTokenField() call to buttonTo I think, even if it creates some ugly / duplicate code for now.

@perdjurner perdjurner modified the milestones: 2.0.0 Beta 2, 2.0.0 RC 1 Aug 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants