Pre-commit secret-scan hook: false positive on prvkey field accesses #35
Labels
No labels
app:activities
app:chat
app:events
app:forum
app:libra
app:market
app:restaurant
app:tasks
app:wallet
app:webapp
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
aiolabs/webapp#35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The pre-commit hook that scans for secrets (pattern:
PRIVATE KEY) flags field-access references likeauthService.user.value.prvkeyandauth.currentUser.value?.prvkeyas potential secrets. These are TypeScript property accesses on the user object — not literal key material — and they're scattered across the codebase (e.g.src/modules/market/composables/useMarket.ts:402-413).Reproduction
Stage any unrelated change to
src/modules/market/composables/useMarket.tsand rungit commit:The flagged content is unchanged from previous commits — the hook scans the whole file, not just the diff hunks.
Impact
Forces
--no-verifyon legitimate commits that touch this file or any other file referencing theprvkeyfield. That defeats the hook's value (it's habituating bypassing) and conflicts with the policy of never skipping hooks.Last triggered: commit
73b67d2(feat(market): public browse mode + auth toast at checkout), bypassed with --no-verify.Suggested fixes
Pick one or combine:
prvkeyto whatever ignore list the hook uses (likely a.gitleaks.toml,.secrets.baseline, or.detect-secrets.yamlfile at the repo root — needs locating).--staged/ unified-diff mode so they only look at lines being added.PRIVATE KEYregex so it requires the literal Bitcoin/Nostr/PEM prefix (e.g.-----BEGIN PRIVATE KEY-----ornsec1...) rather than just the substringprvkey.prvkey→privateKey(long-form) elsewhere in the codebase so the substring no longer matches the hook's pattern. Larger blast radius but produces a hook that stays useful.Notes
prvkeyfield is on theNostrUserinterface (likely insrc/lib/api/lnbits.tsorsrc/modules/base/auth/types.ts); it stores the user's actual Nostr private key in browser memory. So the hook's intent is right — keep an eye on this field — but the line-level heuristic is wrong.