fix: commit author/committer come from the global git identity, not the target repo; verify identity + signing before push #425
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#425
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
madt_commitwrites the author and committer from the global git identity, notfrom the target repository's local config. So a commit can land with the wrong
author and committer for the repo it belongs to, even when that repo's local
user.name/user.emailare set correctly.Reading the config does not reveal the mismatch:
git config user.emailandgit var GIT_AUTHOR_IDENTin the clone can both show the correct, repo-localidentity, while the commit
madt_commitactually produces carries the globalone. The only way to see it is to read the finished commit object's author and
committer, and nothing does that before the commit is pushed.
On a forge that expects a specific author identity (and signed commits), this
means a wrong-author, or unsigned, commit can reach the forge with nothing
stopping it.
Gaps
Identity source.
madt_commitshould take author and committer from theTARGET repo's local git config (the repo the commit lands in), not the global
identity.
No pre-push verification. Before
push/finish, read each commit onthe branch and check that its author email and committer email match the
repo's expected identity, and, where the forge requires signing, that the
commit is signed and verifies. Refuse on a mismatch and name the commit. A
config check is not enough: the config can be right while the commit is wrong,
so the guard must read the commit object.
Unsigned merge commit.
finishon a signing-required forge should notleave an unsigned merge commit. The server-side API merge can produce one even
when the branch commits are signed. Use a merge style that creates none
(fast-forward or rebase), or sign the merge.
Related
same root, applied here to the commit identity.
one case).
This splits cleanly, and only half of it is blocked.
Item 1 (author and committer taken from the TARGET repo's local git config, not the global identity) is self-contained with no open question attached, so it can be built now. The same goes for a pre-push guard that reads each commit OBJECT's author and committer, because a config check is not enough: the config can be right while the commit is wrong.
Items 2 and 3 (pre-push SIGNING verification, and the unsigned merge commit that
finishcan leave) are coupled to the signing-identity design in #424. They should follow that decision rather than pre-empt it.madtea git commitdisplay author comes from the Gitea account, can diverge from the actual local-identity author #447Item 1 landed in PR #448.
madt_commitandmadt_finish's commit step now take author and committer from the target repo's LOCAL git config, and a pre-push guard reads each commit OBJECT and refuses, naming the sha, on an author/committer email that does not match the repo's local identity. On a first push with no remote base it checks every commit reachable from the pushed branch (an identity check, independent of forge signing).Items 2 and 3 (signing verification, and the unsigned merge commit
finishcan leave) stay blocked on #424, so #448 references this issue rather than closing it.Follow-up filed: #447 - the CLI
git commitdisplayauthorfield still reads the Gitea account, so it can diverge from the actual local-identity author.madtea git commitdisplay author comes from the Gitea account, can diverge from the actual local-identity author #447Items 2-3 follow the #424 decision (no key custody; gate on the repo's actual signing requirement).
internal/opspec/paramdocs.go:584). If a signed merge is ever needed on a signing-required forge, it uses the operator's configured key from #424, not a madtea-held key.Item 1 (identity from the target repo plus the pre-push identity guard) already landed in PR #448. Clearing needs-decision: this is workable now and flows from #424.