Redact secret-bearing environment variables - #3
Merged
Merged
Conversation
phpinfo() prints the whole process environment three times: as APP_KEY under Environment, and as $_ENV['APP_KEY'] and $_SERVER['APP_KEY'] under PHP Variables. On a Laravel app that renders the encryption key, the database password and every third-party credential on one page. Redaction::value() replaces the value of a variable whose name contains a sensitive pattern. The row stays, so the page still shows which variables are set. Matching is scoped to the two environment modules, so PHP settings such as "Max keys", "Tokenizer Support" and "highlight.keyword" keep their values. Config controls the behaviour: redact-environment turns it off, redact-patterns changes the set, redact-placeholder changes the text. The keys are flat, so mergeConfigFrom gives an already-published config file the new defaults. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Member
Author
|
Both red legs are pre-existing. They fail at |
Laravel 11 is past its security-support window, so Composer now refuses to load any 11.x release and both Laravel 11 legs die at composer update. The failure predates this branch: origin/main resolves the same matrix leg the same way. Those legs check that the package still works on Laravel 11, not that Laravel 11 is patched, so turn off advisory blocking for them alone. Every other leg keeps it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Member
Author
|
Fixed in c892a3d. The Laravel 11 legs now skip advisory blocking; every other leg keeps it. All 16 checks pass. Whether the package should still claim Laravel 11 support is a separate call, and yours. |
Merged
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.
The problem
phpinfo()prints the whole process environment three times: once underEnvironmentasAPP_KEY, and twice underPHP Variablesas$_ENV['APP_KEY']and$_SERVER['APP_KEY'].On a Laravel app that puts the encryption key, the database password and every third-party credential on one page in plaintext. One real panel showed 21 secret-bearing variables, 63 rows. The page is gated to trusted admins, so this is not anonymous exposure. A screenshot, a shared screen, a support session, or any XSS on the panel still leaks the whole credential set at once.
This is standard
phpinfo()behaviour, not a regression. It has been true since the package shipped.The change
Redaction::value()replaces the value of a variable whose name contains a sensitive pattern. It keeps the row, so the page still shows which variables are set.Default patterns:
KEY,SECRET,PASSWORD,TOKEN,CREDENTIAL,PRIVATE,SALT,SIGNING,SIGNATURE,DSN,LICENSE,WEBHOOK.Two details make this safe to turn on by default:
EnvironmentandPHP Variablesmodules. Those are the only two placesphpinfo()prints the environment. Every other module holds PHP settings, whereMax keys,Cached keys,Hash keys restarts,Tokenizer Supportandhighlight.keywordall match the patterns but hold no secret. A test walks a real capture and asserts nothing outside the two modules is redacted.APP_KEY,$_ENV['APP_KEY']and$_SERVER['APP_KEY']are treated alike.An unset or empty variable is left alone. It leaks nothing, and the blank tells you it is not set.
Configuration
redact-environmenttrueredact-patternsRedaction::DEFAULT_PATTERNSredact-placeholder[redacted]The keys are flat, so
mergeConfigFromgives an already-published config file the new defaults. A nested array would not.Tests
tests/RedactionTest.php, 31 new cases. Both directions are covered: the patterns redact, and the PHP settings that read like secrets do not.vendor/bin/pestis green at 46 passed.Not in this PR
The view still builds its tables from
x-filament-tables::table/row/cell, which Filament 4 removed.composer.jsonand CI both claim v4 and v5 support, and CI stays green because no test renders the page. Worth a separate issue.