Skip to content

Add detector invariants project rule#4922

Open
dustin-decker wants to merge 1 commit intomainfrom
codify-detector-invariants
Open

Add detector invariants project rule#4922
dustin-decker wants to merge 1 commit intomainfrom
codify-detector-invariants

Conversation

@dustin-decker
Copy link
Copy Markdown
Contributor

@dustin-decker dustin-decker commented Apr 24, 2026

Summary

  • add a repo-local Cursor project rule for detector Go changes under .cursor/rules/detector-invariants.mdc. These will apply for Cursor users but also Bugbot CI automation.
  • encode detector invariants around verification semantics, Raw/RawV2, Redacted, SecretParts, result cleaning, and concurrency safety
  • give reviewers a concise checklist to catch compatibility and sensitivity regressions consistently

Test plan

  • Confirm the rule file is scoped to pkg/detectors/**/*.go
  • Verify the new .mdc file has no linter errors

Note

Low Risk
Low risk because this PR only adds a Cursor project rule file and does not change runtime code or detector behavior.

Overview
Adds a repo-local Cursor rule, .cursor/rules/detector-invariants.mdc, scoped to pkg/detectors/**/*.go, to guide detector reviews.

The rule codifies invariants around verification semantics (including VerificationError usage), secret redaction/non-leakage, Raw/RawV2 compatibility boundaries, Redacted/SecretParts expectations, result-cleaning behavior, and FromData concurrency/test-matrix requirements.

Reviewed by Cursor Bugbot for commit 10db740. Bugbot is set up for automated code reviews on this repo. Configure here.

Capture the detector contracts around verification, result identity, redaction, and tests so reviewers catch compatibility and sensitivity regressions consistently.
@dustin-decker dustin-decker requested a review from a team April 24, 2026 16:05
- Verifiers must use non-destructive API checks and never leak secret keys, tokens, or passwords into errors.
- `Raw` and `RawV2` are compatibility boundaries. Single-part credentials use `Raw` only, set to the token. Multi-part credentials set `Raw` to the key or secret value and `RawV2` to every piece needed for verification, including varying URL or host, IDs, and token. Once defined, do not change the shape or effective value.
- `Redacted` is display-only and must stay non-sensitive. When a stable key, account, or credential ID exists, set `Redacted` to that ID; never put the actual secret value there.
- `SecretParts` is the credential source of truth, and analyzer-facing keys must stay aligned with what analyzers expect.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the corresponding analyzer isn’t available in OSS, will Bugbot flag this as unnecessarily setting SecretParts, given it can’t validate the expected keys?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants