eBPF-based security platform
ci: require full names in the DCO check
Daniel Borkmanne54109237bae
diff --git a/.agents/skills/pre-submit/SKILL.md b/.agents/skills/pre-submit/SKILL.mdindex d1ec9e94..a43b50e5 100644--- a/.agents/skills/pre-submit/SKILL.md+++ b/.agents/skills/pre-submit/SKILL.md@@ -44,7 +44,8 @@ C each commit touches and over its message, with the userspaceexceptions the script lists, and refuses the netdev block-commentopener. `check-dco.sh` wants a one-line subject, a body beyond the tagsand the author's sign-off from a real address; a noreply address or a-`[bot]` is refused as author, signer or co-developer. An agent never+`[bot]` is refused as author, signer or co-developer, and so is a name+that is not a given name and a surname, capitalized. An agent neveradds a sign-off, so it fails until the person who submits the seriessigns off.diff --git a/.github/scripts/check-dco.sh b/.github/scripts/check-dco.shindex 73954c3e..f6a9b88b 100755--- a/.github/scripts/check-dco.sh+++ b/.github/scripts/check-dco.sh@@ -8,7 +8,8 @@# Signed-off-by of its author, the Developer's Certificate of Origin, from# an identity a person answers at: a noreply address or a bot is no# identity, as author, signer or co-developer, except for Dependabot's-# canonical author and sign-off identity. Merge commits are skipped.+# canonical author and sign-off identity, and neither is a handle or a+# given name alone. Merge commits are skipped.## .github/scripts/check-dco.sh [<rev-list arguments>]#@@ -56,6 +57,28 @@ dependabot_signoff() {[ "$(lower "$1")" = 'dependabot[bot] <[email protected]>' ]}+# The bytes outside ASCII, which the check takes for letters: no locale+# tells the letters of every script apart, so it reads ASCII alone.+high=$(printf '\200-\377')+full="(a given name and a surname, capitalized, in letters)"++# A known identity names the person: two words or more, a given name+# and a surname, made of letters, with a hyphen, an apostrophe or a+# period inside. The first word and the last carry a capital, so a name+# keeps its particles but not a handle in lowercase. A name in a script+# without case, as Chinese is written, can be one word.+full_name() {+ printf '%s\n' "$1" | LC_ALL=C grep -Eq "^[A-Za-z .'$high-]+\$" ||+ return 1+ # shellcheck disable=SC2086 # one word per line, no glob left to expand+ words=$(printf '%s\n' $1)+ printf '%s\n' "$words" | LC_ALL=C grep -vq "[A-Za-z$high]" &&+ return 1+ printf '%s\n' "$1" | LC_ALL=C grep -q '[A-Za-z]' || return 0+ [ "$(printf '%s\n' "$words" | LC_ALL=C grep -c .)" -ge 2 ] || return 1+ ! printf '%s\n' "$words" | sed -n '1p; $p' | LC_ALL=C grep -q '^[a-z][^A-Z]*$'+}+commits=$(git rev-list --no-merges "$@")for commit in $commits; do@@ -72,6 +95,11 @@ for commit in $commits; dobad=$((bad + 1))continuefi+ if ! dependabot_identity "$author" && ! full_name "${author% <*}"; then+ report "$id: the author is not named in full $full: $author"+ bad=$((bad + 1))+ continue+ fi# The subject is the first paragraph and one line; the body follows# the blank line after it, and tag lines alone do not make one.@@ -127,6 +155,8 @@ for commit in $commits; doelif impersonal "$value" &&{ ! dependabot_identity "$author" || ! dependabot_signoff "$value"; }; thenproblem="a noreply or bot identity cannot certify the DCO: $line"+ elif ! dependabot_signoff "$value" && ! full_name "${value% <*}"; then+ problem="a sign-off is not a full name $full: $line"fidone <<EOT$signoffs@@ -135,10 +165,16 @@ EOT# A co-developer is an author too.if [ -z "$problem" ] && [ -n "$codevs" ]; thenwhile IFS= read -r line; do- if impersonal "${line#*:}"; then+ value=$(printf '%s' "${line#*:}" |+ sed 's/^[[:space:]]*//; s/[[:space:]]*$//')+ if impersonal "$value"; thenproblem="a noreply or bot identity cannot be a co-developer: $line"breakfi+ if ! full_name "${value% <*}"; then+ problem="a co-developer is not named in full $full: $line"+ break+ fidone <<EOT$codevsEOTdiff --git a/Documentation/contribute/code/contributing.rst b/Documentation/contribute/code/contributing.rstindex 317a0eaa..13a2f853 100644--- a/Documentation/contribute/code/contributing.rst+++ b/Documentation/contribute/code/contributing.rst@@ -125,15 +125,17 @@ If you can certify that, add::Signed-off-by: Random J Developer <[email protected]>-using a known identity. Anonymous or pseudonymous sign-offs are not-accepted, and neither is an address nobody answers at: a GitHub noreply-address, the address a coding agent writes with, or anything called-``[bot]`` is rejected as the author, in a ``Signed-off-by:`` and in a-``Co-developed-by:``. The sole exception is Dependabot's numbered-GitHub noreply author identity (the numeric prefix may vary) and-``dependabot[bot] <[email protected]>`` sign-off, which Dependabot-uses on generated commits. This is an automation exception, not a human-certification of the DCO.+using a known identity: the name you are known by, a given name and a+surname, as the author and in the sign-off alike. Anonymous or+pseudonymous sign-offs are not accepted, so a handle, a given name+alone or a name in lowercase is refused. Neither is an address nobody+answers at: a GitHub noreply address, the address a coding agent writes+with, or anything called ``[bot]`` is rejected as the author, in a+``Signed-off-by:`` and in a ``Co-developed-by:``. The sole exception is+Dependabot's numbered GitHub noreply author identity (the numeric+prefix may vary) and ``dependabot[bot] <[email protected]>`` sign-off,+which Dependabot uses on generated commits. This is an automation+exception, not a human certification of the DCO.``git commit -s`` and ``git revert -s`` add the line for you.A commit without a valid sign-off is not merged. A maintainer who@@ -153,6 +155,14 @@ merge commits:contains ``noreply``, ``no-reply`` or ``[bot]``, in any case, exceptfor Dependabot's numbered GitHub noreply author identity and``dependabot[bot] <[email protected]>`` sign-off combination.+- The author, every sign-off and every ``Co-developed-by:`` name a+ person in full: two words or more, made of letters, with a hyphen, an+ apostrophe or a period inside a word, and the first and the last word+ capitalized. ``Random J. van der Developer`` passes; ``rjdev``,+ ``Random``, ``random developer`` and ``Random Developer2`` do not. A+ name without an ASCII letter, such as one written in Chinese, can be+ one word: the check reads ASCII alone and takes every other character+ for a letter.CI runs it on every pull request and every push to ``main``, in the``DCO`` workflow.diff --git a/Documentation/contribute/code/developer-guide.rst b/Documentation/contribute/code/developer-guide.rstindex c55b0a31..9111d0ad 100644--- a/Documentation/contribute/code/developer-guide.rst+++ b/Documentation/contribute/code/developer-guide.rst@@ -468,7 +468,8 @@ the commit at ``HEAD`` alone without them.- Checks* - ``check-dco.sh <range>``- A one-line subject, a body beyond the tags and the author's- ``Signed-off-by:``. See :doc:`/contribute/code/contributing`.+ ``Signed-off-by:``, every identity a person's full name. See+ :doc:`/contribute/code/contributing`.* - ``check-style.sh <range>``- The kernel's ``checkpatch.pl`` in strict mode over the C eachcommit touches, at its default limit of 100 columns, and over itsdiff --git a/Documentation/contribute/testing/test-coverage.rst b/Documentation/contribute/testing/test-coverage.rstindex 8d40420d..f2439e5c 100644--- a/Documentation/contribute/testing/test-coverage.rst+++ b/Documentation/contribute/testing/test-coverage.rst@@ -35,7 +35,8 @@ signed config image.- Covers* - ``t0001-check-dco``- ``check-dco.sh``: subject, body and sign-off, the identities it- rejects, the author the sign-off must match, merge commits+ rejects, the full names it wants, the author the sign-off must+ match, merge commits* - ``t0002-check-spdx``- ``check-spdx.sh``: tag form by file type, the two expressions,the dual license of BPF sources and package files, vendoreddiff --git a/testing/ci-checks/t0001-check-dco.sh b/testing/ci-checks/t0001-check-dco.shindex f55b835d..704f56a2 100755--- a/testing/ci-checks/t0001-check-dco.sh+++ b/testing/ci-checks/t0001-check-dco.sh@@ -3,8 +3,9 @@# Copyright (c) 2026 Authors of shirudo## t0001 -- .github/scripts/check-dco.sh: the subject, body and sign-off every-# commit needs, the forms it rejects, the author the sign-off must come-# from and the merge commits it skips, on a throwaway repository.+# commit needs, the forms it rejects, the full names it wants, the author+# the sign-off must come from and the merge commits it skips, on a+# throwaway repository.cd "$(dirname "$0")/..". ./test-lib.sh@@ -222,6 +223,107 @@ Signed-off-by: Random J Developer <[email protected]>" &&grep -q "cannot be a co-developer: Co-developed-by: Some Agent <[email protected]>" "$W/err"'+test_expect_success 'a handle is no name' '+ commit "a: handle++Why the change is made.++Signed-off-by: rjdev <[email protected]>" \+ --author="rjdev <[email protected]>" &&+ ! check &&+ grep -q "the author is not named in full (a given name and a surname, capitalized, in letters): rjdev <[email protected]>" "$W/err"+'++test_expect_success 'a given name alone is no full name' '+ commit "a: given name++Why the change is made.++Signed-off-by: Random <[email protected]>" \+ --author="Random <[email protected]>" &&+ ! check &&+ grep -q "the author is not named in full" "$W/err"+'++test_expect_success 'a name in lowercase is a handle' '+ commit "a: lowercase++Why the change is made.++Signed-off-by: random developer <[email protected]>" \+ --author="random developer <[email protected]>" &&+ ! check &&+ grep -q "the author is not named in full" "$W/err"+'++test_expect_success 'a name with a digit is a handle' '+ commit "a: digit++Why the change is made.++Signed-off-by: Random Developer2 <[email protected]>" \+ --author="Random Developer2 <[email protected]>" &&+ ! check &&+ grep -q "the author is not named in full" "$W/err"+'++test_expect_success 'every sign-off names a person in full' '+ commit "a: maintainer handle++Why the change is made.++Signed-off-by: Random J Developer <[email protected]>+Signed-off-by: maint <[email protected]>" &&+ ! check &&+ grep -q "a sign-off is not a full name (a given name and a surname, capitalized, in letters): Signed-off-by: maint <[email protected]>" "$W/err"+'++test_expect_success 'a co-developer is named in full' '+ commit "a: co-developer handle++Why the change is made.++Co-developed-by: other <[email protected]>+Signed-off-by: Other Person <[email protected]>+Signed-off-by: Random J Developer <[email protected]>" &&+ ! check &&+ grep -q "a co-developer is not named in full (a given name and a surname, capitalized, in letters): Co-developed-by: other <[email protected]>" "$W/err"+'++test_expect_success 'particles, hyphens, apostrophes and initials make a name' '+ commit "a: particles++Why the change is made.++Co-developed-by: Jean-Random O'"'"'Other <[email protected]>+Signed-off-by: Jean-Random O'"'"'Other <[email protected]>+Signed-off-by: Random J. van der Developer <[email protected]>" \+ --author="Random J. van der Developer <[email protected]>" &&+ check+'++test_expect_success 'a name outside ASCII is a name' '+ name=$(printf "Zo\303\253 \303\205ngstr\303\266m") &&+ commit "a: accents++Why the change is made.++Signed-off-by: $name <[email protected]>" \+ --author="$name <[email protected]>" &&+ check+'++test_expect_success 'a name in a script without case can be one word' '+ name=$(printf "\347\216\213\345\260\217\346\230\216") &&+ commit "a: one word++Why the change is made.++Signed-off-by: $name <[email protected]>" \+ --author="$name <[email protected]>" &&+ check+'+test_expect_success 'an unknown range fails' '! check nonexistent..HEAD'