fix(broker): allow cloudfunctions.net in csp and harden broker diagnostics - #55
Merged
Merged
Conversation
|
Strix is installed on this repository, but we couldn't run this PR security review because this workspace's trial has ended. Add a card to resume code reviews here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Resolves the root cause of
[BROKER_CREATE_INTERNAL]occurring during post-login redirect on Production (https://shiftoryx.gr/login).Root Cause
vercel.jsondefined a strict Content Security Policy (connect-src) that omittedhttps://*.cloudfunctions.netandhttps://*.run.app. When the client browser invokedcreateTenantAuthTicketRedirectviahttpsCallable, the browser intercepted and blocked the network request with a CSP violation (Failed to fetch).FunctionsError('internal', 'internal').classifyBrokerErrorcollapsed unrecognized error codes into genericBROKER_CREATE_INTERNAL, ignoring server details, existing error categories, and client redirect errors./storeswhen central session succeeded but broker transfer failed.Key Changes
vercel.json: Addedhttps://*.cloudfunctions.netandhttps://*.run.appto CSPconnect-src.scripts/validate-security-hardening.mjs: Updated CSP validation assertion.src/firebase/authBrokerService.js: HardenedclassifyBrokerErrorto preserve existing categories, inspecterr?.details?.reason, distinguish fetch/CSP blocks, and handle custom redirect errors.src/components/auth/LoginPage.jsx: Added direct recovery button to/stores.Verification
npm run qa:auth-brokerPASSnpm run qa:auth-broker-negativePASS (16 tests)npm run qa:multi-tenantPASS (7 tests)npm run security:hardeningPASSnpm run qa:vercel-spa-routingPASSnpm run buildPASS (2.62s)