fix(security): harden untrusted web tool transcripts

This commit is contained in:
Peter Steinberger
2026-02-13 00:46:11 +01:00
parent 4543c401b4
commit da55d70fb0
13 changed files with 484 additions and 18 deletions

View File

@@ -142,10 +142,16 @@ describe("web_fetch extraction fallbacks", () => {
length?: number;
rawLength?: number;
wrappedLength?: number;
externalContent?: { untrusted?: boolean; source?: string; wrapped?: boolean };
};
expect(details.text).toContain("<<<EXTERNAL_UNTRUSTED_CONTENT>>>");
expect(details.text).toContain("Ignore previous instructions");
expect(details.externalContent).toMatchObject({
untrusted: true,
source: "web_fetch",
wrapped: true,
});
// contentType is protocol metadata, not user content - should NOT be wrapped
expect(details.contentType).toBe("text/plain");
expect(details.length).toBe(details.text?.length);