Files
magpie/internal/redact
yetone eef99e4bbe redact: a value on both Masked words and Never mask is masked; Never mask still beats the user's rules
TakaNaShi_ShiKi on X asked for a way to keep a value from being masked.
That exists already: Settings › Privacy › When a value is found ›
Never mask (RedactAllow, Options.Allow, since b00c82acf), and a click
on a masked value in a request's masking record adds it there
(/api/masking/allow). It is applied in apply() to every span, whichever
finder found it: magpie's rules, the user's rules, the local model and
known values. Nothing new is wired for it here.

What was undecided was the order between it and the user's own lists.
apply() let a Never mask value go even when the same value was one of
the user's Masked words, and an allowed value hid a masked word inside
it (Masked word "kelvarn", Never mask "team.inbox@kelvarn.io": the
word went out). The value menu already refuses Never mask on a Masked
word ("One of your Masked words"), but the settings list doesn't.

Decided: of two things the user asked for, the one that keeps a value
from the vendor wins. A Masked word is masked even when Never mask
lists it, and a Masked word inside a value Never mask lets go is
masked. Never mask still wins over every finder, the user's own rules
included: a value named there is the exception to the user's pattern
(rule PROJ-\d{4}, Never mask PROJ-0001: PROJ-0001 goes as written,
PROJ-0002 is masked). Matching is unchanged: a whole value, any case.
A user with a value on both lists before this sees it masked from the
next request on.

Test: TestMaskedWordsWinOverAllow (new). Broken by hand (apply()
restored): FAIL "a value on both lists went as written: \"deploy on
build-01, mail team.inbox@kelvarn.io, …\"" and "a masked word inside an
allowed value". Restored: ok. TestAllowLetsAValueGo still passes.

Run (mote-run, at eb7ce732a): gofmt -l internal/redact (empty), go vet
./internal/redact/, go test -count=1 ./internal/redact/... ok.
Not tried: a running magpie; no GUI change, so no GUI run in this
commit.

docs/subsystems/gateway-routing.md says the order beside Never mask.
2026-11-08 11:49:18 +08:00
..