Fix formatting (#22474)
This commit is contained in:
@@ -269,7 +269,9 @@ describe("web_search external content wrapping", () => {
|
||||
results?: Array<{ description?: string }>;
|
||||
};
|
||||
|
||||
expect(details.results?.[0]?.description).toMatch(/<<<EXTERNAL_UNTRUSTED_CONTENT id="[a-f0-9]{16}">>>/);
|
||||
expect(details.results?.[0]?.description).toMatch(
|
||||
/<<<EXTERNAL_UNTRUSTED_CONTENT id="[a-f0-9]{16}">>>/,
|
||||
);
|
||||
expect(details.results?.[0]?.description).toContain("Ignore previous instructions");
|
||||
expect(details.externalContent).toMatchObject({
|
||||
untrusted: true,
|
||||
|
||||
@@ -148,8 +148,14 @@ function replaceMarkers(content: string): string {
|
||||
const replacements: Array<{ start: number; end: number; value: string }> = [];
|
||||
// Match markers with or without id attribute (handles both legacy and spoofed markers)
|
||||
const patterns: Array<{ regex: RegExp; value: string }> = [
|
||||
{ regex: /<<<EXTERNAL_UNTRUSTED_CONTENT(?:\s+id="[^"]{1,128}")?\s*>>>/gi, value: "[[MARKER_SANITIZED]]" },
|
||||
{ regex: /<<<END_EXTERNAL_UNTRUSTED_CONTENT(?:\s+id="[^"]{1,128}")?\s*>>>/gi, value: "[[END_MARKER_SANITIZED]]" },
|
||||
{
|
||||
regex: /<<<EXTERNAL_UNTRUSTED_CONTENT(?:\s+id="[^"]{1,128}")?\s*>>>/gi,
|
||||
value: "[[MARKER_SANITIZED]]",
|
||||
},
|
||||
{
|
||||
regex: /<<<END_EXTERNAL_UNTRUSTED_CONTENT(?:\s+id="[^"]{1,128}")?\s*>>>/gi,
|
||||
value: "[[END_MARKER_SANITIZED]]",
|
||||
},
|
||||
];
|
||||
|
||||
for (const pattern of patterns) {
|
||||
|
||||
Reference in New Issue
Block a user