Repository navigation
Guard the tests against literal credentials - #85
Merged
Merged
Conversation
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: the suite now fails on any literal credential under tests/, and on any TestCredentials purpose that is not a single lowercase word, which scanners read as the password. The guard is laranail/package-tools' shared AssertsNoLiteralCredentials, so the floor rises to ^0.1.10, the first release with the purpose check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
What changed
tests/Tools/Architecture/NoLiteralCredentialsTest.phpruns package-tools' sharedAssertsNoLiteralCredentialswith two tests: no literal credential anywhere undertests/, and everyTestCredentialspurpose a single lowercase word.laranail/package-toolsinrequire-dev:^0.1→^0.1.10. The test is a PHPUnit class undertests/Tools/, so the existingToolssuite and its autoload-dev namespace already run it.[Unreleased]→### Changedentry.No literal credentials were found on
main, so no test values changed.Scan size and floor
The scan inspects 91 PHP files under
tests/; both assertions useminFiles: 82(about 90%), so a wrong path fails instead of passing over nothing.Red proof
With the commit in place, a scratch line holding a literal under a
passwordkey (generated at run time) turned the literal test red, and a scratchTestCredentials::password()call with a hyphenated purpose turned the purpose test red. Both were restored withgit checkout HEAD -- <file>; nothing scratch is committed.Local gates
laranail-pint --test: passed--debug --memory-limit=2G): no errors--dry-run --debug): no changes