Repository navigation
fix(report): terminal and markdown output remove control characters from run values - #554
Merged
Merged
Conversation
…rom run values Values that an agent, a simulated caller, a platform's call or a results file holds reach the terminal, report --markdown and LEADERBOARD.md as text. C0, DEL and C1 controls and the bidi embedding, override and isolate controls become spaces, before anything is cut to fit, so no escape sequence, bell or reversed text gets through. sandtable's own colours are added after and stay. src/report/printable.ts holds the helpers: printable for a value on one line, printableLines for a message that keeps its own lines, and printableCopy for a run or a calibration that a renderer prints from. results.json, the HTML reports and every contract are unchanged.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes GHSA-qrx5-3qq7-7w59, which is published with 1.5.1.
What changes for users
Terminal output,
report --markdownandLEADERBOARD.mdshow control characters (C0, DEL and C1) and the bidi embedding, override and isolate controls as spaces in every value that comes from:serve's live log)initdraftedBefore, such text could write escape sequences to the terminal of whoever ran
run,serve,compare,regrade,leaderboard,review,lint,validate,init,judgeorcalibrate. Values are cleaned before anything is cut to fit, so a cut can't split a sequence.A command that sandtable suggests now quotes a word holding a control character as
$'…', so bash and zsh still read it as the same file name. sandtable's own colours,results.json, the HTML reports and every documented contract are unchanged.src/report/printable.tsholds the helpers:printable, for a value on one lineprintableLines, for a message that keeps its own linesprintableCopy, for a run that a renderer prints fromHow it was verified
npm run check: 81 files, 1307 tests.test/control-characters.test.tsand the additions totest/judge.test.tsandtest/serve-driven.test.tsfail without the fix.servewebhooks, hostile results, models and domain files, and hostile transcript names. Every output went from 1–24 control characters per stream to 0.