Skip to content

git: enable sandboxed SSH commit signing - #120

Merged
odrobnik merged 2 commits into
mainfrom
agent/issue-119
Nov 15, 2026
Merged

odrobnik merged 2 commits into
mainfrom
agent/issue-119

Conversation

@odrobnik

Copy link
Copy Markdown
Contributor

Part of #119.

Added sandboxed SSH commit and tag signing, verification, key generation, and setup documentation. The required macOS build, full test suite, and lint passed, with one known upstream error-message defect tracked in SwiftPorts #175; other platforms and interactive terminal prompts were not verified. Signing failures correctly prevent commits, but the missing-signer error wording still needs that upstream fix, so this PR delivers part of #119 and leaves it open.

Make the SwiftPorts signing port reachable through the virtual command catalog so git signs and verifies without host processes. Exercise sandbox home and temp paths, encrypted keys with a scripted prompt, and signing failures.

Keep the missing-signer diagnostic regression visible as a known issue tracked in Cocoanetics/SwiftPorts#175 rather than work around it in SwiftBash.

Suite: +3 tests, including four signing cases. Required swiftbuild build and full serial suite pass with one known upstream issue; strict SwiftLint passes.

Co-Authored-By: Claude <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T20:01:37.750227Z b8a87cf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Windows filesystems do not expose POSIX permission bits, so the mode assertion failed even though key generation and signing succeeded. Keep the file type check on every platform and limit the mode check to POSIX hosts. Remove the branch-introduced lint violation in the manifest as well.\n\nSuite: test count unchanged.\n\nCo-Authored-By: Claude <noreply@anthropic.com>

@odrobnik odrobnik left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking findings.

What I checked:

  • ssh-keygen reaches the shell through SwiftPortsCommands.argumentParserCommands in SwiftPorts 0.2.0. Because registerSwiftPortsCommands() installs that list, the only code change needed here is the new BinCatalog entry for /usr/bin/ssh-keygen.
  • The test target's SSHKeygenCommand dependency is left out on Android. This matches SwiftPorts' androidDroppedTargets, and GitSigningTests.swift is wrapped in #if !os(Android).
  • Moving SwiftPorts to .upToNextMinor(from: "0.2.0") with an updated Package.resolved follows the dependency rules in AGENTS.md. GitKit (2.10.0), ShellKit (0.1.2) and the NIO packages come in as SwiftPorts dependencies. SwiftBash doesn't import GitKit itself.
  • The ssh-keygen port reads and writes key files through Shell.resolve and Shell.authorize, so files stay behind the sandbox's URL gate. Default key paths use the shell's HOME, and the key comment comes from hostInfo. That keeps the filesystem and identity rules intact.
  • The tests use the real BashProcessLauncher. They cover encrypted and unencrypted keys, commits and tags, verification output, a 0600 mode on the private key, cleanup of temporary files, and that no commit ref is written when the signer is missing. The withKnownIssue gate for SwiftPorts#175 matches what the PR description says.

Notes (not blocking):

  • By default, encrypted-key passphrase prompts read from the host's controlling terminal, not from Shell.current.stdin. The docs cover this and point embedders to SSHKeygenExecutable.run(passphrasePrompt:).
  • Windows CI was still pending when I reviewed. The exact stderr strings in missingSignerDoesNotWriteCommit haven't been checked on that platform.

👍 No findings.

Reviewed by Claude · opus

@odrobnik
odrobnik merged commit 55cad2a into main Nov 15, 2026
10 of 11 checks passed
@odrobnik
odrobnik deleted the agent/issue-119 branch November 15, 2026 21:09
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