feat(code-agent): add gitsign for cryptographic commit signing - #3842
feat(code-agent): add gitsign for cryptographic commit signing#3842lahavyuv86 wants to merge 1 commit into
Conversation
|
Thank you for your interest in contributing to fullsend, @lahavyuv86. This project uses a vouch system for first-time contributors. Before submitting a pull request, you need to be vouched by a maintainer. To get vouched:
See CONTRIBUTING.md for details. |
E2E tests did not runE2E tests run automatically for org/repo members and collaborators on pull requests. For other contributors, a maintainer must add the See E2E testing guide for details. |
PR Summary by QodoAdd gitsign to code-agent image for keyless commit signing
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. Signing fails in sandbox
|
| RUN git config --system gpg.format x509 \ | ||
| && git config --system gpg.x509.program gitsign \ | ||
| && git config --system commit.gpgsign true \ | ||
| && git config --system tag.gpgsign true |
There was a problem hiding this comment.
1. Signing fails in sandbox 🐞 Bug ☼ Reliability
commit.gpgsign=true makes every agent commit in the sandbox require gitsign keyless signing, but this repo documents that the sandbox cannot reach GitHub’s OIDC endpoint; without a token handoff/config for gitsign, git commit can fail and block the agent from producing any commit.
Agent Prompt
## Issue description
The sandbox image config enables mandatory commit/tag signing via gitsign, but the sandbox environment is documented as unable to reach GitHub’s OIDC endpoint. If gitsign relies on fetching an OIDC identity token at commit time, `git commit` will fail inside the sandbox.
## Issue Context
This repo already has runner-side logic to pre-fetch GitHub OIDC tokens and pass them into the sandbox for GCP WIF because the sandbox can’t reach the OIDC endpoint. The gitsign integration should use a similar approach (token file/env) or move signing to the runner phase where OIDC is reachable.
## Fix Focus Areas
- images/code/Containerfile[52-57]
- internal/scaffold/fullsend-repo/scripts/prepare-sandbox-credentials.sh[4-14]
- internal/scaffold/fullsend-repo/harness/code.yaml[4-40]
- internal/scaffold/fullsend-repo/env/code-agent.env[1-52]
## Implementation notes
- Either (A) stop setting `commit.gpgsign=true` in the sandbox image and instead perform signing in the runner post-script just before push, OR (B) add a runner-side prefetch of the GitHub OIDC token for gitsign and pass it into the sandbox (host_file) and configure gitsign to use it.
- Whichever approach you choose, ensure the agent can still create commits in the sandbox even when OIDC isn’t reachable from inside the sandbox network policy.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| RUN git config --system gpg.format x509 \ | ||
| && git config --system gpg.x509.program gitsign \ | ||
| && git config --system commit.gpgsign true \ | ||
| && git config --system tag.gpgsign true |
There was a problem hiding this comment.
2. Amend drops commit signature 🐞 Bug ≡ Correctness
The post-scripts rewrite commits via git commit --amend --no-edit on the GitHub Actions runner after the sandbox is destroyed, but they do not configure gitsign/signing there; any rewrite creates a new commit object and can therefore drop the original signature before push.
Agent Prompt
## Issue description
The sandbox image enables signed commits, but the runner post-scripts can amend commits (artifact stripping, pre-commit autofixes). Amending rewrites the commit; without explicitly signing the amended commit on the runner, the final pushed commit may be unsigned, defeating the purpose of enabling signed commits.
## Issue Context
- post-code.sh and post-fix.sh both state they run on the GitHub Actions runner after the sandbox is destroyed.
- Both scripts call `git commit --amend --no-edit` in at least one flow.
- Neither script installs/configures `gitsign` nor sets git’s signing config, so the amended commit is not guaranteed to remain signed.
## Fix Focus Areas
- internal/scaffold/fullsend-repo/scripts/post-code.sh[1-6]
- internal/scaffold/fullsend-repo/scripts/post-code.sh[194-199]
- internal/scaffold/fullsend-repo/scripts/post-code.sh[338-350]
- internal/scaffold/fullsend-repo/scripts/post-fix.sh[1-6]
- internal/scaffold/fullsend-repo/scripts/post-fix.sh[255-261]
- images/code/Containerfile[52-57]
## Implementation notes
- Option A (recommended): Move signing to the runner as the final step before push:
- Ensure gitsign is available on the runner (install with pinned version/checksum, similar to how gitleaks is installed).
- Configure git (local repo config) to use x509+gitsign and sign the final commit explicitly.
- When amending, use `git commit --amend --no-edit -S` (or equivalent with `-c` configs) so the amended commit is signed.
- Option B: Avoid rewriting commits in post-scripts by performing artifact stripping and pre-commit autofix handling inside the sandbox prior to the agent’s final commit.
Either way, ensure that any code path that rewrites commits preserves/reapplies signatures.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
Add gitsign (Sigstore keyless signing) to the code agent sandbox image to enable cryptographic commit signing. This provides verifiable proof of commit provenance using GitHub Actions OIDC tokens, allowing agent commits to pass repository signature verification requirements.
Related Issue
#1685
Changes
gpg.format=x509,gpg.x509.program=gitsign)commit.gpgsign=true,tag.gpgsign=true)Testing
make lintpasses (stage changes first, then run)Checklist
!for breaking changes)Additional Notes
This PR only covers the gitsign installation and Git configuration in the container image. The corresponding OIDC environment variables (
GITSIGN_CONNECTOR_ID,GITSIGN_TOKEN_PROVIDER,GITSIGN_REKOR_MODE) are configured in the companion PR to the agents repository.Testing plan: After this PR is merged, the
sandbox-images.ymlworkflow will build and push the image with the SHA tag. I can then reference this SHA-tagged image in the test repository to verify commits are properly signed before creating the companion PR for the agents repo.