Skip to content

Rewrite fake credentials and add narrow secret-scan configs - #23

Merged
imanimanyara merged 2 commits into
mainfrom
chore/secret-hygiene
Oct 8, 2026
Merged

imanimanyara merged 2 commits into
mainfrom
chore/secret-hygiene

Conversation

@imanimanyara

Copy link
Copy Markdown
Member

Summary

  • tests/Feature/EncryptionTest.php: API_TOKEN=plaintext-secret is now test-secret-not-real; the round trip asserts the same absence and restoration.
  • tests/Unit/SecretLeakTest.php: the redactor test used a DSN with inline credentials. The secret is now test-secret-not-real and the DSN is assembled by concatenation, so the string under test is the same shape.
  • Appends tests/Fixtures/**/* to the existing .gitguardian.yaml ignored_paths and adds .gitleaks.toml (export-ignored). The existing ignored-matches entries and show-secrets are untouched.

On the hyphenated ignored-matches: ggshield (checked against v1.55.0, core/config/utils.py replace_dash_in_keys) accepts it, converting dashes to underscores, and prints a deprecation warning naming ignored_matches. It works, so the spelling is left as it is.

Secret-scan hygiene, approved by the owner as one PR per repository. secret_scan.py detect found no real secrets.

Verification

  • secret_scan.py check --ref HEAD: exit 0 (was 3 dummy findings).
  • pest (539 passed), phpstan, laranail-pint --test: clean locally.

API_TOKEN=plaintext-secret and a DSN with inline credentials read as
secrets to a scanner. The tests now use test-secret-not-real, and the
DSN is assembled by concatenation, so each still asserts the same
round trip and redaction.
Append the named test fixture directory to ggshield's ignored_paths and
add a gitleaks config allowlisting the same path, both written by
agent-kit's secret_scan.py. The new gitleaks file stays out of the dist
archive. Existing entries are unchanged; nothing under src/, no whole
test tree and no detector is excluded.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 12:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@imanimanyara
imanimanyara merged commit c13e7d7 into main Oct 8, 2026
3 checks passed
@imanimanyara
imanimanyara deleted the chore/secret-hygiene branch November 1, 2026 17:23
imanimanyara added a commit that referenced this pull request Nov 7, 2026
This file carried `ignored-matches` and `show-secrets`. ggshield reads
`ignored_matches` and `show_secrets`; a hyphenated key is not an alias. It
parses as valid YAML, is simply not a key ggshield looks for, and the exemption
it describes never applies — with no warning, because an unknown key is not an
error.

So all six placeholder exemptions added in #10 have been inert since
2026-09-17. Nothing surfaced it: the envkit_canary() change keeps new commits
off the assignment-line shape the detector matches, so the exemptions were
never the thing holding the scan green.

The estate-wide pass in #23 converted `ignored-paths` to `ignored_paths` here
and in 26 other configs, but could not know about the two keys only this file
has. This file was the last hyphenated one in either org.

Canonical spelling confirmed against GitGuardian's own configuration docs and
ggshield's `.gitguardian.example.yml`, both of which use underscores
throughout. The trap is recorded in the file so the next reader does not
"tidy" it back.
imanimanyara added a commit that referenced this pull request Nov 7, 2026
`plaintext-secret` sat in the group headed "still on KEY=value lines in
the current tree, so these are the entries actually doing work". It is
not in the tree at all -- #23 removed it -- and survives only in three
commits of history, so it belonged in the second group. An exemption
whose stated reason is wrong is a licence rather than a ceiling.

Re-measured every entry while here. The other five are correctly placed:
`plaintext` is at EncryptCliTest.php:11 and `oldsecret` at
AuditTest.php:128, both still on assignment lines; `hunter2`, `newsecret`
and `redaction-canary-not-a-secret` are in the tree but on no assignment
line. Each line now names where its value actually is.
imanimanyara added a commit that referenced this pull request Nov 7, 2026
* Record what the ggshield config does and does not reach

The file is read by the ggshield CLI, so it governs a local or manual
`ggshield secret scan`. It does not configure the GitGuardian GitHub App,
whose check on a pull request is scanned server-side with its exemptions
held in the dashboard -- which is why the 2026-11-07 finding had to be
resolved there while this file already existed here.

Measured the same day: no workflow runs ggshield, across 429 workflow
files in laranail/packages and simtabi/packages plus the 8 reusable
workflows in laranail/.github. The entries therefore have no consumer in
CI today, so a green GitGuardian check is not evidence that one of them
applied. Correcting the key spelling was still right; the note stops the
next reader mistaking the file for a CI-level control.

* Fix a wrong measurement in the exemption list

`plaintext-secret` sat in the group headed "still on KEY=value lines in
the current tree, so these are the entries actually doing work". It is
not in the tree at all -- #23 removed it -- and survives only in three
commits of history, so it belonged in the second group. An exemption
whose stated reason is wrong is a licence rather than a ceiling.

Re-measured every entry while here. The other five are correctly placed:
`plaintext` is at EncryptCliTest.php:11 and `oldsecret` at
AuditTest.php:128, both still on assignment lines; `hunter2`, `newsecret`
and `redaction-canary-not-a-secret` are in the tree but on no assignment
line. Each line now names where its value actually is.
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