Skip to content

test: harden git_hardening fixture against host gpg-sign config (#57) - #60

Merged
thehoff merged 1 commit into
developfrom
fix/git-hardening-fixture-57
May 18, 2026
Merged

thehoff merged 1 commit into
developfrom
fix/git-hardening-fixture-57

Conversation

@thehoff

@thehoff thehoff commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

tests/git_hardening.rs::make_repo() inherited the developer's global commit.gpgsign=true, so the entire suite died at the fixture's git commit whenever the signing agent (1Password, gpg-agent, ssh-agent) was unavailable. Failure surfaced as "security tests broken" rather than "fixture broken".

Bit this session repeatedly during #50 and #58 — wasted context-switches to figure out the cause was 1Password, not the security work.

Fix

Two layers of insurance in make_repo():

  1. -c commit.gpgsign=false -c tag.gpgsign=false on every git invocation in the helper.
  2. git config commit.gpgsign false + tag.gpgsign false on the freshly-init'd repo as belt-and-braces.

Verified

Before (develop tip b5442fe): 1 passed, 5 failed.
After: 6 passed, 0 failed.
All 8 other integration suites continue to pass.

Closes #57.

`tests/git_hardening.rs::make_repo()` ran `git commit` with the
developer's global git config inherited. When the host has
`commit.gpgsign=true` pointing at a signing agent (1Password,
gpg-agent, ssh-agent) and that agent is unavailable or locked,
ALL 5 fixture-using tests die at `commit -q -m init` with
"1Password: agent returned an error" / "fatal: failed to write
commit object" — and the failure looks like the security test
broke, not the fixture.

This bit the #50 (gh/glab/gt) and #58 (review fixups) commits
in the same session: the bug-bypass tests passed, the env-strip
tests panicked at the fixture, and the user had to context-switch
to figure out it was 1Password not the security work.

## Fix

Two layers of insurance in `make_repo()`:
1. Pass `-c commit.gpgsign=false -c tag.gpgsign=false` on every
   git invocation in the helper. These override the inherited
   global config for the duration of the call.
2. Also `git config commit.gpgsign false` + `tag.gpgsign false`
   on the freshly-init'd repo so any future helper that forgets
   the `-c` flags still gets a hermetic commit.

Belt-and-braces because layer 1 alone is sufficient today, but
layer 2 protects against drift in helpers that add new git calls
later.

## Verified
Before this PR (on develop tip `b5442fe`):
  test result: FAILED. 1 passed; 5 failed.

After this PR:
  test result: ok. 6 passed; 0 failed.

All other 8 integration suites continue to pass.

Closes #57.
@thehoff
thehoff merged commit 446d1e2 into develop May 18, 2026
3 checks passed
@thehoff
thehoff deleted the fix/git-hardening-fixture-57 branch May 18, 2026 12:54
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.

test: git_hardening fixture commits fail when commit.gpgsign=true is in user's global git config

1 participant