Skip to content

[WIP] fix(ssh): write allowed signers in the format OpenSSH accepts - #53

Draft
timweri wants to merge 2 commits into
mainfrom
fix/allowed-signer-display
Draft

timweri wants to merge 2 commits into
mainfrom
fix/allowed-signer-display

Conversation

@timweri

@timweri timweri commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Flagged by Opus 5.5. My implementation of the allowed signers options is wrong and not accepted by OpenSSH.

A few issues include:

  • Options are supposed to be comma separated, not just space-separated.
  • Options are supposed to be quoted.

Refer to the test cases / code comments for examples of the wrong format.

This implementation is checked against OpenSSH and the allowed signers specs.

AllowedSigner's Display output was rejected by OpenSSH and by this
crate's own parser. Options were space-separated and unquoted, and
timestamps were written as raw UNIX epochs.

Display now writes comma-separated options with quoted values,
timestamps as YYYYMMDDHHMMSSZ clamped to the range OpenSSH accepts,
escapes quotes in namespaces, and quotes principals containing
whitespace or '#'.

The parser now follows the ssh-keygen(1) ALLOWED SIGNERS format:
options are a single comma-separated field, so space-separated options
are rejected. It also accepts tabs between fields and a case-insensitive
Z or UTC timestamp suffix, and rejects unknown options, empty options,
cert-authority with a value, and stray quotes.
Port OpenSSH's allowed signers parser so that a line means the same thing
here as it does to ssh-keygen, and make Display fail instead of writing
a line that OpenSSH would read back differently.

- Read \" in a quoted option value as a literal quote, so namespaces
  containing quotes round-trip.
- Replace the splitter, whose quote check looked at the last token of
  the line instead of the next one.
- Stop clamping timestamps. Display now fails for values OpenSSH can't
  read back, including pairs that clamping collapsed together.
- Fail in Display for principals or namespaces that are empty or contain
  commas, quotes (principals), or line breaks.
- Add test cases from OpenSSH's test_strdelim.c, test_convtime.c, and
  sshsig.sh.
@timweri timweri changed the title fix(ssh): write allowed signers in the format OpenSSH accepts [WIP] fix(ssh): write allowed signers in the format OpenSSH accepts Sep 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant