You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ScanCache.should_advance_prefix() returns True for Action.REDACT (when advance_prefix_on_redact=True, the default) and unconditionally for Action.REVIEW. A safe-prefix entry is documented and modeled as a verified-clean prefix (SafePrefixState docstring: "Verified-clean prefix"), but REDACT and REVIEW are non-ALLOW findings.
When the safe prefix advances after REDACT or REVIEW, a later append-only scan of the same document_id can scan only the tail/overlap window and return ALLOW, omitting the earlier flagged content from the resulting findings and redacted output.
Affected version/commit
unplug-ai==0.6.0 (PyPI latest)
dev branch at commit 7a8be76
Python 3.14.2, Windows 11
Violated invariant
A safe-prefix cache entry may be created only after Action.ALLOW.
SafePrefixState is described as "Verified-clean prefix" but is populated after REDACT/REVIEW results.
Issue #82 / PR #87 fixed a different bypass: injection patterns split across the cache boundary. That fix added a 256-character overlap and source/policy-scoped keys. This issue is about non-ALLOW results being treated as verified-clean prefixes, which is orthogonal to the boundary-overlap fix.
Acceptance criteria
Only Action.ALLOW can advance the safe prefix
REDACT, REVIEW, BLOCK, and ABSTAIN do not create/update safe-prefix state
An append after REDACT/REVIEW full-scans (or matches the cache-disabled verdict)
Description
ScanCache.should_advance_prefix()returnsTrueforAction.REDACT(whenadvance_prefix_on_redact=True, the default) and unconditionally forAction.REVIEW. A safe-prefix entry is documented and modeled as a verified-clean prefix (SafePrefixStatedocstring: "Verified-clean prefix"), but REDACT and REVIEW are non-ALLOW findings.When the safe prefix advances after REDACT or REVIEW, a later append-only scan of the same
document_idcan scan only the tail/overlap window and returnALLOW, omitting the earlier flagged content from the resulting findings and redacted output.Affected version/commit
unplug-ai==0.6.0(PyPI latest)devbranch at commit7a8be76Violated invariant
SafePrefixStateis described as "Verified-clean prefix" but is populated after REDACT/REVIEW results.Minimal reproduction
Unit-level (
should_advance_prefix):Cache-flow regression (Guard-level, using a controlled fake pipeline stub that returns REDACT):
part1→ REDACT result → safe prefix recorded for entire documentdocument_idResult: Cached scan returns
ALLOW, non-cached scan returnsREDACT.Expected vs actual behavior
should_advance_prefixTrueTrueFalseFalseFalseTrue(whenadvance_on_redact=True)FalseTrue(always)FalseFalseScope/impact
True)document_idacross scans (append-only pattern)Distinction from #82/#87
Issue #82 / PR #87 fixed a different bypass: injection patterns split across the cache boundary. That fix added a 256-character overlap and source/policy-scoped keys. This issue is about non-ALLOW results being treated as verified-clean prefixes, which is orthogonal to the boundary-overlap fix.
Acceptance criteria
Action.ALLOWcan advance the safe prefixRelated
sdk/src/unplug/core/runtime/cache.py—should_advance_prefix()(line 146)sdk/src/unplug/guard.py—_run_input_with_cache()(line 596)sdk/src/unplug/config/cache.py—CacheConfig.advance_prefix_on_redact(line 18)