Distinguish RFC 9207 iss from SMART launch iss on OAuth callbacks#205
Open
dionmcm wants to merge 1 commit into
Open
Distinguish RFC 9207 iss from SMART launch iss on OAuth callbacks#205dionmcm wants to merge 1 commit into
dionmcm wants to merge 1 commit into
Conversation
The iss query parameter has two conflicting meanings: SMART App Launch uses it for the FHIR server base URL on launch, while RFC 9207 uses it for the authorization server issuer on OAuth callbacks. Auth servers like Keycloak include RFC 9207 iss by default, which breaks apps when the library mistakes it for the FHIR server URL. Use the presence of `code` to detect callback mode. In callback mode, ignore URL iss for FHIR server selection (use stored state instead), validate it against the discovered issuer when available, and strip it from the browser URL to prevent leakage into subsequent authorize calls.
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.
Summary
issquery parameter has two conflicting meanings. SMART App Launch uses it for the FHIR server base URL on launch, while RFC 9207 uses it for the authorization server issuer on OAuth callbacks. Auth servers like Keycloak include RFC 9207issby default, which breaks apps when the library mistakes it for the FHIR server URL.issfor FHIR server selection (use stored state instead), and validate it against the discovered issuer when available (implementing RFC 9207), and strips it from the browser URL.issuerfield toWellKnownSmartConfiguration,OAuthSecurityExtensions, andClientStatetypes to support RFC 9207 validation.Behavioral changes
code+ RFC 9207ississmistakenly used as FHIR server URLissignored for FHIR server; validated against discovery issuer if knowncode, noississ, nocodeissread as FHIR server URLauthorize()called on callback URLinit()/ready()issuerin.well-known, callbackissmismatchesRFC 9207 issuer mismatcherrorLimitations
issuerin.well-known/smart-configuration. Conformance-only servers (no well-known) skip validation gracefully since the expected issuer is unknown.issURL cleanup inready()is gated behindreplaceBrowserHistory(the default). Apps withreplaceBrowserHistory: falseretainissin the URL bar, consistent with existingcode/statebehavior under that setting.Tests
code+ RFC 9207issuses stored FHIR server URL, not callbackisscodeand noissstill works (regression)issand nocodereadsissas FHIR server URL (regression)authorize()on callback throws clear errorissmatches discovered issuerinit()end-to-end flow handles RFC 9207isson callback correctlyReferences
This relates to this PR on the SMART on FHIR specification HL7/smart-app-launch#419 (Jira change request) and this Zulip thread.