Skip to content

Secret scan: a second generic-api-key rule block silently drops the first block's exceptions for the workspace #8

Open

Description

@kert114

Type: Tech debt · Severity: Low · Size: XS (~an hour) · Difficulty: easy · Ready for agent: yes

What happens

The shared gitleaks workflow writes two [[rules]] id = "generic-api-key" blocks into its generated config when the caller is 60xAI/ai-brain-workspace. The first block holds the native post-processing exceptions from #7. The second, appended only for the workspace, holds the rotation-marker exception from #5. In gitleaks 8.30.1 the later block replaces the earlier one instead of merging with it (config/config.go:183, rulesMap[cr.RuleID] = cr). So for workspace scans, the native exceptions silently do nothing.

Expected: every reviewed generic-api-key allowlist applies to each caller it was written for, and adding a new central allowlist cannot silently drop another. Actual: for the workspace caller, only the last block's allowlists apply.

Impact

No credential slips through: the effect is stricter scanning, never looser. Today it makes no practical difference, because the workspace has never contained jobs/post-processing-rs/. It is a trap for the next central exception: a future allowlist could be silently ignored for workspace scans.

How it was found

Independent review of #7 on 2026-11-16. Synthetic repos under gitleaks 8.30.1: the exact Asymmetrix route and the three SHA256 values exit 0 under the pipelines caller, but exit 10 under the workspace caller.

Fix estimate

  • Where: .github/workflows/gitleaks.yml (config generation, around lines 68-104), README.md, tests/.
  • Approach: emit a single generic-api-key rule block. Append the workspace-only [[rules.allowlists]] entry to that same block, inside the existing caller condition, instead of opening a second [[rules]] block. Add a test that runs the workspace caller against the native exceptions' paths, and a pipelines caller against the rotation marker. Update the README paragraph that says the central rule has two allowlists.
  • Size: XS because it is one generated-config section plus a test.
  • Difficulty: easy, but keep both exceptions' boundary tests green.
  • Confidence: high.

Done when

  • The generated config contains exactly one generic-api-key rule block for every caller.
  • Under the workspace caller, the native exceptions and the rotation marker both pass, and same-path credentials still block.
  • Under the pipelines caller, the rotation marker is still scanned.

Activity

  1. coderabbitai commented on Nov 16, 2026

    @coderabbitai
    🔗 Related PRs

    #4 - fix(security): scope native metadata false positives exactly [open]
    #7 - fix(security): scope native metadata false positives exactly [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions