/bug-handler:tune-privacyfrom Bug Handler
Use when configuring or debugging bug_handler sanitizers and filters - masking PII/secrets in reports, DenyListFilter/AllowListFilter paths, payload size limits, fields arriving masked that should be readable, fields arriving readable that should be masked, or compliance requirements on diagnostic data.
Ships in Bug Handler. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The client runs configured sanitizers in order. The default list is empty.
The outbox and built-in reporters use the resulting serialized payload. Custom
reporters and share text or file name builders should use event.toMap() too.
sanitizers: [
FilterSanitizer(DenyListFilter({...})), // 1. structurally REMOVE what must never leave
DefaultSanitizer(), // 2. mask secrets/PII by key + content
const MaxDepthSanitizer(maxDepth: 8), // 3. prune pathological nesting
const TruncatingSanitizer(maxString: 2000, maxList: 100, maxMapEntries: 100),
SizeBudgetSanitizer(maxBytes: 64 * 1024) // Measure the final payload.
]
SizeBudgetSanitizer last so it measures the UTF-8 bytes of the final
JSON. It marks or removes top-level values, trimming exception, timestamp
and fingerprints last. The minimum result is the two-byte {}.AllowListFilter, when used, defines the ENTIRE payload shape: anything
not matched is gone, including exception itself if you forget to allow it.
Keep fields your receiver needs. In dev.7, outbox replay works even when
filters remove the serialized ID, timestamp or exception.Payload top-level keys: id, timestamp, handled, exception, context,
fingerprints, breadcrumbs, attachments. Provider data sits under
context.<providerName> (context.app, context.device, context.network,
context.user, plus custom names).
a.b.c exact; a.*.c exactly one segment; a.**.c any depth (including
zero); **.token any key named token anywhere. Filters recurse into lists of
maps. When an allow-list selects multiple fields on a list element, those
fields stay together. Use a terminal ** for the whole subtree. Empty and
dots-only paths are ignored.Proven deny-list for stable device identifiers (from production):
context.app.buildSignature, context.device.fingerprint,
context.device.identifierForVendor, context.device.hostName,
context.device.userName, context.device.computerName,
context.device.systemGUID, context.device.utsname.nodename. Add
context.network.wifi when SSID/BSSID must not leave the device.
In dev.7, sensitive key matches ignore case, whitespace, dashes and underscores
for built-in and custom keys. For example, accessToken matches
access_token. A matched key masks its whole value. The default field mask
turns abc into *** and abcd into a**d.
With enableContentBasedDetection enabled, JWTs, AWS access key IDs, bearer
strings and long token-like strings can match even under ordinary keys. The
separate card heuristic masks strings containing 13–19 digits and keeps the
last four. Package-generated event and breadcrumb timestamps keep their ISO
text unless you explicitly configure their keys as sensitive.
For a masked order number, check the digit count as well as its key. Disabling token detection still leaves card masking active. If support needs a readable identifier, collect a non-sensitive order alias and verify it with a fixture.
Extend rather than replace: DefaultSanitizer(matcher: SensitiveFieldMatcher(extraKeys: {'session_key', 'otp'}), fieldMask: MaskingStrategy(keepStart: 2, keepEnd: 2)).
RegexValueSanitizer({RegExp(r'[\w.+-]+@[\w-]+\.[\w.]+'): '<email>'}) for
aggressive global rewrites.
final e = await BugReportClient.instance.createEvent(
UnexpectedException(devMessage: 'privacy check'),
additionalContext: {'probe': {'email': '[email protected]', 'authToken': 'abcdefghijklmnopqrstuvwxyz123456', 'orderId': '1234567890123456'}},
);
debugPrint(const JsonEncoder.withIndent(' ').convert(e.toMap()));
exception.devMessage still readable; payload under the size budget.SizeBudgetSanitizer first (measures pre-mask sizes, then masking
changes them) or omitting it (unbounded payloads).context.user.email but forgetting breadcrumb data or
additionalContext carrying the same value under another key - content
heuristics can miss email addresses under other keys or embedded in prose.
Add a RegexValueSanitizer for email patterns your app collects.isSensitiveField/sensitiveFields from helpers.dart drive the
DefaultSanitizer - they are a separate public utility; the sanitizer has its
own internal key set. Extending one does not extend the other.event.context directly - sanitization only covers event.toMap(); fix the
reporter (see extend-pipeline skill)."Compliance says device identifiers and wifi info must never be reported" ->
add/extend FilterSanitizer(DenyListFilter({...device paths above..., 'context.network.wifi'})) as the FIRST sanitizer, keep the rest of the chain,
run the verification probe, and add the fixture-based unit test asserting those
paths are absent from the final payload.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub omar-hanafy/bug_handler --plugin bug-handler8 skills in this plugin
/audit-error-handlingUse when reviewing code in an app that depends on bug_handler - PR review, "check our error handling", pre-release audits, or "are we using bug_handler correctly". Finds violations of the guard contract: string errors in state, unreported catches, raw exceptions crossing repository boundaries, missing source labels, misused isReportable./diagnose-reportingUse when bug_handler reports are missing, duplicated, delayed, or unexpected - "nothing arrives in Sentry", "capture doesn't send", "errors only show sometimes", outbox files piling up in bug_report_outbox, StateError about initialization, or events arriving that should have been suppressed./Other plugins' skills for the same job