Skip to content
Merged
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
16 changes: 16 additions & 0 deletions packages/engine/src/core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ describe('filterFiles', () => {
expect(result.excluded).toEqual([{ path: 'bun.lock', reason: 'ignored by default' }]);
});

test('reviews SVG markup but ignores raster images', () => {
const assets = parseUnifiedDiff(`diff --git a/static/logo.svg b/static/logo.svg
new file mode 100644
--- /dev/null
+++ b/static/logo.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" onload="alert(1)"></svg>
diff --git a/static/logo.png b/static/logo.png
new file mode 100644
Binary files /dev/null and b/static/logo.png differ
`);
const result = filterFiles(assets);
expect(result.included.map((f) => f.path)).toEqual(['static/logo.svg']);
expect(result.excluded.map((f) => f.path)).toEqual(['static/logo.png']);
});

test('supports allowlists and exclusions', () => {
expect(filterFiles(files, ['!src/**']).included).toHaveLength(0);
expect(filterFiles(files, ['bun.lock']).included.map((f) => f.path)).toEqual(['bun.lock']);
Expand Down
4 changes: 2 additions & 2 deletions packages/engine/src/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export function generatedMatcher(globs: string[] = []): (path: string) => boolea
/**
* Files that are almost never worth an LLM's attention. Build output, vendored code, minified
* bundles, and media stay ignored even with a sandbox: there is nothing to run that checks them
* which the review of their sources does not already cover.
* which the review of their sources does not already cover. SVG is not on the list: it is markup
* that can carry scripts, event handlers and external references, so it is reviewed like code.
*/
export const defaultIgnoreGlobs = [
...sandboxCheckedGlobs,
Expand All @@ -65,7 +66,6 @@ export const defaultIgnoreGlobs = [
'**/build/**',
'**/vendor/**',
'**/node_modules/**',
'**/*.svg',
'**/*.png',
'**/*.jpg',
'**/*.gif',
Expand Down