Repository navigation
feat: read the breez api key from the keychain - #1897
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR appears safe to merge. SummaryAdds macOS keychain lookup as the last fallback for values read through
Reviews (1) · Last reviewed commit: "feat: read the breez api key from the ke..." · Reviewed by Greptile |
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
talosmachina
left a comment
There was a problem hiding this comment.
No findings. localProp falls back to the macOS keychain item named like the key, after the environment, Gradle properties and local.properties. Reviewed 0b0e066, light tier.
What I checked, and 4 candidates I ruled out
Read in full: keychainProp and localProp in app/build.gradle.kts and every localProp call site, README.md
Not built: on the Bitkit track an auto review does not run Gradle on the branch, so this is reasoned from the code and from CI
CI: build-local and Greptile green; build-and-test, lint, compose-ui and the e2e jobs still pending when I read it
Ruled out
- Linux CI:
/usr/bin/securityis not executable there, sokeychainPropreturns an empty provider beforeproviders.execis set up. - Failing lookup fails the build:
isIgnoreExitValue = trueand the empty-output filter turn a missing item into an absent value, so.orElse("")still applies. - Configuration cache: the read goes through
providers.exec, which Gradle records as a configuration input, so the cache stays valid; the author's rerun on a cache hit agrees. - Keychain read when another source has the key:
orElseis lazy, sosecurityruns only when the three earlier sources are all empty.
Merge confidence: 4/5, CI not finished and the change has no test (it is build configuration).
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed
Metadata note: the review session reports the model but not its reasoning setting.
coreyphillips
left a comment
There was a problem hiding this comment.
Two independent reviews, nothing blocking a merge.
worth doing, does not block
- Unreadable keychain item is treated the same as a missing one (app/build.gradle.kts:62-65)
nits
- Keychain fallback spawns a process for every unset localProp key (app/build.gradle.kts:68-73)
jvsena42
left a comment
There was a problem hiding this comment.
No findings at 0b0e066. Reviewed as a credential-handling change.
What I checked
localProporder (environment, Gradle property,local.properties, keychain) matches the README;orElseis lazy, sosecurityruns only when the earlier sources are absent.- Every
localPropkey now also queries the keychain (USDT_*,ESPLORA_URL,TREZOR_BRIDGE*, the debug-only E2E keys). A value appears only for a generic-password item with that exact service name and the user's account, so nothing is picked up by accident. - No leak: the
securityargv holds no secret and its stderr is captured, not printed. - Linux CI and release are unchanged:
/usr/bin/securityis absent, andrelease.yml:73still guards the env var. - Edge cases looked at and not raised: a blank
BREEZ_API_KEY=line inlocal.propertiesblocks the keychain fallback (no template ships one, so it takes a deliberate blank); the build output still holds the key in plain text, which the README wording glosses over but the code comment states correctly. - iOS twin synonymdev/bitkit-ios#1317 reviewed in the same pass, also clean.
Device gate: no device check needed — build configuration only, no journeys; perf: build-time only, a missing-item security lookup measured at ~10 ms, ≤12 per variant on macOS.
Skipped — covered by CI at 0b0e066: build-and-test, lint, detekt, compose-ui, e2e (all green).
Reviewer model: claude-opus-5-5 (coordinator), claude-fable-5-2 (primary review)
Reasoning effort: Not exposed
piotr-iohk
left a comment
There was a problem hiding this comment.
QA review
Scope: Full review of the complete PR diff against merge base 35265252, at 0b0e066.
No new actionable code findings.
localProp reads the macOS keychain only after the environment, Gradle properties, and local.properties. With /usr/bin/security absent, the fallback stays empty and the build continues. CI and lint succeeded on this revision. The release workflow still rejects an empty BREEZ_API_KEY before Gradle.
Compared with bitkit-ios#1317 at 568b0be: iOS Release builds fail when that keychain item is missing or unreadable, while this Android change keeps the documented local result (the app builds and Spark stays off). The existing note still matches the code: a stored key that security cannot read is treated as absent.
Device testing: not performed. This is build configuration only; no journey applies.
Validation: a Gradle 9.9.0 probe of this provider chain, with configuration cache reused, resolved an absent security binary to an empty key and a default URL; a non-zero providers.exec with isIgnoreExitValue still produced a value; a later command stdout was visible on the following run when the provider was a task input. /usr/bin/security was not executed in this environment.
Suggested additional test cases
- macOS. No
BREEZ_API_KEYin the environment, Gradle properties,local.properties, or the keychain. Run./gradlew :app:generateMainnetDebugBuildConfig. The build succeeds and the generated mainnet debugBuildConfig.BREEZ_API_KEYis empty. - macOS. Set
BREEZ_API_KEYin the environment to a sentinel and store a different value in the keychain item. Run the same task.BuildConfig.BREEZ_API_KEYis the sentinel.
Reviewer model: grok-4.7
Reasoning effort: high
|
Merged: approved by @coreyphillips and @jvsena42, checks green; both non-blocking points are answered in their threads and tracked in #1906. |
Twin: synonymdev/bitkit-ios#1317
Local builds can read
BREEZ_API_KEYfrom the macOS keychain, so developers need no plain copy of the key inlocal.properties.Description
app/build.gradle.kts:localProp(key)falls back to the macOS keychain item named like the key, read with/usr/bin/securitythroughproviders.exec, after the environment variable, the Gradle property andlocal.properties. Without/usr/bin/security(Linux CI) or without the item it returns nothing, so CI and existing setups resolve the key as before.README.md: documents where Gradle reads the Breez API key from and the command that stores it in the keychain.Out of Scope
.github/workflows: CI keeps passing the key from repository secrets as an environment variable.localPropget the fallback; no other key is stored in the keychain by this PR.app/build.gradle.kts: warning on an unreadable keychain item and limiting the fallback toBREEZ_API_KEY, tracked in chore: warn on an unreadable keychain key #1906 (thread, thread).Design
N/A — no UI changes.
Preview
N/A
QA Notes
Setup
macOS, with the key stored once:
security add-generic-password -U -a "$USER" -s BREEZ_API_KEY -w, and noBREEZ_API_KEYin the environment, Gradle properties orlocal.properties.Journeys
N/A — no user-visible behaviour change.
Manual Tests
./gradlew :app:generateMainnetDebugBuildConfig→ the generated mainnetBuildConfighas a non-emptyBREEZ_API_KEY— build-time config, not drivable on a deviceAutomated Checks
just compile,just test,just lintEvidence
BREEZ_API_KEYunset in the environment, the generated mainnet debugBuildConfigheld the full-length key, also on a configuration-cache rerun.just compile,just testandjust lintpassed.Gaps
/usr/bin/securityis absent and the key comes from the environment as before.Models used
claude-opus-5-5(reasoning: Not exposed)claude-opus-5-5(reasoning: Not exposed)Metadata note: the session tools report the model but not its reasoning setting.