Skip to content

test(ioscan): red-team the injection path and publish the miss rate - #6709

Merged
clubanderson merged 1 commit into
hivecommons:v4from
Danathar:test/ioscan-injection-measurement-6685
Sep 11, 2026
Merged

clubanderson merged 1 commit into
hivecommons:v4from
Danathar:test/ioscan-injection-measurement-6685

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

The question, and the measured answer

TAG-Security asked on the ioscan section (cncf/toc#2286): "have you red teamed to know how well this works? Is this perfect defense, works decently well, a partial mitigation, etc.?"

The answer was no. pkg/ioscan has 56 unit tests, but they assert that known shapes are caught — by construction every one passes, and they cannot produce a detection rate.

Measured now, 43 adversarial payloads through the production entry point (ioscan.ScanInput, shipped defaults):

outcome n share
blocked (withheld from the agent) 16 37%
detected, but injected anyway 8 19%
missed entirely 19 44%
reached the agent verbatim 27 63%

Detection is very uneven by family — unicode 6/8 blocked, smuggling 4/7, direct-override 2/10, split-payload 0/4 — and 2 of 6 benign controls were redacted, including an issue reporting a prompt-injection bug.

Three findings worth more than the headline

1. The middle bucket is not obvious. blockedInput requires Critical, or Injection at High+, so every Medium finding is recorded for audit and the raw text is still injected. injection.role_override, pretend_act_as, reveal_prompt, developer_system_mode and three of seven dangerous.* rules all land there. "ioscan findings" is not "attacks stopped", and nothing said so before.

2. Split payloads score 0% structurally, not for want of a rule. Each untrusted segment (title, body, each comment) is scanned separately, so a phrase split across two comments is never a single string for any rule to match. No rule change fixes that family.

3. Two single characters defeat the strongest family. U+FF29 fullwidth I and U+00AD soft hyphen produce zero findings — not "detected but not blocked". Unicode is the one family where the design beats a regex (hidden characters are themselves a High finding that blocks on their own), and one character bypasses it. Filed as #6708, with the U08 fix verified to be a one-character addition to isInvisibleControl.

Item 3 is measured, not claimed

The issue asks whether the network layer still contains what gets through. TestRedTeamContainmentHoldsForEveryMode checks POST /pulls and PUT /pulls/{n}/merge against all four ACMM modes on every run — 8 combinations, all denied.

That is the real finding, and the document says it plainly: the injection defense of record is the proxy deny rule, not the text scanner. ioscan reduces how often an agent is exposed; the proxy is what stops an exposed agent from doing the thing that matters.

The corpus is a ratchet, not a snapshot

TestRedTeamCorpusOutcomesAreStable pins each observed outcome and fails in both directions — a regression, and equally an improvement, because an improvement makes the published miss rate wrong. I verified both branches rather than assuming them:

# disabled injection.ignore_previous
D01 (direct-override/canonical ignore-previous) was blocked and is now MISSED — detection REGRESSED.

# added U+00AD to isInvisibleControl
U08 (unicode/soft hyphen) is published as a MISS but is now blocked.
Detection improved — that is good, and it means the measured miss rate in
src/docs/ioscan-red-team.md is now wrong. Re-run TestRedTeamCorpusReport and republish.

So the document's numbers cannot silently drift from the code, and #6708's fix will correctly fail this test until the tables are republished.

A case recorded as missed is a published miss. None of the 19 misses were removed or reworded until they passed — that was the point.

What I did not measure, and said so

  • The optional LLM classifier. Default-off (TestIoscanClassifierConfig_DefaultOff), and measuring it needs a live endpoint and would yield a number specific to one model at one moment. Deliberately absent rather than estimated. It also fails open, so the deterministic floor measured here is the worst case either way.
  • The output path and the canary/egress path — the latter has a known weakness already filed as 🐛 ioscan canary egress check is not encoding-aware — base64 defeats leak detection #6686.

Estimating any of these would have reproduced exactly the problem this issue exists to fix.

Files

  • src/pkg/ioscan/redteam_test.go — corpus + harness + containment check + report generator.
  • src/docs/ioscan-red-team.md — methodology, per-family and per-case results, miss analysis, containment, limits.
  • src/docs/security-self-assessment.md — the "unmeasured" paragraph and the review-response row now cite measured results.
  • src/docs/README.md — index entry.

Verified: go test ./pkg/ioscan/ ./pkg/config/ ./pkg/proxy/ green, go vet clean, gofmt clean, check-docs-links.py src/docs — 150 files, all links and anchors resolve.

Fixes #6685

— hive: backend=claude model=claude-opus-5

CNCF TAG-Security asked, on the ioscan section of the self-assessment
(cncf/toc#2286): "have you red teamed to know how well this works? Is
this perfect defense, works decently well, a partial mitigation, etc.?"

The honest answer was no. pkg/ioscan has 56 unit tests, but they assert
that KNOWN shapes are caught — by construction every one passes, and they
cannot produce a detection rate. The self-assessment recorded efficacy as
"unmeasured" and committed to measuring it.

Measured now, against 43 adversarial payloads through the production
entry point (ioscan.ScanInput, shipped defaults):

  blocked (withheld from the agent)     16   37%
  detected but injected anyway           8   19%
  missed entirely                       19   44%
  ------------------------------------------------
  reached the agent verbatim            27   63%

Per family, detection is very uneven: unicode 6/8 blocked, smuggling 4/7,
direct-override 2/10, split-payload 0/4. Plus 2 of 6 benign controls were
redacted — including an issue *reporting* a prompt-injection bug.

Three findings worth more than the headline number:

  - The middle bucket is not obvious. blockedInput requires Critical, or
    Injection at High+, so every Medium finding is recorded for audit and
    the raw text is still injected. "ioscan findings" is not "attacks
    stopped", and nothing said so before.
  - Split payloads score 0% structurally, not for want of a rule. Each
    untrusted segment is scanned separately, so a phrase split across two
    comments is never a single string to match.
  - Two single characters (U+FF29 fullwidth I, U+00AD soft hyphen) defeat
    the STRONGEST family outright. Filed as hivecommons#6708; the U08 fix is verified
    to be a one-character addition to isInvisibleControl.

Item 3 of the issue — does the network layer still contain what gets
through — is measured rather than claimed:
TestRedTeamContainmentHoldsForEveryMode checks POST /pulls and
PUT /pulls/{n}/merge against all four ACMM modes on every run. That is
the real finding: the injection defense of record is the proxy deny rule,
not the text scanner.

The corpus is a RATCHET, not a snapshot. TestRedTeamCorpusOutcomesAreStable
pins each observed outcome and fails in BOTH directions — a regression,
and equally an improvement, because an improvement makes the published
miss rate wrong. Both branches were verified by deliberately breaking and
deliberately improving a rule; the improvement path prints "re-run the
report and republish". So the document's numbers cannot silently drift
from the code.

Not measured, and said so in the document rather than estimated: the
optional LLM classifier (default-off, and fails open, so the
deterministic floor here is the worst case either way), the output path,
and the canary egress path (hivecommons#6686).

Fixes hivecommons#6685

Signed-off-by: Danathar <Danathar@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 11, 2026
@clubanderson

Copy link
Copy Markdown
Member

/approve

@clubanderson
clubanderson merged commit 51987c4 into hivecommons:v4 Sep 11, 2026
43 of 46 checks passed
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clubanderson

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 11, 2026
clubanderson added a commit that referenced this pull request Sep 11, 2026
…6728)

#6709 pinned the measured corpus outcomes; #6714 then closed the two
Unicode gaps the report identified. Merged independently, each green,
together they trip the stability ratchet: U05 and U08 now score blocked.
Update the pinned expectations and republish the document — the unicode
family is 8/8, overall misses 19->17 (44%%->40%%).

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🌱 Red-team ioscan: measure prompt-injection detection instead of asserting it

2 participants