Skip to content

Guard the tests against literal credentials - #19

Merged
imanimanyara merged 1 commit into
mainfrom
chore/credential-guard
Oct 19, 2026
Merged

imanimanyara merged 1 commit into
mainfrom
chore/credential-guard

Conversation

@imanimanyara

Copy link
Copy Markdown
Member

Why

Secret scanners cannot tell a test password from a leaked one, and report both. GitGuardian raised 28 incidents across laranail by 2026-10-18, 27 of them test literals or false positives, each closed by hand. This guard keeps the next one out of a push.

What changed

  • tests/Architecture/NoLiteralCredentialsTest.php: two tests from laranail/package-tools' AssertsNoLiteralCredentials. One fails on a literal credential under tests/, the other on a TestCredentials purpose that is not a single lowercase word.
  • composer.json: laranail/package-tools raised to ^0.1.10, which ships the purpose check.
  • CHANGELOG.md: an [Unreleased] → ### Changed entry.

The scan inspects 5 PHP files, and both tests have a floor of minFiles: 4, so a wrong path fails rather than passing over nothing. The v0.1.10 scanner found no literal credentials on main, so no test changed.

Red proof

After committing, each test was shown to fail, then restored with git checkout HEAD --:

  1. A scratch literal under a password key appended to the guard file: the literal test failed (named), and the purpose test passed.
  2. A scratch TestCredentials::password('smtp-new') appended: the purpose test failed on 'smtp-new'.

Nothing scratch is committed.

Local gates (PHP 8.5)

  • Pest: 8 passed (25 assertions)
  • vendor/bin/laranail-pint --test: passed
  • No PHPStan or Rector config in this repo.

Secret scanners cannot tell a test password from a leaked one, and report
both. GitGuardian raised 28 incidents across laranail by 2026-10-18, 27 of
them test literals or false positives, each closed by hand. This guard
fails the suite on a literal credential, and on a TestCredentials purpose
that is not a single word, so the next one never reaches a push.

laranail/package-tools moves to ^0.1.10, which ships the purpose check.
Copilot AI balanced review requested due to automatic review settings October 19, 2026 15:29

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 423ffb2 into main Oct 19, 2026
8 checks passed
@imanimanyara
imanimanyara deleted the chore/credential-guard branch October 19, 2026 16:22
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