Repository navigation
Quote the text an error repeats from a file, a key or a plugin - #146
Merged
Merged
Conversation
From the 2026-11-30 review (S4). Error messages repeated a header line, an armor line, an SSH key type, BouncyCastle's account of a key file, a plugin's malformed line, its error message and its stderr exactly as they came. A caller that printed the message to a terminal printed the sender's escape sequences, and a megabyte-long line made a megabyte-long message. UntrustedText writes out what cannot be seen (control characters, direction overrides, zero-width characters) and cuts what is long, as go-age's %q does the first. A value is set in quotes; a plugin's or BouncyCastle's own sentence is escaped without them. Letters of any script are kept, since a plugin's error may be in any language. A byte in an armor body that is not base64 is now named by its value, as the header names one. NoIdentityMatchException's message shows at most eight stanza types of 32 characters; StanzaTypes holds them whole. Text a plugin asks to have displayed still reaches IPluginCallbacks as sent, as in go-age's client; the interface now says so, and what a host should do before writing it to a terminal.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #146 +/- ##
=======================================
Coverage 97.54% 97.54%
=======================================
Files 75 76 +1
Lines 5001 5044 +43
Branches 688 695 +7
=======================================
+ Hits 4878 4920 +42
Misses 76 76
- Partials 47 48 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Finding S4 of the 2026-11-30 review. 15 of the 22 new tests failed before the change.
The problem
Error messages repeated untrusted text exactly as it came: a header line, an armor line, an SSH key type, BouncyCastle's account of a key file, a plugin's malformed line, its error message and its stderr. A caller that printed
ex.Messageto a terminal printed the sender's escape sequences, and a megabyte-long line made a megabyte-long message.The change
UntrustedText(new, internal) writes out what cannot be seen and cuts what is long, as go-age does the first with%q.unexpected line in header: "\x1b[2J\x1b]0;owned\x07 hello".Used for: the header's version line, an unexpected line, the MAC line, a stanza's opening line, the armor's begin line, a scrypt work factor, the SSH key type on a recipient line, BouncyCastle's message about a key, and in the plugin client a line that is no stanza, a file index, a confirm label, the plugin's error message and each line of its stderr.
Behaviour beyond the quoting
0xE9), as the header names one; it was'?'. One existing test asserted the old text and is changed.NoIdentityMatchException.Messageshows at most eight stanza types of 32 characters each.StanzaTypesholds them whole.IPluginCallbacksas sent, as in go-age's client. The interface's documentation now says so, and that a host should replace control characters before writing it to a terminal, as go-age's terminal UI does.Noted in
TODO.mdfor the next release notes.Checked
dotnet testanddotnet test -c Release -p:ForcePortableAead=true -p:TreatWarningsAsErrors=true: 1,176 vectors and 1,658 unit tests pass.Age.Fuzz, all ten targets for 30 s: no findings.