Repository navigation
test: harden git_hardening fixture against host gpg-sign config (#57) - #60
Merged
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests/git_hardening.rs::make_repo()inherited the developer's globalcommit.gpgsign=true, so the entire suite died at the fixture'sgit commitwhenever 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():-c commit.gpgsign=false -c tag.gpgsign=falseon every git invocation in the helper.git config commit.gpgsign false+tag.gpgsign falseon 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.