Commit 5bdb456
fix: skip empty untrusted-content sources in audit aggregation
Self-review follow-up. When unwrapUntrusted/untrustedSource (singular, with an
`src != ""` call-site guard) were replaced by untrustedSourcesAll, the
empty-source filter was dropped. A wrapper with source="" (reachable when a
wrapUntrusted caller passes an empty source, e.g. a browser snapshot with an
empty URL) then entered untrustedSources. In the audit divergence check,
isSource() does strings.HasPrefix(resource, ""), which is always true, so a
single empty-source blob marked every resource as a "source", emptied
untrustedResSet, and silently suppressed reused-resource injection detection
for the whole turn — defeating the multi-blob hardening the change introduced.
Restore the empty-source skip in untrustedSourcesAll and add a regression test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 56be5d3 commit 5bdb456
2 files changed
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
223 | 230 | | |
224 | 231 | | |
225 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
0 commit comments