Repository navigation
chore(precommit): annotate known false positives so secret scanner passes - #1805
Conversation
…comment The husky pre-commit secret scanner flags several constants that look like private keys or .env values but are not credentials: - mongo:7 image SHA-256 digest pin (deploy-smoke-test.yml) - gum release tarball SHA-256 checksum (deploy-smoke-test.yml) - localhost:8545 anvil RPC URL written into the CI .env (deploy-smoke-test.yml) - public on-chain example tx hash in JSDoc (demoPatcher.ts) - max uint256 (0xff…ff) constants used as approval amounts (demoPatcher.ts, cowSwapHelpers.ts) - zero bytes32 sentinels used as non-EVM receiver / test fixture (cowSwapHelpers.ts, timelock-queue.test.ts) - fixed test fixture marker 0x1234…CDEF used to locate the patched word (Patcher.t.sol) Annotate each occurrence with the documented "pre-commit-checker: not a secret" marker that the hook already recognizes via is_known_false_positive_match. No runtime behavior changes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The hook's is_known_false_positive_match only checks PREV_LINE and CURR_LINE, so a marker placed above the const declaration was not seen for the literal on the following line. Move the comment directly above the literal so the remaining "Potential private key" warning clears. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughThis PR adds nine inline ChangesPre-commit Checker Clarification Comments
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test Coverage ReportLine Coverage: 89.97% (3240 / 3601 lines) |
Which Linear task belongs to this PR?
None — repository chore: the husky pre-commit secret scanner blocked unrelated branch commits because of false positives. No Linear ticket; happy to open one if preferred.
Why did I implement it this way?
The
.husky/pre-commithook already supports an opt-out marker: lines containingpre-commit-checker: not a secret(on the line itself or the line immediately above) are skipped by both the.env-secret check and the Ethereum-private-key regex check. Seeis_known_false_positive_matchandDISABLE_WITH_COMMENTin.husky/pre-commit.Several long-standing constants in the repo match those patterns but are not credentials. Rather than weakening the scanner, I annotated each false positive with the documented marker, placed adjacent to (or directly above) the matching line so the hook's PREV/CURR window sees it.
Annotated false positives:
.github/workflows/deploy-smoke-test.ymlmongo:7@sha256:…image digest pin (supply-chain integrity)EXPECTED_SHA256=fd1a34…gum release checksum (publisher-published)ETH_NODE_URI_LOCALANVIL=http://localhost:8545(local anvil URL written into CI.env)http://localhost:8545use inside the anvil readiness probescript/demoScripts/demoPatcher.ts0xff…ffmax-uint256 used as approval amountscript/demoScripts/utils/cowSwapHelpers.tsbytes32sentinel for non-EVM receiver (bridging disabled)0xff…ffmax-uint256 used as approval amountscript/deploy/safe/timelock-queue.test.tsbytes32test fixture (ZERO_BYTES32)test/solidity/Periphery/Patcher.t.sol0x1234…CDEFtest fixture marker used to locate the patched wordNo runtime behavior changes. The hook now exits with "Secret check passed" (no warnings) and all downstream pre-commit checks (forge build, typechain, tsc, lint-staged) pass.
Checklist before requesting a review
Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)