fix(masker): close audit leak vectors, secure by default#1
Merged
Conversation
Remediates the audit findings on real-world leak paths: - H1: traverse objects (JsonSerializable / Stringable / public props) with cycle protection — secrets carried by objects no longer leak. - H2: mask the log message (on by default). - M1: scan integer values, not just strings. - M2: SegmentKeyMatcher catches compound keys (db_password, userToken, x-api-key) while avoiding false positives like "tokenizer". - M3: sub-string masking via ValueMatcherInterface::redact() — only the matched token is masked, surrounding text is preserved. - M4: CreditCardMatcher with Luhn validation replaces the broad digit-run regex; added AWS / Google / PEM patterns. Behaviour is now secure by default (segment keys, message masking, object traversal); opt out via matchKeysExactly(), maskMessage(false), traverseObjects(false). Minimum PHP bumped to 8.2 (required by the property-test tooling). Quality gates kept green: PHPStan max, 100% coverage, Infection MSI 100%, black-box property suite. Docs and CHANGELOG updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Point composer support/source to Tiime-Software/MonologMasker and add the Tiime header to the README. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Contexte
Audit de la lib (mission : empêcher une fuite de secret dans les logs). L'outillage et l'archi étaient solides, mais l'audit a révélé des angles morts du périmètre de masquage : ce que la lib ne voit pas peut fuiter malgré 100 % de couverture. Cette PR corrige ces vecteurs, en mode sécurisé par défaut.
Correctifs (par finding d'audit)
JsonSerializable,Stringable, propriétés publiques) avec protection anti-cycle (SplObjectStorage).messagejamais masqué :MaskingProcessormasque aussi le message (activé par défaut).SegmentKeyMatcherdétecte les clés composées (db_password,userToken,x-api-key) sans faux positifs (tokenizer).ValueMatcherInterface::redact()(le texte autour est préservé).CreditCardMatchervalidé par Luhn ; ajout de patterns AWS / Google / PEM.Changements de comportement (assumés, sécurisé par défaut)
matchKeysExactly(),maskMessage(false),traverseObjects(false).ValueMatcherInterfacegagneredact()(impacte les implémentations custom). VoirCHANGELOG.md.Qualité
make validateentièrement vert :array_valuessur variadic — neutralisés et commentés dansinfection.json.dist)🤖 Generated with Claude Code