🐋🔧:write out the one key, not everything offered - #911
Conversation
Found reviewing the port of this file into the portal, where it landed
as 86ecc82. The count and the thing written were not the same list.
`count` is how many of `ssh-add -L`'s lines look like a key type this
accepts. The file was then written from `identities`, which is every
line the agent offered. An agent forwarding a certificate alongside the
key it belongs to prints two lines and matches one -- the certificate
is `ssh-ed25519-cert-v01@openssh.com`, deliberately not an accepted
type -- so the guard passed and wrote both.
Two keys in that file breaks both readers of it. `ssh-keygen -Y sign
-f` wants one public key, and allowed_signers takes its second field
from `awk '{print $1, $2}'` over the whole file, which becomes a second
line in a grammar that has room for none.
The matching lines are kept now and the count taken from those, so what
is counted is what is written.
Checked against a single key, a key plus its certificate, two real
keys, an ECDSA key, and "The agent has no identities.": one line
written in the first, second and fourth, and a refusal in the others.
The file is byte-identical to the portal's again with this.
Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe container startup script now filters SSH agent identities before counting and writing the signing-key file. It excludes unsupported keys and certificates from both operations. ChangesSSH signing-key filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The startup script now writes only one accepted SSH key and excludes accompanying certificates or unsupported identities. The stated validation covers the intended key and failure cases, with no current merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Found while reviewing the port of this file into the portal, where the fix landed as
86ecc82.The count and the thing written were not the same list.
countis how many ofssh-add -L's lines look like a key type this accepts. The file was then written fromidentities, which is every line the agent offered. An agent forwarding a certificate alongside the key it belongs to prints two lines and matches one — the certificate isssh-ed25519-cert-v01@openssh.com, deliberately not an accepted type — so the guard passed and wrote both.Two keys in that file breaks both readers of it.
ssh-keygen -Y sign -fwants one public key, andallowed_signerstakes its second field fromawk '{print $1, $2}'over the whole file, which becomes a second line in a grammar that has room for none.The matching lines are kept now and the count taken from those, so what is counted is what is written.
How it was checked
The agent has no identities.bash -nandsh -nclean, mode 755 preserved,verify.allshows no new failures. With this the file is byte-identical to the portal's again.Summary by CodeRabbit