fix: scope basic auth to same-origin requests [TE-13690]#515
Open
shrinishLT wants to merge 1 commit into
Open
Conversation
Basic auth credentials were sent on all requests including cross-origin OIDC/OAuth endpoints, causing 400 errors and blank screenshots on SPAs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
sushobhit-lt
approved these changes
May 8, 2026
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.
RCA
Root Cause: In
src/lib/screenshot.ts, basic auth credentials were applied globally to ALL requests viapage.setExtraHTTPHeaders()(line 186-189, now removed). This Playwright API attaches theAuthorizationheader to every HTTP request the page makes — including cross-origin requests to third-party APIs.Impact on this site: The Angular SPA at
stg.universalstudioshollywood.comcallsapi-stg.universalparks.com/oidc/connect/tokento fetch a login token. The OIDC token endpoint expects client/app credentials in the Authorization header (per OAuth2 spec), but SmartUI was sending the user's basic auth credentials (uprush:F73QqwDf) instead →400 Bad Request→ no token → SPA renders blank.Fix Applied (
screenshot.tsonly — capture flow):page.setExtraHTTPHeaders()(which was global/unscoped)Authorizationheader only to same-origin requests (whererequestHostname === targetHostname):page.route('**/*')handler that adds the auth header only when the request hostname matches the target URL's hostnamerequestHostname === targetHostnameThis ensures cross-origin requests (like the OIDC token call to
api-stg.universalparks.com) are not polluted with the user's basic auth credentials.Test plan
🤖 Generated with Claude Code