Skip to content

feat(code-agent): add gitsign for cryptographic commit signing - #3842

Closed
lahavyuv86 wants to merge 1 commit into
fullsend-ai:mainfrom
lahavyuv86:feat/gitsign-commit-signing
Closed

feat(code-agent): add gitsign for cryptographic commit signing#3842
lahavyuv86 wants to merge 1 commit into
fullsend-ai:mainfrom
lahavyuv86:feat/gitsign-commit-signing

Conversation

@lahavyuv86

Copy link
Copy Markdown
Contributor

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

  • Install gitsign v0.16.1 binary with SHA256 verification for both amd64 and arm64 architectures
  • Configure Git system-wide to use gitsign with x509 format (gpg.format=x509, gpg.x509.program=gitsign)
  • Enable commit and tag signing by default (commit.gpgsign=true, tag.gpgsign=true)

Testing

Checklist

  • PR title follows Conventional Commits (correct type, ! for breaking changes)
  • Commits are signed off (DCO) — human and human-directed agent sessions only
  • I wrote this contribution myself and can explain all changes in it

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.yml workflow 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.

@lahavyuv86
lahavyuv86 requested a review from a team as a code owner July 9, 2026 10:16
@github-actions github-actions Bot closed this Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

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:

  1. Open a Vouch Request discussion.
  2. Describe what you want to change and why.
  3. Write in your own words — do not have an AI generate the request.
  4. A maintainer will comment /vouch if approved.
  5. Once vouched, open a new PR (preferred) or reopen this one.

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

E2E tests did not run

E2E tests run automatically for org/repo members and collaborators on pull requests.

For other contributors, a maintainer must add the ok-to-test label after the latest push.

See E2E testing guide for details.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add gitsign to code-agent image for keyless commit signing

✨ Enhancement ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Install Sigstore gitsign in the code-agent sandbox image (amd64/arm64, SHA verified).
• Configure system Git to use x509/gitsign and sign commits/tags by default.
• Enable agent commits to satisfy repositories requiring cryptographically verified signatures.
Diagram

graph TD
  A["images/code/Containerfile"] --> B["Code-agent image"] --> C["Git (sign by default)"] --> D["gitsign (x509)"] --> E{{"Sigstore (OIDC/Rekor)"}} --> F{{"Repo signature checks"}}
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Configure gitsign at runtime (entrypoint/env-driven)
  • ➕ Avoids globally forcing signing for all container uses
  • ➕ Allows different signing behavior per workflow/job without rebuilding the image
  • ➖ More moving parts at runtime; harder to guarantee every agent commit is signed
  • ➖ Requires reliable env/entrypoint wiring across all invocations
2. Use Git SSH signing instead of Sigstore (gpg.format=ssh)
  • ➕ No extra binary download required if ssh is already present
  • ➕ Simple verification model for repos standardizing on SSH signing
  • ➖ Requires managing SSH keys (not keyless) and secure key distribution
  • ➖ Does not leverage OIDC keyless provenance that Sigstore provides
3. Install gitsign via distro package manager (apt/apk)
  • ➕ Potentially simpler installation and fewer custom ARGs
  • ➕ Package manager can handle some update workflows
  • ➖ Version availability may lag releases; less deterministic across distros
  • ➖ Harder to pin exact artifacts/checksums across multi-arch builds

Recommendation: Keep the current approach: baking a pinned gitsign binary with SHA256 verification plus system-wide Git signing defaults is the most reliable way to ensure agent commits satisfy signature verification policies. The main tradeoff (global signing enabled) is acceptable for a dedicated agent image, especially given the companion PR will supply the required OIDC-related environment configuration.

Files changed (1) +27 / -0

Other (1) +27 / -0
ContainerfileInstall gitsign and enable default Git commit/tag signing +27/-0

Install gitsign and enable default Git commit/tag signing

• Adds installation of a pinned gitsign binary for amd64/arm64 with SHA256 verification. Configures system Git to use x509/gitsign and enables commit and tag signing by default to satisfy signature verification requirements.

images/code/Containerfile

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 54 rules

Grey Divider


Action required

1. Signing fails in sandbox 🐞 Bug ☼ Reliability
Description
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.
Code

images/code/Containerfile[R54-57]

+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
Relevance

⭐⭐⭐ High

Team repeatedly fixes sandbox auth/connectivity breakages (preflight GitHub access, OIDC refresh);
likely to fix signing blocker too.

PR-#2144
PR-#726
PR-#2859

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The Containerfile explicitly enables keyless (OIDC-backed) signing for all commits, while the repo’s
sandbox credential preparation script explicitly states the sandbox cannot reach GitHub’s OIDC
endpoint; the harness/env passed into the sandbox currently only includes a GCP OIDC token file and
no gitsign-specific token/config.

images/code/Containerfile[52-57]
internal/scaffold/fullsend-repo/scripts/prepare-sandbox-credentials.sh[4-14]
internal/scaffold/fullsend-repo/harness/code.yaml[4-37]
internal/scaffold/fullsend-repo/env/code-agent.env[1-52]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


2. Amend drops commit signature 🐞 Bug ≡ Correctness
Description
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.
Code

images/code/Containerfile[R54-57]

+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
Relevance

⭐⭐ Medium

No prior reviews about amend preserving signatures; team does amend commits in post-scripts and
enforces commit metadata elsewhere.

PR-#2855
PR-#2240
PR-#851

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR enables system-wide signing in the sandbox image, but the runner post-scripts explicitly run
after sandbox teardown and amend commits without any signing configuration or gitsign usage, which
can rewrite away the signature before pushing.

images/code/Containerfile[52-57]
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[321-350]
internal/scaffold/fullsend-repo/scripts/post-fix.sh[1-6]
internal/scaffold/fullsend-repo/scripts/post-fix.sh[244-261]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


Grey Divider

Qodo Logo

Comment thread images/code/Containerfile
Comment on lines +54 to +57
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

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

Comment thread images/code/Containerfile
Comment on lines +54 to +57
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

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

@lahavyuv86
lahavyuv86 deleted the feat/gitsign-commit-signing branch July 9, 2026 11:42
@lahavyuv86
lahavyuv86 restored the feat/gitsign-commit-signing branch July 9, 2026 12:04
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