You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
agent/scripts/validate_snippet.py, when run with no path argument (its default mode, which scans agent/sandbox/), crashes with a UnicodeDecodeError if the sandbox contains any non-XML/binary file (e.g. a .png). It reads each file as UTF-8 without guarding against non-text content.
Reproduction
Place any binary file in agent/sandbox/ (e.g. a .png screenshot).
Run python3 agent/scripts/validate_snippet.py with no arguments.
Observed
File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
(0x89 is the PNG signature.)
Expected
The default scan should skip (or -- warn on) files it can't read as XML/UTF-8, and continue validating the real snippets, rather than aborting the whole run.
Only bites when agent/sandbox/ holds real working files; a clean checkout has an empty sandbox, which is why it hasn't been noticed.
Low severity, self-contained. Good candidate for a newcomer: filter the default glob to *.xml and/or wrap the read in a try/except that skips undecodable files with a warning.
Summary
agent/scripts/validate_snippet.py, when run with no path argument (its default mode, which scansagent/sandbox/), crashes with aUnicodeDecodeErrorif the sandbox contains any non-XML/binary file (e.g. a.png). It reads each file as UTF-8 without guarding against non-text content.Reproduction
agent/sandbox/(e.g. a.pngscreenshot).python3 agent/scripts/validate_snippet.pywith no arguments.Observed
(
0x89is the PNG signature.)Expected
The default scan should skip (or
--warn on) files it can't read as XML/UTF-8, and continue validating the real snippets, rather than aborting the whole run.Notes
maintoday; not introduced by any open PR (surfaced while E2E-verifying feat(scripts): validate_snippet.py accepts multiple file paths #73, whose multi-path change is unrelated and works correctly).agent/sandbox/holds real working files; a clean checkout has an empty sandbox, which is why it hasn't been noticed.*.xmland/or wrap the read in a try/except that skips undecodable files with a warning.