Skip to content

🐋🔧:write out the one key, not everything offered - #911

Merged
openinf-commit-queue[bot] merged 1 commit into
mainfrom
infra/one-key-not-all
Sep 7, 2026
Merged

🐋🔧:write out the one key, not everything offered#911
openinf-commit-queue[bot] merged 1 commit into
mainfrom
infra/one-key-not-all

Conversation

@DerekNonGeneric

@DerekNonGeneric DerekNonGeneric commented Sep 7, 2026

Copy link
Copy Markdown
Member

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.

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.

How it was checked

agent holds count lines written
one ed25519 1 1
ed25519 + its certificate 1 1 (was 2)
two real keys 2 refused
ECDSA nistp256 1 1
The agent has no identities. 0 refused

bash -n and sh -n clean, mode 755 preserved, verify.all shows no new failures. With this the file is byte-identical to the portal's again.

Summary by CodeRabbit

  • Bug Fixes
    • Improved SSH signing-key detection in development environments.
    • Only supported public keys are now considered, while certificate entries are excluded.
    • When exactly one valid key is available, the correct key is selected consistently for signing operations.

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
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 717b94b7-ee16-4830-980a-925c7e15346b

📥 Commits

Reviewing files that changed from the base of the PR and between 09ad280 and cac3f3d.

📒 Files selected for processing (1)
  • .devcontainer/post-start.sh

Included review availability: Your plan provides up to 8 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The 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.

Changes

SSH signing-key filtering

Layer / File(s) Summary
Filter identities before writing
.devcontainer/post-start.sh
The script stores supported, non-certificate public keys in matched, counts that list, and writes the filtered identity when exactly one match exists.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to cac3f

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)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: writing only the single matching SSH key instead of all offered identities. The wording is concise and specific.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch infra/one-key-not-all

Comment @coderabbitai help to get the list of available commands.

@DerekNonGeneric DerekNonGeneric added the 🚀 Status: Commit Queue Land this pull request when its checks pass label Sep 7, 2026
@openinf-commit-queue
openinf-commit-queue Bot merged commit ad63767 into main Sep 7, 2026
11 checks passed
@openinf-commit-queue openinf-commit-queue Bot removed the 🚀 Status: Commit Queue Land this pull request when its checks pass label Sep 7, 2026
@openinf-commit-queue
openinf-commit-queue Bot deleted the infra/one-key-not-all branch September 7, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant