Repository navigation
Conversation
timweri
force-pushed
the
fix/allowed-signer-write
branch
from
November 10, 2026 01:20
bff1450 to
526cef3
Compare
timweri
force-pushed
the
fix/allowed-signer-write
branch
from
November 10, 2026 01:25
526cef3 to
4a76ab5
Compare
Replace AllowedSignerSplitter with a parser that follows OpenSSH's parse_principals_key_and_options() and sshsigopt_parse() in sshsig.c. Options are one comma-separated field with double-quoted values, as OpenSSH requires. Space-separated options and unquoted values, which OpenSSH rejects, are now rejected too. Like OpenSSH 10.2, option names and the timestamp suffix (Z or UTC) are case-insensitive, valid-after and valid-before must be after the epoch, and any text after the key is a comment. BREAKING CHANGE: lines with space-separated options or unquoted values no longer parse, including lines written by the old Display. AllowedSignerParsingError::UnexpectedEnd and InvalidTimestamp are removed.
Display wrote space-separated options with unquoted values and raw UNIX timestamps, which OpenSSH rejects. Replace it with AllowedSigner::to_line(), which writes one comma-separated options field with quoted values, timestamps as YYYYMMDDHHMMSSZ and the plain key type, and quotes the principals when needed. to_line() fails when OpenSSH would read a field back differently, such as a comma inside a principal or a timestamp that isn't after the epoch. It also fails for a certificate key, which PublicKey can't encode. The key's comment is left out. from_string() ignores it, and a line break in it would add another entry to the file. DateTime::from_timestamp() needs chrono 0.4.31. BREAKING CHANGE: AllowedSigner no longer implements Display; use to_line().
from_string() accepted a few entries that to_line() can't write, so to_line() failed on them. Reject them when parsing instead: - a line feed or NUL in a principal or namespace. OpenSSH would read a line feed as the start of a new entry, and reads a line as a C string. - a certificate as the key. PublicKey reads the wrong bytes as the key. Mark AllowedSignerParsingError as #[non_exhaustive], so fixes like these can add a variant without another breaking change. Add a test that checks lines written by to_line() with ssh-keygen -Y verify. It's skipped when ssh-keygen isn't installed. BREAKING CHANGE: from_string() rejects certificate keys, and line feeds or NULs in principals and namespaces. AllowedSignerParsingError is now #[non_exhaustive].
timweri
force-pushed
the
fix/allowed-signer-write
branch
from
November 10, 2026 03:38
4a76ab5 to
ceaf028
Compare
This branch has not been deployed
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.
Flagged by Opus 5.5.
Displaywrote space-separated options, unquoted values and raw UNIX timestamps, which OpenSSH rejects. It also copied the key comment, so a comment with a newline added another trusted entry.This replaces it with
AllowedSigner::to_line(), which writes what OpenSSH reads and fails on entries it can't write.from_stringnow rejects whatto_linecan't write back: a line feed or NUL in a principal or namespace, and certificate keys.Stacked on #54.
BREAKING CHANGE:
AllowedSignerno longer implementsDisplay; useto_line().from_stringrejects certificate keys, and line feeds or NULs in principals and namespaces.AllowedSignerParsingErroris now#[non_exhaustive].