Skip to content

feat(pii): optionally block content the detectors cannot inspect - #12755

Merged
mudler merged 1 commit into
mudler:masterfrom
walcz-de:feat/pii-block-unscanned-media
Oct 18, 2026
Merged

mudler merged 1 commit into
mudler:masterfrom
walcz-de:feat/pii-block-unscanned-media

Conversation

@walcz-de

Copy link
Copy Markdown
Contributor

Description

The PII middleware scans the text of every message, but images, audio, video and files reach the backend unchecked. For an egress policy on cloud-proxy models ("nothing sensitive leaves the box") that is a gap: a photographed invoice or an attached PDF goes to the provider without any check.

This adds pii.block_unscanned_media. While PII is enabled for a model and the option is set, a request carrying such content is rejected with the usual 400 pii_blocked response and an audit event (pattern __unscanned_media__) before any detector runs. Adapters report unscanned content through a new optional Adapter.Unscanned:

  • OpenAI chat: non-text content blocks (image_url, input_audio, file, …)
  • Anthropic messages: image and document blocks (tool blocks stay allowed)
  • Ollama chat: images

Off by default; existing configurations behave as before. The option is also exposed in the model editor (config meta registry).

Notes for Reviewers

  • Middleware specs: blocks and records an event; blocks without detectors; text-only passes; option off passes; PII disabled passes. Adapter specs for all three shapes with text-only negatives. A mutation (block disabled) turns the middleware specs red.
  • If feat(pii): apply PII middleware to the Open Responses API #12708 (PII on /v1/responses) lands, a follow-up commit there reports input_image/input_file/input_audio the same way (already pushed to that branch, it carries this commit as its base).
  • Not run: golangci-lint, e2e suites.

Signed commits

  • Yes, I signed my commits.
  • Documentation updated (docs/content/) for user-facing changes, or not applicable

The PII middleware scans the text of every message, but images, audio,
video and files pass to the backend unchecked. For an egress policy
("nothing sensitive leaves the box") that is a hole: a photographed
invoice or an attached PDF reaches a cloud-proxy model without any check.

Add pii.block_unscanned_media. While PII is enabled for a model and the
option is set, a request that carries such content is rejected with the
usual 400 pii_blocked response and an audit event with pattern
__unscanned_media__, before any detector runs. Adapters report the
kinds of unscanned content through a new optional Adapter.Unscanned:
OpenAI chat (non-text content blocks), Anthropic messages (image and
document blocks; tool blocks stay allowed) and Ollama chat (images).

Off by default, so existing configurations behave as before.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Stefan Walcz <stefan.walcz@walcz.de>
@mudler
mudler merged commit f4505db into mudler:master Oct 18, 2026
1 check passed
@mudler-agent mudler-agent added the enhancement New feature or request label Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants