Area
Multiple areas
What are you trying to accomplish?
I'd like OpenCodex to help prevent credentials and personal data from being sent to an LLM provider by mistake. The protection should fit the existing proxy workflow and dashboard, without requiring another service.
I have a working branch for this and wanted to check the direction with @lidge-jun and @Ingwannu before opening a large draft PR.
What prevents this today?
OpenCodex currently forwards supported request fields to the selected provider without a built-in placeholder layer. Users can remove sensitive values manually or run a separate filtering proxy, but both approaches are easy to miss and the external proxy does not understand OpenCodex continuations, fallbacks or response streams.
What should OpenCodex do?
Add an optional in-process Guardrails feature that:
- is disabled by default;
- can cover every provider or only selected providers;
- replaces supported sensitive values with deterministic placeholders before provider I/O;
- restores values only in successful assistant prose, while tool arguments and failure responses remain masked;
- works across JSON, SSE, WebSocket and continuation paths;
- uses the existing Management API and dashboard for settings, rules, testing, import preview and metadata-only activity.
Late stream failures, premature EOF and capacity fallback should keep output masked. The feature should have no separate server, database or donor UI.
Example usage or interface
In Dashboard → Guardrails, a user enables protection and selects either all providers or an explicit provider list. The Tester accepts synthetic values before the policy is saved.
For example, with a custom rule matching demo-sensitive-value, the provider receives <CUSTOM_SECRET_1>. A successful assistant text response can show demo-sensitive-value again, but tool-call arguments and failed responses keep the placeholder.
Alternatives or workarounds
I considered a standalone filtering proxy based on cloud-ru-tech/guardrails-llm-filter. Keeping the feature inside OpenCodex avoids another process and lets the protection follow the actual routing, continuation and streaming lifecycle. Manual redaction remains useful, but it is not a reliable boundary for agent workflows.
Additional context
The working branch is based on current dev / OpenCodex 2.44.0. The initial rule assets are pinned to cloud-ru-tech/guardrails-llm-filter@bbd6f274 (v0.1.2.1) with Apache-2.0 attribution. The implementation adds re2-wasm@1.0.2, so I expect it to require explicit security review and the maintainer-sponsored label.
Local checks cover the full repository gates, 227 Guardrails backend tests, 58 dashboard tests, package/provenance verification, documentation build and isolated dashboard acceptance. I can open a draft PR against dev with the detailed receipts and screenshots if maintainers are interested in this direction.
Checks
Area
Multiple areas
What are you trying to accomplish?
I'd like OpenCodex to help prevent credentials and personal data from being sent to an LLM provider by mistake. The protection should fit the existing proxy workflow and dashboard, without requiring another service.
I have a working branch for this and wanted to check the direction with @lidge-jun and @Ingwannu before opening a large draft PR.
What prevents this today?
OpenCodex currently forwards supported request fields to the selected provider without a built-in placeholder layer. Users can remove sensitive values manually or run a separate filtering proxy, but both approaches are easy to miss and the external proxy does not understand OpenCodex continuations, fallbacks or response streams.
What should OpenCodex do?
Add an optional in-process Guardrails feature that:
Late stream failures, premature EOF and capacity fallback should keep output masked. The feature should have no separate server, database or donor UI.
Example usage or interface
In Dashboard → Guardrails, a user enables protection and selects either all providers or an explicit provider list. The Tester accepts synthetic values before the policy is saved.
For example, with a custom rule matching
demo-sensitive-value, the provider receives<CUSTOM_SECRET_1>. A successful assistant text response can showdemo-sensitive-valueagain, but tool-call arguments and failed responses keep the placeholder.Alternatives or workarounds
I considered a standalone filtering proxy based on
cloud-ru-tech/guardrails-llm-filter. Keeping the feature inside OpenCodex avoids another process and lets the protection follow the actual routing, continuation and streaming lifecycle. Manual redaction remains useful, but it is not a reliable boundary for agent workflows.Additional context
The working branch is based on current
dev/ OpenCodex 2.44.0. The initial rule assets are pinned tocloud-ru-tech/guardrails-llm-filter@bbd6f274(v0.1.2.1) with Apache-2.0 attribution. The implementation addsre2-wasm@1.0.2, so I expect it to require explicit security review and themaintainer-sponsoredlabel.Local checks cover the full repository gates, 227 Guardrails backend tests, 58 dashboard tests, package/provenance verification, documentation build and isolated dashboard acceptance. I can open a draft PR against
devwith the detailed receipts and screenshots if maintainers are interested in this direction.Checks