SecretScanner
Scans a set of files line by line for secrets matching regex rules. Lines containing an allowlisted substring are skipped entirely. Every matching line is reported as a {@see SecretFinding} whose excerpt is redacted — the full secret is never echoed back into the report.
SecretScanner::__construct()
public function __construct(array $rules, array $allowlist = []):Parameters
| Name | Type | Description |
|---|---|---|
| $rules | list<array{id: string, pattern: string, severity: string}> | |
| $allowlist | list<string> | substrings that, if present in a line, suppress any match on it |
Throws
InvalidArgumentException when a rule's pattern is not a valid PCRE
SecretScanner::scan()
public function scan(iterable $files): Milpa\Ops\Security\SecurityReportRecorre los archivos línea por línea y devuelve lo que casó con alguna regla, salvo lo que la lista de excepciones perdona. Un archivo ilegible se salta en silencio: un escáner que aborta a la mitad reporta menos hallazgos y se ve exactamente igual que uno que no encontró nada.
Parameters
| Name | Type | Description |
|---|---|---|
| $files | iterable<string> | absolute paths |