Overview
OpenSRE can mask sensitive infrastructure identifiers (pod names, cluster names, hostnames, account IDs, service names, IP addresses, emails) before sending text to an external LLM, then restore the originals in user-facing output (Slack report, problem MD, and similar). Teams can use external models while keeping raw identifiers inside the investigation runtime. Masking is off by default. Turn it on with environment variables — no code changes required.How it works
- When masking is enabled, call sites that send text to an external model
replace identifiers with stable placeholders such as
<POD_0>,<NAMESPACE_0>, or<CLUSTER_1>. The placeholder → original map can be stored in investigation state asmasking_map. - The model sees masked text, so raw identifiers are not sent in that payload.
- Where a map is present, OpenSRE restores real identifiers in downstream state and display output.
- Report delivery (for example Slack) can run a final unmask pass before sending, as defence in depth.
<POD_0> stays consistent.
Today, masking is applied at opt-in edges (for example selected GitHub / Sentry
fix tools and CLI agent-exec paths) rather than as a single central step on
every investigation. Reporting still unmasks when a map is present. Env policy
is read when masking runs — changes apply on the next run without a restart.
Environment variables
Built-in identifier kinds
Round-trip guarantee
For the built-in detectors and extra regex patterns,mask → unmask restores
the original payload byte-for-byte. See
tests/masking/test_integration_with_k8s_fixture.py for a worked example against
a realistic Datadog Kubernetes alert.
Relationship to guardrails
Masking is complementary to the one-wayGuardrailEvaluator. Guardrails handle
hard-block rules (credit cards, API keys) and replace matches with [REDACTED]
irreversibly. Masking handles infrastructure identifiers reversibly so they can
be restored for user-facing output.
Both can be active together: guardrails apply at the LLM client layer;
masking applies at the call sites that opt in.