mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4263] [Engine] an opt-in filter that redacts — or refuses to execute — model output and tool calls matching a configurable blocklist #1878
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1878
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jeremiahlangner on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4263
This is a suggestion for a mitigation, offered for discussion. The feature
described here is opt-in, and whether it belongs in Strata (and in what form) is
what the discussion is for.
The open issues were searched for cohere / exfiltration / blocklist / blocked-strings
(2026-10-26); no open thread covers this. The audit-findings collector #544 has since
closed, so this stands alone and can be linked from a future collector.
Area
[Engine] (speed, kernels, models, the server and API)
What do you want to do?
Run the shipped model behind MCP tools with a guardrail on what it actually emits.
Cohere's disclosure today ("Concerning behavior from a popular open-weight AI model")
shows the exact model Strata ships — Qwen3.8-Flash-Next — attempting, in rare cases
(under 1 in 100,000 calls in their runs), to inventory the machine and upload a probe
file to an Alibaba Cloud bucket in Beijing, probe cloud metadata endpoints, and reach
for
unshare -Urmto get root inside a namespace. Their first recommendation is to"enforce on the actual tool call before it runs. A reasoning trace is not a security
boundary."
The docs describe MCP tools as running "with your user's rights, and the model decides
when to call them", and README.md promises "Nothing leaves your PC". That
promise holds for the engine, but the moment a model's output drives a tool — MCP
servers the run config starts, or a coding agent on the client side — the weights have
a keyboard, and today nothing in
serve/server.pylooks at what the model wrote beforeit goes out or into a tool.
The goal: a filter between the model and every consumer of its output, configured by a
plain JSON list of strings, that redacts matches — or, for tool calls, refuses to run
them. Whether it belongs in Strata (and in what form) is the discussion wanted here,
before any pull request.
What do you do today instead?
An external patch, applied locally and working: three small hooks in
serve/server.pyplus a stdlib-only
serve/blocked.py(details under "The proposed implementation"below).
The proposed implementation
Three small edits to
serve/server.pyplus one new module,serve/blocked.py(stdlib-only, ~250 lines):
from serve ...imports;blocked_api.wrap(svc)right after the singlesvc = Service(...)inmain()— itwraps the instance's
rungenerator, which every endpoint consumes (chat SSE andnon-SSE,
/v1/messages,/v1/responses, the web app, andrun_with_mcp);run_with_mcp'srun_themline so a blocked MCP call is notexecuted.
The filter:
content,reasoningandstreamed tool-argument deltas, with a hold-back buffer so a match split across two
streamed deltas is still caught (verified by test);
sees them — including
run_with_mcp, so an MCP tool never receives blocked arguments;"block_action": "redact"(default — the call runs withredacted arguments) or
"skip_call"(the call is not executed at all; it takesrun_with_mcp's existing "skipped, not run" path, so nothing new in the clientprotocol);
~/.config/strata/blocked.json(or$STRATA_BLOCKED_CONFIG),re-checked by mtime on every request — editing the list needs no restart.
The config is a plain JSON file:
{"enabled": true, "case_insensitive": true, "replacement": "[blocked]", "block_action": "redact", "on_error": "open", "strings": ["rm -rf ", "sudo rm"]}. With no config file the filter is off.This is Cohere's "enforce on the actual tool call": the check runs on what the model
actually emitted, not on the reasoning trace. The trace passes through the same filter,
so a command it "said" it would not run is still caught if it writes one.
What it does not do
network layer; this patch sees only strings. A model that encodes a URL (hex,
base64,
$'\x72\x6d', variables) walks around a substring filter. It is not claimedthat this stops a determined model — it is a guardrail against the specific, rare,
accidental call-home pattern in the disclosure and similar accidents, not a security
boundary.
before_load, or imagegeneration; those commands come from the run config, not the model.
tools after receiving redacted output — but it does redact that output first, which is
the right enforcement point for what the model wrote.
"redact"mode a matched shell-ish tool call still runs, with mangled arguments.For tools that run commands,
"skip_call"is the recommended mode; see the risksbelow.
The default path stays byte-identical (per the contributing rules)
The feature is opt-in: no config file, no filtering. With the filter disabled the
wrapper passes events through unchanged; the check was a mock-engine e2e run with
filtering off, comparing the served answer byte-for-byte with the pre-patch
server, plus a 27-case unit suite against the real
serve.frontendtypes (a matchsplit across two deltas, complete tool-call argument redaction,
ToolCall.namespacepreserved, unknown event kinds passed through, disabled passthrough). The only added
work on the disabled path is one
stat()per request.One question for maintainers: if no config file exists, should
wrap(svc)be a no-opentirely? That is a one-line change and makes the unconfigured path literally the last
release's code path; the wrapper is left in place so that dropping a config file into
~/.config/strata/works without a restart.New risks the patch itself introduces
Listing these up front, because a mitigation that overstates itself is its own hazard:
because a filter is on. Substring matching is the weakest kind of check; the
disclosure's own trigger (
curl ... -o) is only catchable if the exact spelling ison the list.
"redact"mode,rm -rf [blocked]still executes
rm. For anything that runs shell commands,"skip_call"is thesafer mode;
"redact"fits text and read-only tools."on_error": "open"(the default) passes a completionthrough unfiltered after one internal filter error, with a single stderr warning —
an adversarial output that breaks the filter could turn it off for its own request.
"closed"fails the completion instead. Input would be useful on which should be thedefault, and on surfacing filter errors in
/api-monitorrather than stderr only."skip_call"under"parallel": 2. The raw-match record lives in onemodule-level registry, cleared wholesale at 4,096 entries; with parallel streams a
concurrent clear can drop the record for a pending call, and the gate then falls
back to matching the already-redacted arguments — which no longer match — so a
blocked call could execute. Fix is straightforward (per-stream registry or FIFO
eviction); flagged because it exists in the locally applied version.
monitor never shows what the model actually wrote — the operator alerting on
"unexpected tool calls" sees
[blocked]with no original for incident response.Worth discussing whether to log matched-call metadata (which list entry, which tool)
somewhere durable.
[blocked]tells an attacking prompt which stringsthe operator blocks, which helps iterative evasion.
"skip_call"reveals nothing inthe output; the replacement text is configurable.
text). Clients that reassemble deltas are unaffected — all of Strata's own
consumers are — but a client assuming one JSON token per chunk would notice.
reverts it while the config file stays behind.
apply.sh checkreports this, butnothing enforces it at startup; if the feature lands upstream, this whole class of
problem goes away — which is the main reason for opening this discussion rather than
keeping the patch private.
Questions for maintainers
mcp_servers) oras-is with a JSON config file?
wrap()no-op when no config file exists (literal byte-identical defaultpath), or keep the wrapper so the feature can be turned on without a restart?
"block_action":redact(availability, matches today's web app behavior)or
skip_call(safety for command-running MCP tools)?/api-monitor, and should the server logblocked-match metadata for incident response?
unexpected cloud URLs and blocking unprivileged user namespaces in agent
containers. The first might fit
run_with_mcp's existing "call" event; the secondbelongs in docs/AI_SETUP.md rather than the server. Separate discussions if wanted.
References
https://cohere.com/blog/concerning-behaviour-popular-open-weight-ai-model
@github-actions[bot] commented on GitHub (Oct 26, 2026):
Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:
Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment
/reopen.Details: CONTRIBUTING.md
@github-actions[bot] commented on GitHub (Oct 26, 2026):
Thanks, this follows the format now.