Skip to content

Commit 820a858

Browse files
wpfleger96Duncan
andauthored
fix(release): attribute desktop candidates to the operator (#6831)
The desktop release tooling hardcoded one contributor's personal identity into every release candidate commit. `scripts/prepare-desktop-release.sh` committed the candidate with a `git -c user.name='Wes' -c user.email='[email protected]'` override, and `scripts/desktop_release.py` `validate` required the candidate author to be exactly `Wes <[email protected]>` plus a matching `Signed-off-by` trailer. That leaked from Wes's working setup into the validation contract in #3568, so a release cut by any other operator was falsely attributed to and signed off by Wes (as happened on #6828). ## Change - `prepare-desktop-release.sh`: drop the `-c` identity overrides so `git commit -s` uses the operator's own configured identity to author and sign off the candidate. The automation `Co-authored-by` trailer is unchanged. - `desktop_release.py` `validate`: replace the exact-Wes checks with structural ones — the commit author must be non-empty, the body must contain a `Signed-off-by` trailer whose name and email match the commit author (honest DCO), and the existing automation `Co-authored-by` regex check stays. Failure messages remain specific. - `test-desktop-release-candidate.sh`: the fixture candidate now commits under the harness's own identity, and a new negative case rewrites the author to a mismatched identity and asserts the validator rejects it. Release authorization is bound to the merged PR via the GitHub API in `scripts/verify-desktop-release-merge.sh`, never the commit author field, so this does not weaken the trust model. `RELEASING.md` and `.github/workflows/desktop-release-candidate.yml` reference no author identity and need no change. Verified locally: `scripts/test-desktop-release-candidate.sh` passes, including the new sign-off/author-mismatch rejection. --------- Signed-off-by: Will Pfleger <[email protected]> Co-authored-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
1 parent cae7f82 commit 820a858

3 files changed

Lines changed: 44 additions & 8 deletions

File tree

‎scripts/desktop_release.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,15 @@ def validate(args: argparse.Namespace) -> None:
257257
bad = [str(path.relative_to(ROOT)) for path, value in manifests.items() if value != version]
258258
if bad:
259259
raise SystemExit(f"version mismatch in: {', '.join(bad)}")
260-
author = git("show", "-s", "--format=%an <%ae>", candidate)
260+
name = git("show", "-s", "--format=%an", candidate)
261+
email = git("show", "-s", "--format=%ae", candidate)
262+
if not name or not email:
263+
raise SystemExit("candidate has no author identity")
264+
author = f"{name} <{email}>"
261265
body = git("show", "-s", "--format=%B", candidate)
262-
if author != "Wes <[email protected]>":
263-
raise SystemExit(f"unexpected candidate author: {author}")
264-
if "Signed-off-by: Wes <[email protected]>" not in body:
265-
raise SystemExit("candidate is missing Wes Signed-off-by trailer")
266+
signoffs = re.findall(rf"(?m)^Signed-off-by: {re.escape(author)}$", body)
267+
if len(signoffs) != 1:
268+
raise SystemExit(f"candidate must carry exactly one Signed-off-by trailer matching its author {author}")
266269
if not re.search(r"(?m)^Co-authored-by: .+ <.+>$", body):
267270
raise SystemExit("candidate is missing automation Co-authored-by trailer")
268271
print(f"validated immutable desktop candidate {candidate} for desktop-v{version}")

‎scripts/prepare-desktop-release.sh‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ chore(release): release Buzz Desktop version $version
4242
4343
Co-authored-by: $agent_name <$agent_email>
4444
EOF
45-
git -c user.name='Wes' -c user.email='[email protected]' \
46-
commit -s -F "$msg"
45+
git commit -s -F "$msg"
4746
scripts/desktop_release.py validate --candidate HEAD --version "$version" --repo block/buzz
4847

4948
candidate_sha="$(git rev-parse HEAD)"

‎scripts/test-desktop-release-candidate.sh‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,42 @@ for path in ('desktop/package.json', 'desktop/src-tauri/tauri.conf.json'):
6464
open('desktop/src-tauri/Cargo.toml','w').write('[package]\nversion = "1.0.1"\n')
6565
PY
6666
git add .
67-
git -c user.name=Wes -c [email protected] commit -q -s -m 'chore(release): release Buzz Desktop version 1.0.1' -m 'Co-authored-by: Test Automation <[email protected]>'
67+
git commit -q -s -m 'chore(release): release Buzz Desktop version 1.0.1' -m 'Co-authored-by: Test Automation <[email protected]>'
6868
PATH="$mock_bin:$PATH" scripts/desktop_release.py validate --version 1.0.1 --repo block/buzz
69+
good_candidate=$(git rev-parse HEAD)
70+
71+
# A candidate whose Signed-off-by does not match its author is a dishonest
72+
# DCO sign-off and must be rejected. Rewrite the author while keeping the
73+
# original trailer body, then restore the honest candidate.
74+
git -c user.name=Impostor -c [email protected] commit -q --amend --no-edit --reset-author
75+
if PATH="$mock_bin:$PATH" scripts/desktop_release.py validate --version 1.0.1 --repo block/buzz >/dev/null 2>&1; then
76+
echo "validator accepted a candidate whose sign-off does not match its author" >&2; exit 1
77+
fi
78+
git reset -q --hard "$good_candidate"
79+
80+
# The trailer must be a complete anchored line, not substring-matched. A prose
81+
# line that merely contains the sign-off text, or a real trailer with trailing
82+
# garbage, must be rejected. Both were accepted before the anchored parse.
83+
for bogus in \
84+
'not-a-trailer Signed-off-by: test <[email protected]>' \
85+
'Signed-off-by: test <[email protected]> trailing-garbage'; do
86+
git commit -q --amend -m 'chore(release): release Buzz Desktop version 1.0.1' \
87+
-m 'Co-authored-by: Test Automation <[email protected]>' -m "$bogus"
88+
if PATH="$mock_bin:$PATH" scripts/desktop_release.py validate --version 1.0.1 --repo block/buzz >/dev/null 2>&1; then
89+
echo "validator accepted a malformed sign-off: $bogus" >&2; exit 1
90+
fi
91+
git reset -q --hard "$good_candidate"
92+
done
93+
94+
# Two matching sign-offs are also invalid: the contract is exactly one.
95+
git commit -q --amend -m 'chore(release): release Buzz Desktop version 1.0.1' \
96+
-m 'Co-authored-by: Test Automation <[email protected]>' \
97+
-m 'Signed-off-by: test <[email protected]>' -m 'Signed-off-by: test <[email protected]>'
98+
if PATH="$mock_bin:$PATH" scripts/desktop_release.py validate --version 1.0.1 --repo block/buzz >/dev/null 2>&1; then
99+
echo "validator accepted duplicate Signed-off-by trailers" >&2; exit 1
100+
fi
101+
git reset -q --hard "$good_candidate"
102+
69103
grep -Fq "$unrelated_before" CHANGELOG.md
70104
grep -Fq "$unrelated_after" CHANGELOG.md
71105
! grep -Fq "$prior_merge" CHANGELOG.md

0 commit comments

Comments
 (0)