Repository navigation
improvement(desktop): read browser safe storage keys in-process so keychain access is granted to sim - #10684
Conversation
…ychain access is granted to sim
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Confidence Score: 5/5
[Medium impact] The reviewed changes appear safe to merge, with no new actionable issues found. SummaryThis PR reads browser Safe Storage passwords inside Sim through a native macOS addon.
The earlier read-only-memory finding is fixed: Reviews (3) · Last reviewed commit: "fix(desktop): set up the throwaway keych..." · Reviewed by Greptile |
There was a problem hiding this comment.
All reported issues were addressed across 9 files
This PR changes authentication, authorization, or input validation. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.
Turn on auto-fix | Re-trigger cubic
…bound native read, prove found path in ci
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…n the native test
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
<Browser> Safe Storageby spawning/usr/bin/security. That made the Keychain prompt namesecurity, and "Always Allow" added/usr/bin/securityto the item's ACL, so any process that ransecuritylater could read the key without a promptnative/keychain.mmaddon reads the item in-process withSecItemCopyMatching, off the JS thread. It returnsfound/missing(errSecItemNotFound) /denied(user cancel, auth failed, interaction not allowed) /failed(any other OSStatus). It caches nothing and wipes its native copies of the passwordreadSafeStoragePasswordtries the addon first.securityis now only a fallback for when the addon can't load (dev without a native build). A denied or failed native read never falls back, because that would prompt again for the shared toolkeychain-item-missing, and a denial or failure returns null (keychain-unavailable)build-native.ts(darwin only, links Security + Foundation) and added to the native build cache inputs. electron-builder already unpacksdist/native/*.node, and packaged-smoke now asserts that every addon is inapp.asar.unpackedType of Change
Testing
keychain-native.test.tsloads the real addon. It checks that a randomly named missing item maps tomissing(-25300) and that non-string args throw. It goes red when the addon isn't builtpackage-smokejob (SIM_KEYCHAIN_ITEM_TEST=1, 3-minute step timeout). It creates a throwaway keychain, puts it on the runner's search list, adds a uniquely named-Aitem, and adds the test runner's code-signing partition. It then reads the item back byte for byte, including non-ASCII, and restores the search list. The partition step is needed because the first attempt, using a plain-Alogin item, blocked on a headless prompt. The test never touches a real browser item and never runs on a developer machineKEYCHAIN_TIMEOUT_MSand fail closed. The addon copies the password withCFDataGetBytesand never writes into framework-owned byteschromium-crypto.test.tsmocks only the native/securityboundary. It covers: addon used first, no fallback on denied/failed/throw, missing →keychain-item-missing, fallback when the addon fails to load or has the wrong shape, and the fallback keeping exit 44 → missing and denial → null. 5 of these were red against the old implementationbun run scripts/build-native.ts(universal arm64 + x86_64), vitest onsrc/main/browser-import/,tsc -p apps/desktop, biome on changed files, and check-comment-hygiene / test-patterns / explicit-any / file-names / utils-enforcement. The full gate runs in CIChecklist
test-auditauthoring gate)