Repository navigation
manual verification: fix csrf failure on the scan button - #337
Merged
Merged
Conversation
rails per-form csrf tokens (on under load_defaults 8.0) are bound to the form's action url. the scan button submitted via formaction to the prepare_capture route with the upload form's token, so every click raised InvalidAuthenticityToken in production. that exception is on sentry's default ignore list, which is why nothing showed up there, and forgery protection is off in the test env, which is how it shipped. the button now submits to the same url with intent=scan and submit_documents dispatches to prepare_capture. added a request spec that turns forgery protection on and submits the real form token.
leowilkin
force-pushed
the
fix/manual-verification-review-followups
branch
from
October 6, 2026 22:01
ca5e3fb to
24d95a3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
production hotfix: clicking "scan with your camera" showed the generic "something went wrong" banner with nothing in sentry and no inquiry in persona.
cause
rails per-form csrf tokens are on under
load_defaults 8.0. a per-form token is bound to the form's own action url. the scan button usedformactionto post the shared upload form to the prepare-capture route, so the token never validated and every click raisedInvalidAuthenticityToken. that exception is on sentry's default ignore list (hence no event), and the test env disables forgery protection (hence green specs).fix
name="intent" value="scan", andsubmit_documentsdispatches toprepare_captureon that intent.testing
manual verifications request spec: 28 examples, 0 failures. rubocop clean, erb lint unchanged (pre-existing autocomplete warnings only).