Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions images/code/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ RUN if command -v apt-get >/dev/null 2>&1; then \
# env file overrides this with the OpenShell bundle if present.
RUN git config --system http.sslCAInfo /etc/ssl/certs/ca-certificates.crt 2>/dev/null || true

# Configure Git to use gitsign for commit signing (keyless signing via Sigstore).
# This enables cryptographic verification of agent commits.
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
Comment on lines +54 to +57

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 on lines +54 to +57

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


# ---------------------------------------------------------------------------
# Go toolchain — needed to compile and run tests in Go-based target repos.
# Without this the agent falls back to manual code review (no `go build`,
Expand Down Expand Up @@ -94,6 +101,26 @@ RUN case "$TARGETARCH" in \
&& chmod +x /usr/local/bin/lychee \
&& rm -rf /tmp/lychee.tar.gz "/tmp/lychee-${LY_TRIPLE}"

# ---------------------------------------------------------------------------
# gitsign — keyless Git signing using Sigstore. Used to cryptographically
# sign agent commits with verifiable provenance via OIDC.
# To update: bump GITSIGN_VERSION and GITSIGN_SHA256_{AMD64,ARM64} from:
# https://github.com/sigstore/gitsign/releases
ARG GITSIGN_VERSION=0.16.1
ARG GITSIGN_SHA256_AMD64=4a29a1f4b9add1f0f6d9a3e9e6ba0cffa121b971be82d62bb1496d7d1d877b0a
ARG GITSIGN_SHA256_ARM64=66eb0378608c8fbceb497eecb58a525345549f46e9588616daa0f157624f33b4
RUN case "$TARGETARCH" in \
amd64) GS_SHA="$GITSIGN_SHA256_AMD64" ;; \
arm64) GS_SHA="$GITSIGN_SHA256_ARM64" ;; \
*) echo "unsupported TARGETARCH=$TARGETARCH" >&2; exit 1 ;; \
esac \
&& curl -fsSL \
"https://github.com/sigstore/gitsign/releases/download/v${GITSIGN_VERSION}/gitsign_${GITSIGN_VERSION}_linux_${TARGETARCH}" \
-o /tmp/gitsign \
&& echo "${GS_SHA} /tmp/gitsign" | sha256sum -c - \
&& mv /tmp/gitsign /usr/local/bin/gitsign \
&& chmod +x /usr/local/bin/gitsign

# ---------------------------------------------------------------------------
# gitleaks is already installed in the base sandbox image.
# See images/sandbox/Containerfile for the pinned version and checksums.
Expand Down