Skip to content

Commit 6936c58

Browse files
committed
Answer HEAD like GET in consent's referrer policy, as Brakeman asks
1 parent 6c3ce5f commit 6936c58

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎app/controllers/oauth/authorizations_controller.rb‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,16 @@ def denial?
8484
request.post? && params[:error] == "access_denied"
8585
end
8686

87-
# The pages a GET renders, consent above all, hold forms that post back
88-
# to us, and a browser posting from a no-referrer page sends Origin: null,
89-
# which Rails' origin check refuses (InvalidCrossOriginRequest, a 422)
90-
# before anything else is weighed. same-origin keeps our own origin on
87+
# The pages a GET or HEAD renders, consent above all, hold forms that
88+
# post back to us, and a browser posting from a no-referrer page sends
89+
# Origin: null, which Rails' origin check refuses (InvalidCrossOriginRequest,
90+
# a 422) before anything else is weighed. same-origin keeps our own origin on
9191
# those posts and still sends nothing to any other site, so the request's
9292
# parameters stay here. A POST's answer, the redirect carrying the code
9393
# among them, keeps no-referrer: a redirect's policy is the one the next
9494
# hop is sent under.
9595
def referrer_policy
96-
request.get? ? "same-origin" : super
96+
request.post? ? super : "same-origin"
9797
end
9898

9999
# While connecting apps is in preview, nobody but previewers is asked to

0 commit comments

Comments
 (0)