fix: bind the assertion to the request this SP issued - #43
Open
shreemaan-abhishek wants to merge 1 commit into
Open
fix: bind the assertion to the request this SP issued#43shreemaan-abhishek wants to merge 1 commit into
shreemaan-abhishek wants to merge 1 commit into
Conversation
login generated an AuthnRequest ID and threw it away, so nothing tied the response back to a login this SP started. An assertion captured from one login stayed usable in any later one. The ID is kept on the session now. A SubjectConfirmationData naming a different request makes that confirmation unsatisfiable, and a Response answering a different request is refused outright. The confirmation is the binding that holds: it sits inside the signature, while the Response around it is usually unsigned.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
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.
Part of #37, item 4. Stacked on #42, which brought items 1 to 3; the base branch retargets to
mainwhen that merges. Item 5, the assertion replay cache, follows.What was wrong
generate_saml_idminted an ID for everyAuthnRequestandloginthrew it away. Nothing afterwards tied the response back to a login this SP had started, so an assertion captured from one login stayed usable in any later one.RelayStatedoes not cover this. It is opaque state this SP chose, it is not signed, and the party replaying an assertion controls their own browser session: start a fresh login to get a matchingsaml_state, then post the old assertion back with theRelayStatethat login handed out.What it does now
loginkeeps the ID it issued on the session assaml_request_idand clears it on success alongsidesaml_state.login_callbackthen refuses:ResponsewhoseInResponseTonames a different requestSubjectConfirmationDatawhoseInResponseTonames a different request, by making that confirmation unsatisfiable, which is where the confirmation rules from fix: weigh the conditions an assertion attaches to itself #42 already liveThe second is the one that binds.
SubjectConfirmationDatasits inside the assertion the signature covers, so an attacker replaying a captured assertion cannot rewrite it. TheResponsearound it is usually left unsigned, so itsInResponseTocatches a stray or misdirected answer rather than a deliberate one, which is why both are checked rather than only the outer.An absent
InResponseTois not enforced, keeping the line #42 drew: an IdP that omits it keeps working.Tests
TESTs 18 to 20 in
t/assertion-conditions.t. TEST 20 builds the response after the SP has issued its request, reading the ID back out of the redirect the SP sent the browser, so it exercises a genuine matching ID rather than a fixture.Full run on this branch, 60 subtests, all pass. Rebuilt against #42's
src/andlua/with the new tests kept, the two that should fail do and only those:TEST 20 passes on both, which is the point of it.