Compare

On this page

Service output #

Each library logs the same service scenarios. A catch means the planted value was removed; partial masks count. go-masker v3 Sensitive ties Secret on fmt, JSON, XML and slog, and masq, go-masker and go-mask catch a tag-only value that embargo misses.

Scenario catch rate

Service outputembargo slogembargo zappii-shield v3.0.0ferret-scan v2.4.3masq v0.2.3slog-formatter v1.3.0go-mask v0.6.2go-masker v0.6.1godlp v1.2.15
Password under the key passwordcaughtcaughtcaughtcaughtcaughtcaughtcaughtcaughtleaked
Config struct holding a database DSNcaughtcaughtcaughtleakedcaughtleakedleakedcaughtleaked
DSN inside a wrapped errorcaughtcaughtcaughtleakedcaughtleakedleakedcaughtleaked
DSN and an API key joined with errors.Joincaughtcaughtcaughtleakedleakedleakedleakedcaughtleaked
Bearer header value in a log messagecaughtcaughtcaughtleakedleakedleakedleakedcaughtleaked
Third-party API key in a log messagecaughtcaughtcaughtleakedleakedleakedleakedleakedleaked
Redirect URL query, never loggedleakedleakedleakedleakedleakedleakedleakedleakedleaked

The last row is a URL query that a redirect sends to the browser. No logging library sees it; an output test does. Exact outputs and setup

Speed #

On the same five JSON slog events, embargo is 1.09 to 1.60 times faster than go-masker given the same email and card rules, and embargo’s default scanner is 1.83 to 5.79 times faster than pii-shield’s default policy. Time per event

Time per log event

Each library is the newest release that builds with embargo’s minimum Go 1.26.11, and the timed rules match where both sides have them. Configurations, medians and allocations · Per-detector benchmarks

Where a logging policy stops #

Each case is a small Go program that writes a planted secret through one application path: a struct field added after its masking rules were written, an error from an HTTP client, a DSN, a dumped header and eight others. Four approaches mask the same output, then the same embargotest recorder checks it. Masked means the secret disappeared, detected means it survived masking and the test caught it, missed means both let it through.

Application pathmasq tagsManual redactKey denylistembargo
added struct fielddetecteddetecteddetectedmasked
client errordetecteddetecteddetectedmasked
HTTP querydetectedmaskeddetectedmasked
wrapped errordetectedmaskeddetectedmasked
DSN passworddetecteddetecteddetectedmasked
header dumpdetecteddetecteddetectedmasked
unwrapped loggerdetecteddetecteddetecteddetected
card last fourmissedmissedmissedmissed
truncated cardmissedmissedmissedmissed
base64 tokendetecteddetecteddetectedmasked
hex tokendetecteddetecteddetecteddetected
split token linesmissedmissedmissedmissed

masq v0.2.3 uses its documented WithTag("secret") in the tag column and its field-name policy for Password, password, token and authorization in the denylist column. The manual column replaces 13–19 digit cards and password or token assignments in strings and errors. The embargo column is NewSlogHandler with NewScanner() defaults. The runnable cases

  • The unwrapped logger writes through log.New and skips every slog handler. Only the output test catches it.
  • Last-four and eight-digit card fragments are not card numbers to any detector, and the split token crosses two JSON records. These need a policy of their own.
  • A hex token is not decoded by the detectors, but the canary check catches it.

Each check of the recorder on the output after embargo masking, on its own. Clear means this check did not fire, which includes a value that was already masked:

Output after embargo maskingDetector onlyWhole canary onlyCanary with 16-byte fragments
added struct fieldclearclearclear
client errorclearclearclear
HTTP queryclearclearclear
wrapped errorclearclearclear
DSN passwordclearclearclear
header dumpclearclearclear
unwrapped loggerdetecteddetecteddetected
card last fourclearclearclear
truncated cardclearclearclear
base64 tokenclearclearclear
hex tokencleardetecteddetected
split token linesclearcleardetected

Accuracy #

15 public datasets, 239.9 MB, 1,048,835 lines of LogHub system logs plus web access, Kubernetes audit and CloudTrail logs. Measured false positives are sample estimates on previously seen splits, with no recall claim. Licenses and classification rules

Per-detector precision and recall on a held-out synthetic set · Credential detectors · Country identifiers