Bind 12ui API keys to their configured origins#1
Open
zemaj wants to merge 1 commit into
Open
Conversation
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.
Motivation
/api/connectionroute allowed current origin to be changed and later used with the stored API key, enabling credential and asset exfiltration.Description
getTwelveUiApiKeyand normalize/compare origins using a newnormalizeAuthOriginandisTwelveUiAuthOriginhelper insrc/server/twelveUiAuthStore.ts.TWELVE_UI_ORIGIN, and only return a stored file key when it matches the stored auth origin (modifiesgetTwelveUiApiKeybehavior).readBoundTwelveUiApiKeyinsrc/server/twelveUi.tsand use it insubmitTwelveUiHandoverandfetchHandoverAssetso handover operations abort before reading assets or posting when the stored auth origin does not match the current destination origin.src/server/twelveUiAuthStore.test.tscovering env-key binding, stored-key binding, and that a mismatched stored auth blocks the handover path.Testing
pnpm run typecheckand it completed successfully (no type errors).pnpm run test(Vitest) and all tests passed:92 passedin the test suite.pnpm exec vitest run src/server/twelveUiAuthStore.test.tsandsrc/server/connection.test.ts, and both passed.pnpm run buildand the production build completed successfully.Codex Task