Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions prismor/runtime/policy_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1104,12 +1104,19 @@ def evaluate(
# If this event produced any prompt_injection findings, persist that
# fact so subsequent network events can be escalated regardless of
# their destination.
taint = self._get_taint(session_id)
if taint is not None and any(
# Test the cheap condition first: _get_taint() reads the session's
# taint file from disk, so loading it unconditionally paid a file read
# on every event, while only events carrying a prompt-injection finding
# ever mark. Left None otherwise — the network block below lazily loads
# it on its own when it needs it.
taint = None
if any(
f.get("category") in ("prompt_injection", "prompt_injection_semantic")
for f in findings
):
taint.mark_injection(index)
taint = self._get_taint(session_id)
if taint is not None:
taint.mark_injection(index)

# ── Network event: cloaking-secret check + taint escalation ───────
if event_type == "network":
Expand Down