Skip to content
Merged
Show file tree
Hide file tree
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
21 changes: 20 additions & 1 deletion .github/workflows/dco-post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,25 @@ env:
# from clubanderson in #14064: the maintainer merging the PR that adds
# this entry IS that disposition.

# 687c3cb006d7559135f5f2fb0db13476d1af2a43 — the squash of #15315 (fix: stop
# filing the pre-restart kick-undeliverable warning as a fleet issue), on
# v5, reported by the monitor in #15401. mismatched-signoff of a NEW shape:
# same person: author uses GitHub noreply (id 91499691, @odttlnt), sign-off
# uses verified work email; pre-merge DCO passed (#15315). GitHub's squash
# wrote the PR author's private-email identity, Sachin Naik
# <91499691+odttlnt@users.noreply.github.com>, over a branch commit
# (97a705ca) authored AND signed off as SACHIN NAIK <sachin.naik@ibm.com>;
# probot DCO and the squash-attribution gate both accepted it because the
# commits API resolves that address to @odttlnt. The checker now accepts
# this shape on its own (same-person-noreply, #15401) when v5 history
# carries local evidence of the link; for this first commit from the
# contributor there is none on v5 yet (the only prior commit under the work
# address is the PR branch commit itself), so it is waived. Protected v5
# history cannot be re-signed in place. Accepted by maintainer disposition
# in #15401: the maintainer merging the PR that adds this entry IS that
# disposition. Expect STALE-WAIVER once the contributor's next commit lands
# under the work address; remove the entry then.

# KNOWN FAILING COMMITS THAT ARE DELIBERATELY *NOT* WAIVED
#
# Deep history carries further genuine mismatches — 8b536911 and, on v5
Expand All @@ -300,7 +319,7 @@ env:
# regression. They are intentionally left unwaived: pre-approving them would
# grow this list for commits that are not actually being reported, which is
# the exact failure mode #6770 was filed about.
DCO_WAIVED_COMMITS: 'b798382a4d98ada28b0cb813644a595db0c58b08 7e01fee4a2c1a37f4a4072bf2d17e76e27113d01 d8f376e8e95f7b0c7d48d2b05b3a2a07ac9ee69b 4b9261183378a1a02a921cd0cc9df31e6f37993b 01bd2469e7a4022fff3fc04c42226c4d90c2f410 e29343efbb6e0721ca665ed8bd587d08997325e2 a8104b0cbeee1c4ac41034ac3f9951e6b5ac1200 692d068ffa198895ab91bd7ad663971f2b8ad358 b893b01c90e6ffff951523d20b19e9dfbfa80184 a0de3f920ded7e0cfc287bb5009d542e5a14f014 c6c78c3a26c33c6d1530996df20ead0a6b699dda a9200f3d278fcdbf6291f37f921845113814686e fb153585e6dab7b6f6808cb328e706d691f9be79 00070300002c88fda6850278edaea2498e8ca941 511027d8174be02b1dd77c25e9f8d5265f7fb7d4'
DCO_WAIVED_COMMITS: 'b798382a4d98ada28b0cb813644a595db0c58b08 7e01fee4a2c1a37f4a4072bf2d17e76e27113d01 d8f376e8e95f7b0c7d48d2b05b3a2a07ac9ee69b 4b9261183378a1a02a921cd0cc9df31e6f37993b 01bd2469e7a4022fff3fc04c42226c4d90c2f410 e29343efbb6e0721ca665ed8bd587d08997325e2 a8104b0cbeee1c4ac41034ac3f9951e6b5ac1200 692d068ffa198895ab91bd7ad663971f2b8ad358 b893b01c90e6ffff951523d20b19e9dfbfa80184 a0de3f920ded7e0cfc287bb5009d542e5a14f014 c6c78c3a26c33c6d1530996df20ead0a6b699dda a9200f3d278fcdbf6291f37f921845113814686e fb153585e6dab7b6f6808cb328e706d691f9be79 00070300002c88fda6850278edaea2498e8ca941 511027d8174be02b1dd77c25e9f8d5265f7fb7d4 687c3cb006d7559135f5f2fb0db13476d1af2a43'
# Tide/tagged-release failures discussed in #6276 came from human squash
# commits and release metadata, not bot-authored commits. Skip bots here so
# release automation is not paged for bracketed bot-address edge cases that
Expand Down
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,21 @@ rewritten; their failures are resolved by maintainer disposition, not by you.
blast radius — are documented in
[`src/docs/v5-sync-policy.md`](src/docs/v5-sync-policy.md#inherited-dco-failures-from-v4).

One identity shape the post-merge check resolves on its own: GitHub's squash
writes the pull-request author's GitHub identity on the landing commit, so a
contributor with a private email lands as
`<id>+<login>@users.noreply.github.com` while the `Signed-off-by:` carried
over from the branch is their real address — the one the pre-merge DCO check
already accepted. The checker treats that as the same person **only when the
protected branch's own history shows the link**: another commit authored or
committed under the sign-off address by the same name, or a commit on which
that address and `<login>`'s noreply appear together. It makes no GitHub API
call for this, and it reports each acceptance as an informational
`same-person-noreply … evidence=<kind>:<sha>` line rather than hiding it. A
first-time contributor's squash has no such evidence yet and still needs a
per-SHA waiver, which becomes `STALE-WAIVER` once their next commit under
that address lands ([#15401](https://github.com/hivecommons/hive/issues/15401)).

All four reuse the same trailer validation (`src/scripts/check-dco-trailers.sh`
for the range-scanning gates), and the sign-off *identity* rules — noreply
matching and author-login lookup — live in one shared library,
Expand Down
1 change: 1 addition & 0 deletions changelog.d/fixed-dco-postmerge-noreply-identity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The post-merge DCO trailer check (`src/scripts/check-dco-trailers.sh`) no longer fails a squash commit whose author is a GitHub noreply address (`<id>+<login>@users.noreply.github.com`) signed off under the same contributor's real email, when the branch's own history shows the two identities belong to one person; such commits are reported as informational `same-person-noreply` lines naming the evidence commit, with no GitHub API call. The v5 squash of #15315 (`687c3cb0`) is waived until that evidence exists on v5 ([#15401](https://github.com/hivecommons/hive/issues/15401)).
14 changes: 14 additions & 0 deletions src/docs/v5-sync-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,20 @@ only one that can clear a commit that carries no trailer at all. Reach for the
email allowlist only when the intent really is to accept an identity's alternate
address going forward.

Before reaching for either, check whether the checker can resolve the commit
itself. A squash whose author is a GitHub noreply address
(`<id>+<login>@users.noreply.github.com`) and whose sign-off is the same
contributor's real address is accepted as `same-person-noreply` when the
branch's history (last `DCO_SAME_PERSON_WINDOW` commits, default 500) carries
local evidence of the link — the same name authored under the sign-off
address before, or both identities appear on one earlier commit. Each
acceptance is printed with the evidence commit; no GitHub API call is made.
`DCO_SAME_PERSON_EVIDENCE_REFS` adds refs (for example a fetched
`refs/pull/N/head`) to that search for a local check. Only a contributor's
first such squash, which has no prior history, needs a waiver — and that
waiver is reported `STALE-WAIVER` once their next commit under that address
lands ([#15401](https://github.com/hivecommons/hive/issues/15401)).

Neither instrument is silent. A waived commit is reported on every run as
`WAIVED <sha> …` above the failures, the summary line counts waivers, and a
green run carrying them says `passed (with recorded waivers)` rather than
Expand Down
137 changes: 134 additions & 3 deletions src/scripts/check-dco-trailers.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env bash
# Check recent protected-branch commits for a DCO trailer whose email matches
# the commit author. GitHub noreply addresses are accepted only when the
# GitHub commits API identifies the commit author as that exact login.
# GitHub commits API identifies the commit author as that exact login. A
# noreply AUTHOR (the shape GitHub's squash writes for a private-email PR
# author) signed off under another address is accepted only when the branch's
# own history supplies local evidence that the two identities are one person;
# see same_person_noreply_evidence below (#15401).
# Maintainer override identities can be supplied with DCO_ALLOWLIST_EMAILS, but
# the default is intentionally empty so normal runs require the squash author's
# own sign-off.
Expand Down Expand Up @@ -44,6 +48,8 @@ ref="${2:-${DCO_REF:-HEAD}}"
allowlist_raw="${DCO_ALLOWLIST_EMAILS:-}"
waived_raw="${DCO_WAIVED_COMMITS:-}"
skip_bots="${DCO_SKIP_BOT_AUTHORS:-true}"
same_person_window="${DCO_SAME_PERSON_WINDOW:-500}"
same_person_extra_refs="${DCO_SAME_PERSON_EVIDENCE_REFS:-}"

usage() {
cat >&2 <<'USAGE'
Expand All @@ -67,6 +73,13 @@ Environment:
DCO_AUTHOR_LOGIN_MAP Optional comma/space/newline-separated SHA=login map
used before the GitHub API, mainly for tests/offline
runs. Empty by default.
DCO_SAME_PERSON_WINDOW Number of commits of history searched for LOCAL evidence
that a GitHub-noreply author and a differently-addressed
sign-off are the same person (default: 500; 0 disables).
DCO_SAME_PERSON_EVIDENCE_REFS
Optional extra refs (space-separated) whose history is
searched for that evidence in addition to the inspected
ref, e.g. a fetched refs/pull/N/head. Empty by default.
USAGE
}

Expand All @@ -78,6 +91,9 @@ if [ "$limit" -eq 0 ]; then
usage
exit 2
fi
case "$same_person_window" in
''|*[!0-9]*) echo "DCO_SAME_PERSON_WINDOW must be a non-negative integer: $same_person_window" >&2; exit 2 ;;
esac

# `ref` may be a single commit-ish (the rolling-window form used by the hourly
# monitor) or a two-dot RANGE like <before>..<after>. The range form exists for
Expand Down Expand Up @@ -114,6 +130,23 @@ case "$ref" in
;;
esac

# The history searched for same-person evidence is the inspected branch
# itself (the tip of a range, or the ref), plus any refs the operator fetched
# on purpose. In CI only the protected branch is checked out, so the default
# is exactly the branch's own history and nothing a PR could smuggle in.
case "$ref" in
*..*) evidence_tip="${ref##*..}" ;;
*) evidence_tip="$ref" ;;
esac
evidence_refs="$evidence_tip"
for extra_ref in $same_person_extra_refs; do
if ! git rev-parse --verify --quiet "${extra_ref}^{commit}" >/dev/null; then
echo "DCO_SAME_PERSON_EVIDENCE_REFS entry does not resolve to a commit: $extra_ref" >&2
exit 2
fi
evidence_refs="$evidence_refs $extra_ref"
done

email_allowed() {
needle=$(printf '%s' "$1" | lower)
[ -n "$needle" ] || return 1
Expand Down Expand Up @@ -193,7 +226,84 @@ extract_signoff_emails() {
}'
}

# same_person_noreply_evidence <sha> <author-name> <author-email-lc> <signoff-email-lc>
#
# GitHub's squash merge writes the PR author's GitHub identity on the landing
# commit. For an account with a private email that is
# `<id>+<login>@users.noreply.github.com`, while the Signed-off-by carried over
# from the branch is the contributor's real address — the one the pre-merge DCO
# app already accepted on the branch commits (#15401, 687c3cb0). The two
# addresses belong to one person, but the trailer alone cannot show it.
#
# This looks for LOCAL evidence of the link, with no GitHub API call, in the
# last DCO_SAME_PERSON_WINDOW commits reachable from the inspected branch (and
# any DCO_SAME_PERSON_EVIDENCE_REFS). Accepts when another commit:
#
# authored-under-signoff-email was authored or committed under the sign-off
# address by the same name (case-insensitive) as
# this commit's author — the person has written
# to this repository under that address before;
# login-and-email-cooccur has the sign-off address as author/committer
# AND names <login>'s noreply address in its own
# identities or Signed-off-by lines — the two
# identities are tied together on a commit that
# passed in the opposite orientation.
#
# A commit of the SAME shape as the one under test (noreply author, foreign
# sign-off) is deliberately not evidence: repetition of the ambiguity is not a
# resolution of it. Prints the evidence as `<kind>:<short-sha>` on success.
same_person_noreply_evidence() {
sp_sha="$1"
sp_author_name_lc=$(printf '%s' "$2" | lower)
sp_author_lc="$3"
sp_signoff_lc="$4"

[ "$same_person_window" -gt 0 ] || return 1
sp_login=$(github_noreply_login "$sp_author_lc") || return 1
# A noreply sign-off is the login-lookup path's business, not this one's.
case "$sp_signoff_lc" in
*@users.noreply.github.com) return 1 ;;
esac
[ -n "$sp_author_name_lc" ] || return 1

# shellcheck disable=SC2086 # evidence_refs is a deliberate word list
while IFS=$'\x1f' read -r ev_sha ev_an ev_ae ev_cn ev_ce; do
[ -n "$ev_sha" ] || continue
[ "$ev_sha" != "$sp_sha" ] || continue
ev_ae_lc=$(printf '%s' "$ev_ae" | lower)
ev_ce_lc=$(printf '%s' "$ev_ce" | lower)
ev_an_lc=$(printf '%s' "$ev_an" | lower)
ev_cn_lc=$(printf '%s' "$ev_cn" | lower)

if { [ "$ev_ae_lc" = "$sp_signoff_lc" ] && [ "$ev_an_lc" = "$sp_author_name_lc" ]; } ||
{ [ "$ev_ce_lc" = "$sp_signoff_lc" ] && [ "$ev_cn_lc" = "$sp_author_name_lc" ]; }; then
printf 'authored-under-signoff-email:%s' "$(git rev-parse --short "$ev_sha")"
return 0
fi

if [ "$ev_ae_lc" = "$sp_signoff_lc" ] || [ "$ev_ce_lc" = "$sp_signoff_lc" ]; then
if github_noreply_matches_login "$ev_ae_lc" "$sp_login" ||
github_noreply_matches_login "$ev_ce_lc" "$sp_login"; then
printf 'login-and-email-cooccur:%s' "$(git rev-parse --short "$ev_sha")"
return 0
fi
while IFS= read -r ev_signoff; do
[ -n "$ev_signoff" ] || continue
if github_noreply_matches_login "$ev_signoff" "$sp_login"; then
printf 'login-and-email-cooccur:%s' "$(git rev-parse --short "$ev_sha")"
return 0
fi
done <<EOF_EV_SIGNOFFS
$(extract_signoff_emails "$ev_sha")
EOF_EV_SIGNOFFS
fi
done < <(git log -n "$same_person_window" --format=$'%H\x1f%an\x1f%ae\x1f%cn\x1f%ce' $evidence_refs --)
return 1
}

failures=""
same_person_report=""
same_person_count=0
waived_report=""
waived_count=0
stale_waivers=""
Expand Down Expand Up @@ -263,6 +373,20 @@ while IFS= read -r sha; do
$signoff_emails
EOF_SIGNOFFS

if [ "$matched" -ne 1 ]; then
while IFS= read -r signoff_email; do
[ -n "$signoff_email" ] || continue
if evidence=$(same_person_noreply_evidence "$sha" "$author_name" "$author_lc" "$signoff_email"); then
matched=1
same_person_count=$((same_person_count + 1))
same_person_report="${same_person_report}same-person-noreply ${sha} author=${author_name} <${author_email}> signed-off-by=${signoff_email} evidence=${evidence}\n"
break
fi
done <<EOF_SAME_PERSON
$signoff_emails
EOF_SAME_PERSON
fi

if [ "$matched" -ne 1 ]; then
rendered=$(printf '%s' "$signoff_emails" | paste -sd, -)
record_failure "$sha" "mismatched-signoff author=${author_name} <${author_email}> signed-off-by=${rendered}"
Expand All @@ -285,8 +409,8 @@ case "$ref" in
*..*) scanned_scope='commits in' ;;
*) scanned_scope='recent commits on' ;;
esac
printf 'DCO trailer check inspected %s %s %s (%s non-merge, non-bot checked; %s merge skipped; %s bot skipped; %s waived).\n' \
"$limit" "$scanned_scope" "$ref" "$checked" "$skipped_merges" "$skipped_bots" "$waived_count"
printf 'DCO trailer check inspected %s %s %s (%s non-merge, non-bot checked; %s merge skipped; %s bot skipped; %s waived; %s same-person-noreply).\n' \
"$limit" "$scanned_scope" "$ref" "$checked" "$skipped_merges" "$skipped_bots" "$waived_count" "$same_person_count"

# Waived commits print on every run, above the failures. A disposition that
# produced no output would be an invisible hole in a compliance check; keeping
Expand All @@ -296,6 +420,13 @@ if [ -n "$waived_report" ]; then
printf '%b' "$waived_report"
fi

# Same-person acceptances are informational, never hidden: each one names the
# commit in the branch history that supplied the evidence, so a reader can
# audit the inference rather than take it on trust.
if [ -n "$same_person_report" ]; then
printf '%b' "$same_person_report"
fi

# Stale waivers are advisory, not fatal: failing the monitor over config
# housekeeping would page the same people this change is trying to stop paging.
if [ -n "${stale_waivers:-}" ]; then
Expand Down
28 changes: 28 additions & 0 deletions src/scripts/lib-dco-identity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,34 @@ author_login_for_commit() {
github_api_author_login "$sha_arg" || true
}

# Print the GitHub login encoded in a noreply address: both the plain
# `login@users.noreply.github.com` and the numeric
# `<id>+login@users.noreply.github.com` forms. Prints nothing and returns 1 for
# any other address. The login is a STRUCTURAL fact of the address (GitHub
# mints these itself), which is what lets a checker reason about it offline.
github_noreply_login() {
email_lc=$(printf '%s' "$1" | lower)
suffix='@users.noreply.github.com'
case "$email_lc" in
*"$suffix") ;;
*) return 1 ;;
esac
local_part=${email_lc%"$suffix"}
[ -n "$local_part" ] || return 1
case "$local_part" in
*+*)
id_part=${local_part%%+*}
login_part=${local_part#*+}
case "$id_part" in
''|*[!0-9]*) return 1 ;;
esac
[ -n "$login_part" ] || return 1
printf '%s' "$login_part"
;;
*) printf '%s' "$local_part" ;;
esac
}

# Is $1 (a lower-cased email) the GitHub noreply address for login $2?
# Accepts both `login@users.noreply.github.com` and the numeric
# `<id>+login@users.noreply.github.com` form.
Expand Down
Loading
Loading