Skip to content

fix: cover bare llm.prompts and llm.prompt_template in content controls - #54

Merged
PabloPardoGarcia merged 1 commit into
mainfrom
pablo/rius-375-llm-prompts-content-gap
Aug 12, 2026
Merged

fix: cover bare llm.prompts and llm.prompt_template in content controls#54
PabloPardoGarcia merged 1 commit into
mainfrom
pablo/rius-375-llm-prompts-content-gap

Conversation

@PabloPardoGarcia

Copy link
Copy Markdown
Member

Closes the privacy gap from RIUS-375: CONTENT_ATTRIBUTE_PREFIXES covers the flattened forms (llm.prompts.0...), but neither bare key was in CONTENT_ATTRIBUTES, so an instrumentation setting llm.prompts or llm.prompt_template as a single attribute sailed past capture_content=False and mask — a privacy control failing open.

Changes

  • Both bare keys added to CONTENT_ATTRIBUTES (with a comment explaining why prefix coverage never covers its own bare key).
  • test_capture_content_false_covers_unflattened_prompt_keys: the behavioral regression test through the real export path.
  • test_every_content_prefix_has_its_bare_key_covered: the invariant whose silent violation caused this — every entry in CONTENT_ATTRIBUTE_PREFIXES must have its bare key in CONTENT_ATTRIBUTES. Kills the bug class, not just the instance.

Severity check (per the ticket)

Verified against the pinned bundled instrumentation rather than assuming: openinference-instrumentation-openai 0.1.52 flattens into llm.prompts.{i}.prompt.text, which the prefix already covered, so no confirmed leak from the bundled OpenAI path at current pins. However openinference-semantic-conventions defines bare LLM_PROMPTS = \"llm.prompts\" as a first-class key, the langchain/llama-index extras were not auditable in this environment, and both OpenInference and OpenLLMetry have changed flattening behavior across versions — so the fix is warranted defense-in-depth regardless.

This matches the TypeScript SDK's behavior (already fixed there under RIUS-197), removing the divergence.

Suite: 199 passed; ruff, format, mypy strict clean.

RIUS-375

The prefix entries (llm.prompts., llm.prompt_template.) only match
flattened indexed keys; an instrumentation that sets the bare attribute
carried prompts past capture_content=False and mask. Both bare keys join
CONTENT_ATTRIBUTES, and a new invariant test asserts every content
prefix's bare key is covered, so the class of gap cannot recur.
@PabloPardoGarcia
PabloPardoGarcia merged commit 82dedf7 into main Aug 12, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant