8000 fix(security): scope the scheduled secret sweep to a real finding by shroominic · Pull Request #150 · shroominic/OpenGlucose · GitHub
[go: up one dir, main page]

Skip to content

fix(security): scope the scheduled secret sweep to a real finding - #150

Closed
shroominic wants to merge 2 commits into
mainfrom
fix/secret-scan-selftest-label
Closed

shroominic wants to merge 2 commits into
mainfrom
fix/secret-scan-selftest-label

Conversation

@shroominic
@shroominic shroominic commented Sep 18, 2026 •
Copy link
Copy Markdown
Owner

Fixes #149. Base is main.

What was wrong

The scheduled run has no commit range, so it sweeps the whole clone, including
commits that are only reachable from other branches. That made main red for
values that are not credentials.

Reproducing the run with the scanner version the workflow resolves to
(gitleaks-action pins gitleaks 8.24.3), instead of trusting the single finding
in the issue, gives four classes:

Class Where Verdict
macOS self-test storage entry name openhealth/lib/yuwell_macos_debug_main.dart Keychain label, not a credential.
App Store Connect issuer identifier openhealth/scripts/testflight.sh Identifier, not a credential; the API credential is a .p8 key that is not in the repository.
Test-only fixture defaults openhealth/test/sqflite_health_repository_test.dart Synthetic fixture ids in a test helper.
Published synthetic masking vector packages/cgm_cbio/test/cbio_crypto_test.dart Material, not a false positive. It is a function of the vendor stream key.

The fourth class is the one that changes the shape of this fix. It cannot be
made honest by re-encoding the fixture, and a scanner setting cannot un-publish
a value that is already in public history.

What this changes

  • One [allowlist] with the default rule set extended, never replaced. No rule
    is disabled and no path is exempt.
  • The three non-secret entries are anchored to their exact line, so a new value
    anywhere else still fails the sweep.
  • The key-derived binding is allowlisted by binding name only, with the
    reason recorded in the file, and is not treated as a false positive.
  • One obsolete commit is scoped: the sensor lane's first redaction commit
    carried a synthetic, key-shaped fixture. That commit was rewritten and is no
    longer a tip, but release/v0.4.0-lane-append merged it and then reverted the
    merge, so it is still reachable from the aggregate. A later rebuild of that
    aggregate will make this entry dead.

No key byte, key-derived vector, or device address is restated in the policy.

Verification

Command Result
gitleaks detect --config .gitleaks.toml (default scope) exit 0, 0 findings
gitleaks detect --config .gitleaks.toml --log-opts=--all exit 0, 0 findings
gitleaks detect --config .gitleaks.toml --log-opts=--remotes exit 0, 0 findings
gitleaks detect --config .gitleaks.toml, tree w 8000 ith a deliberate canary secret committed exit 2, canary detected
gitleaks detect --no-git --source . --config .gitleaks.toml exit 0, 0 findings

All runs with gitleaks 8.24.3, the version the pinned action resolves to.

Decisions taken

  • Keep the whole-clone scope. Narrowing the scheduled job to main would
    also make it green, but it would stop reporting history that is reachable from
    the released aggregates. The scope stays as it is and the values are named
    individually instead.
  • Extend, never replace. useDefault = true, no disabled rule, no exempt
    path.
  • Record the material instead of hiding it. The key-derived entry says what
    it is and points at the compensating control; it does not claim to be a false
    positive. The tip guard in security/gitleaks-vendor-material.toml rejects
    that binding, and any successor, on every tip.
  • Two of the findings are outside the sensor lane. They are allowlisted
    narrowly here so the gate is actionable now; moving those values out of source
    belongs to their own lanes.

Decision request

The vendor stream key and the key-derived vector are already in this
repository's public history and reachable from the 0.4.0 aggregate. Whether
that material may ship at all, and whether to purge it (a rewrite of the
unmerged sensor branches and their open pull requests) or rotate it, is an owner
decision. Until it is made, the sweep stays honest about what it is exempting
and the tip guard keeps new commits clean.

The scheduled `Security` run on `main` fails with one gitleaks
`generic-api-key` finding: `const testKey = 'ct5.macos.selftest.v1'` in the
macOS self-test entry of the yuwell debug path. The value is a local keychain
label, not a credential, and the commit that carries it is only reachable from
another branch, so the full-clone sweep reddens `main` for content `main` never
shipped.

Adds a narrow `.gitleaks.toml`: the default rule set still applies and no path
or rule is exempt, only that exact value, matched against the flagged line.

Verified with gitleaks 8.24.3 on the real file content from the commit the
scheduled sweep flags: one leak without the config, no leaks with it.
The scheduled run reports on the whole clone, so `main` was red for
one non-secret value on another lane. Reproducing the run with the scanner
version the workflow resolves to (gitleaks 8.24.3) finds four distinct classes,
not one: the macOS self-test keychain label, an App Store Connect issuer
identifier, two test-only fixture defaults, and one key-derived masking vector
that the sensor lane published.

The single allowlist now names each of them, anchored to the exact line, so the
default rule set stays in force and no path is exempt. The key-derived binding is
recorded rather than dismissed: it is material, it is already public, and
`security/gitleaks-vendor-material.toml` is what rejects it and any successor at
every tip.

Also records one superseded commit. The sensor lane's first redaction commit
carried a synthetic, key-shaped fixture; that commit has been rewritten and the
tip is clean, but `release/v0.4.0-lane-append` merged it and then reverted the
merge, so it stays reachable from the aggregate.

Refs #149, #147.
@shroominic
Copy link
Copy Markdown
Owner Author

Carried by the GS1 consolidation in PR #209 (branch feature/cbio-gs1, head 3eca4f4).

This PR is contained in the consolidated line; the merge that carries it is 3eca4f4.

Closing as subsumed by the consolidation - not as won't fix. The per-defect evidence stays in this thread, and the carrying commit above is where the change now lives.

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.

Scheduled secret scan is red on main for a non-secret macOS self-test label

1 participant

0