Skip to content
Draft
Show file tree
Hide file tree
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
23 changes: 23 additions & 0 deletions plugins/promptfoo/src/parsers/burp-entities.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { describe, expect, it } from 'vitest';

import { parseBurpSingle } from './burp.js';

describe('parseBurpSingle XML entity decoding', () => {
it('decodes ampersands after other entities', () => {
const parsed = parseBurpSingle(`
<items>
<item>
<url>https://example.com/search?note=&amp;quot;</url>
<host>example.com</host>
<port>443</port>
<protocol>https</protocol>
<method>GET</method>
<path>/search?note=&amp;quot;</path>
<request></request>
</item>
</items>
`);

expect(parsed.raw).toContain('note=&quot;');
});
});
4 changes: 2 additions & 2 deletions plugins/promptfoo/src/parsers/burp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ function decodeXmlEntities(str: string): string {
return str
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&amp;/g, '&')
.replace(/&quot;/g, '"')
.replace(/&apos;/g, "'");
.replace(/&apos;/g, "'")
.replace(/&amp;/g, '&');
}

/**
Expand Down
Loading