You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rack-protection: change authenticity_param default to rack_csrf default #1778
I think this should be fixed, given that latest omniauth relies on it, and the default experience for non-rails apps (which requires a separate gem anyway, not depending on rack-protection) breaks.
I think this should be fixed, given that latest omniauth relies on it, and the default experience for non-rails apps (which requires a separate gem anyway, not depending on rack-protection) breaks.
It will be unlikely we'll change a long standing default. I don't think it's the form param that will matter for rack_csrf compatability, it's the session key which defaults to :csrf . In case it is helpful, the Omniauth authenticity token protection can be configured:
So, both the :key and the :authenticity_param are important when verifying the csrf token from a POST form request (they both have to match).
If rack-protection advertises rack_csrf, it should at least follow mainline. I'm not sure if keeping the default holds as an argument if the default does not reduce friction.
Nice that looks even better for setting those options. I think the rack-protection documentation means to imply that it is compatible with rack_csrf in that you can configure it to use the same param names. If that needs to be made more clear, please feel free to update the documentation in a PR.
I think the rack-protection documentation means to imply that it is compatible with rack_csrf in that you can configure it to use the same param names.
I'd hardly call that compatible, seems more like "it may incidentally works if you do 1 and 2". As an example of what means to be compatible, here's roda csrf plugin.
While I understand that there may be concerns about changing this and instead removing compatibility claims, I think there's a lost opportunity for reducing friction for newcomers, given the prevalence of omniauth as a SSO solution, and its reliance on rack-protection. It took me the better part of a day to dig through this and find what the cause was, and I work with ruby for many years. I can imagine someone setting up sinatra, rack_csrf and omniauth to quickly prototype smth only to find out nothing works and moving on to something else.
I'll close this, as it seems it's only me who finds this an issue.
As a maintainer of sinatra and rack-protection I have think you'd see why we wouldn't change our defaults for another library. It could potentially create a lot more problems. The beauty of open source is that you can create plugins that help automate configurations between libraries if you so please. Or you can support the community by improving documentation.
If the language that it is compatible is confusing I'm ok with removing it all together. It was probably "more" compatible when it was first written many years ago.
Activity
jkowens commentedon May 10, 2022
Could you elaborate?
jkowens commentedon May 10, 2022
It will be unlikely we'll change a long standing default. I don't think it's the form param that will matter for rack_csrf compatability, it's the session key which defaults to
:csrf. In case it is helpful, the Omniauth authenticity token protection can be configured:HoneyryderChuck commentedon May 10, 2022
That one also seems to be wrong :)
So, both the
:keyand the:authenticity_paramare important when verifying the csrf token from a POST form request (they both have to match).If
rack-protectionadvertisesrack_csrf, it should at least follow mainline. I'm not sure if keeping the default holds as an argument if the default does not reduce friction.FWIW this is my workaround:
jkowens commentedon May 10, 2022
Nice that looks even better for setting those options. I think the
rack-protectiondocumentation means to imply that it is compatible withrack_csrfin that you can configure it to use the same param names. If that needs to be made more clear, please feel free to update the documentation in a PR.HoneyryderChuck commentedon May 10, 2022
I'd hardly call that compatible, seems more like "it may incidentally works if you do 1 and 2". As an example of what means to be compatible, here's roda csrf plugin.
While I understand that there may be concerns about changing this and instead removing compatibility claims, I think there's a lost opportunity for reducing friction for newcomers, given the prevalence of omniauth as a SSO solution, and its reliance on
rack-protection. It took me the better part of a day to dig through this and find what the cause was, and I work with ruby for many years. I can imagine someone setting upsinatra,rack_csrfandomniauthto quickly prototype smth only to find out nothing works and moving on to something else.I'll close this, as it seems it's only me who finds this an issue.
jkowens commentedon May 10, 2022
As a maintainer of
sinatraandrack-protectionI have think you'd see why we wouldn't change our defaults for another library. It could potentially create a lot more problems. The beauty of open source is that you can create plugins that help automate configurations between libraries if you so please. Or you can support the community by improving documentation.If the language that it is compatible is confusing I'm ok with removing it all together. It was probably "more" compatible when it was first written many years ago.
authenticity token: removed reference of compatibility with rack_csrf