Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Content Sanitization

Before any content is included in GitHub issues (via ACP escalation), the sanitize_issue_content() function automatically redacts secrets and strips prompt injection markers.

Secret Patterns

The following patterns are detected and replaced with [REDACTED_*] tags:

PatternExampleReplacement
Anthropic API keyssk-ant-api03-...[REDACTED_ANTHROPIC_KEY]
OpenAI keyssk-proj-..., sk-...[REDACTED_OPENAI_KEY]
GitHub PATghp_...[REDACTED_GH_PAT]
GitHub OAuthgho_...[REDACTED_GH_OAUTH]
GitHub Appghs_...[REDACTED_GH_APP]
GitHub Refreshghr_...[REDACTED_GH_REFRESH]
AWS Access KeyAKIA... (20 chars)[REDACTED_AWS_KEY]
Bearer tokensBearer <token>Bearer [REDACTED_BEARER]
Generic secretsapi_key=, token=, password=, secret=[REDACTED]

Pattern order matters: specific patterns (e.g., sk-ant-) are matched before generic ones (e.g., sk-) to ensure correct replacement labels.

Prompt Injection Markers

The following injection patterns are replaced with [SANITIZED]:

  • LLM role markers: <|system|>, <|user|>, <|assistant|>, [INST], <<SYS>>
  • Override attempts: IGNORE PREVIOUS INSTRUCTIONS, SYSTEM OVERRIDE:, ADMIN MODE:
  • Known bypass patterns: JAILBREAK, DAN MODE, DEVELOPER MODE:

All matching is case-insensitive.

Usage

from gaius.acp.security import sanitize_issue_content

raw = "Error with key sk-ant-api03-abc123... calling endpoint"
safe = sanitize_issue_content(raw)
# "Error with key [REDACTED_ANTHROPIC_KEY] calling endpoint"

Issue Title Validation

Issue titles are validated separately via validate_issue_title():

  • Must start with [HEALTH-FIX] prefix
  • Truncated to 200 characters
  • Control characters stripped

Source

src/gaius/acp/security.py (the sanitize_issue_content and validate_issue_title functions).