fix(saml): nil-deref panic on assertion build (req.HTTPRequest)#72
Merged
Conversation
…stash only on success crewjam's assertion maker dereferences req.HTTPRequest.RemoteAddr to stamp the SubjectConfirmationData/SubjectLocality Address. On the consent POST we rebuild the IdpAuthnRequest from the stashed buffer (the original GET is gone), so HTTPRequest was nil and MakeAssertion panicked (500) — after the stash had already been consumed, so retries failed with "invalid sso request". - pass the client IP into GenerateResponse and set a non-nil HTTPRequest - peek the stash with GetSSORequest and only DeleteSSORequest after the assertion is issued, so a failed attempt stays retryable
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.
The consent POST
/saml/authorize500'd with a nil pointer dereference and the stash was consumed before the failure, so retries returned400 invalid sso request.Root cause: crewjam's assertion maker reads
req.HTTPRequest.RemoteAddr(identity_provider.go:810 and :832) to stamp the assertion'sSubjectConfirmationData/SubjectLocalityAddress. On the consent POST we rebuild theIdpAuthnRequestfrom the stashed AuthnRequest buffer (the original GET/saml/ssorequest is long gone), soHTTPRequestwas nil → panic.GenerateResponsenow takes the client IP and sets a non-nilHTTPRequest{RemoteAddr: ...}(also populates the assertion Address correctly)GetSSORequest, thenDeleteSSORequeston success — a failed attempt now stays retryable instead of stranding the userConfirmed against the live pod logs:
identity_provider.go:810 → service/response.go:61 (PostBinding) → api/authorize.go. Needs release + redeploy.