Skip to content

Rework the redaction API - #4

Merged
dp88 merged 2 commits into
mainfrom
redaction-api
Sep 11, 2026
Merged

dp88 merged 2 commits into
mainfrom
redaction-api

Conversation

@dp88

@dp88 dp88 commented Sep 11, 2026

Copy link
Copy Markdown
Member

Follow-up to #3.

What this changes

v1.2.1 left redaction to the view. Every cell had to call Redaction::value(), and a published view that missed one call printed that secret.

Now the page redacts the capture before the view receives it. The packaged view and config are back to their v1.2.0 form, byte for byte, and a published view needs nothing.

Using it

Nothing to set up. To adjust:

FilamentPHPInfoPlugin::make()
    ->redact('INTERNAL_*')   // redact these too
    ->reveal('STRIPE_KEY')   // always show these

Both methods take exact names or * wildcards, ignore case, and apply anywhere on the page. ->placeholder() and ->withoutRedaction() cover the rest.

The built-in terms (password, key, secret and so on) match only the Environment and PHP Variables sections, so Max keys and Tokenizer Support keep their values.

Breaking for v1.2.1 users

Redaction and the redact-* config keys are gone. A config file published from v1.2.1 references Redaction::DEFAULT_PATTERNS, so the app will not boot until those keys are deleted. The README covers it.

Tests

44 passing.

🤖 Generated with Claude Code

v1.2.1 exposed redaction as a static class plus three flat config keys holding a
list of uppercase substrings. Adding one term meant copying the whole default
list, there was no way to name a single variable, and no way to force a variable
to stay visible.

Redactor replaces it. Four methods cover the cases:

  FilamentPHPInfoPlugin::make()
      ->redact('SESSION_FINGERPRINT')
      ->redactContaining('tenant')
      ->reveal('AWS_ACCESS_KEY_ID')
      ->placeholder('***')

redact() and reveal() take exact names, ignore case, and accept APP_KEY or
$_ENV['APP_KEY'] for the same variable. redactContaining() adds to the defaults
rather than replacing them. reveal() beats every other rule.

Term matching stays scoped to the Environment and PHP Variables sections, so PHP
settings named "Max keys" or "Tokenizer Support" keep their values. A name passed
to redact() applies everywhere, because you named it on purpose.

The page hands the view a Redactor rather than the view calling a static, so a
panel can configure it. fromConfig() still reads the 1.2.x config keys, so an
edited config file does not silently lose a term and start printing that value
again. A view published against 1.2.x calls the removed static and must be
republished.
The page handed the view a Redactor and left every cell to call it. A published
view that missed one call printed that secret. The page now redacts the capture
in getViewData(), so the view receives safe data and needs nothing. The packaged
view and config are back to their v1.2.0 form.

redact() and reveal() now take exact names or * wildcards, which covers what
redactContaining() did, so that method is gone. The config file no longer holds
redaction settings. The plugin is the one place to adjust it.
@dp88
dp88 merged commit 918d9ed into main Sep 11, 2026
16 checks passed
@dp88
dp88 deleted the redaction-api branch September 11, 2026 13:30
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.

1 participant