From 5e0c89dab4744c0b7e2f5f7d69133fe784e3d710 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 15:05:04 +0900 Subject: [PATCH 1/6] =?UTF-8?q?ci(release):=20=EC=84=9C=EB=AA=85=20?= =?UTF-8?q?=EB=B9=84=EB=B0=80=20=EA=B0=92=EC=9D=84=20=EA=B0=92=20=EC=97=86?= =?UTF-8?q?=EC=9D=B4=20=EC=A7=84=EB=8B=A8=ED=95=98=EB=8A=94=20verifySignin?= =?UTF-8?q?gKey=EB=A5=BC=20=EB=8D=94=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v1.0.0 release(run 9)가 :grpc:grpc-contract:signMavenPublication에서 「Could not read PGP secret key」로 멈췄다. 원인 사슬은 BouncyCastle의 「secret key ring doesn't start with secret key tag: tag 0x37」이다. Gradle은 키 문자열이 망가진 경우와 비밀번호가 틀린 경우를 같은 문장으로 알리고, secret은 로그에서 볼 수 없어 무엇이 틀렸는지 가릴 길이 없었다. scripts/release/check-signing-key.sh가 값을 출력하지 않고 본다: - 모양: 글자·줄 수, CR, 「\n」 문자열, 비ASCII, 앞뒤 공백 - armour: 첫 줄 BEGIN, 끝 줄 END, BEGIN 뒤 빈 줄 - base64 본문: 줄 너비, CRC24가 checksum 줄과 맞는지, 첫 패킷이 비밀 키(tag 5)인지 - gpg가 가져오는지, 가져온 키의 지문(공개 정보)이 릴리스 키인지 - SIGNING_PASSWORD로 서명되는지(성공/실패만) Gradle 태스크 verifySigningKey가 이 스크립트를 부른다. `release`는 이것에 의존하고(서명 키가 있으면 releaseRehearsal도), 모든 Sign 태스크는 그 뒤에 돈다. release.yml은 그대로 한 줄이다. 태그 없이 돌리는 수동 workflow signing-check.yml을 더했다. 릴리스 키 지문은 gradle.properties signingKeyFingerprint다. 검증(desktop, 버리는 RSA 4096 키): 정상 키 rc=0(모든 칸 yes, 서명 ok). base64 줄 하나 뺀 키·한 줄로 붙인 키·틀린 비밀번호·다른 키는 각각 rc=1과 그 원인 줄. 같은 BouncyCastle 1.81로 망가뜨린 모양별 오류를 재현했다. 줄 누락은 tag 0x1·0xc·0xf처럼 임의의 tag를 낸다. 한 줄로 붙이거나 공백· 「\n」이 섞이면 0xffffffff, 비밀번호가 틀리면 checksum mismatch다. --- .gitea/workflows/signing-check.yml | 29 ++++ .../publishing/LibraryPublishingPlugin.java | 4 + build.gradle | 19 +++ gradle.properties | 2 + scripts/release/check-signing-key.sh | 136 ++++++++++++++++++ 5 files changed, 190 insertions(+) create mode 100644 .gitea/workflows/signing-check.yml create mode 100755 scripts/release/check-signing-key.sh diff --git a/.gitea/workflows/signing-check.yml b/.gitea/workflows/signing-check.yml new file mode 100644 index 0000000..461c8ae --- /dev/null +++ b/.gitea/workflows/signing-check.yml @@ -0,0 +1,29 @@ +# Checks the release signing secrets without cutting a tag (docs/work/release.md 5절). Manual only: +# run it after the owner puts SIGNING_KEY or SIGNING_PASSWORD in, and before tagging. It prints shapes +# and verdicts, never the secrets (scripts/release/check-signing-key.sh). +name: signing-check + +on: + workflow_dispatch: + +permissions: + contents: read + +jobs: + signing-check: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: https://github.com/actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 + with: + distribution: temurin + java-version: "21.0.11+10.0.LTS" + - uses: https://github.com/gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6 + with: + build-scan-publish: false + cache-read-only: true + - run: ./gradlew verifySigningKey --stacktrace + env: + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} diff --git a/build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/LibraryPublishingPlugin.java b/build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/LibraryPublishingPlugin.java index 2f42a9e..5aac5a4 100644 --- a/build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/LibraryPublishingPlugin.java +++ b/build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/LibraryPublishingPlugin.java @@ -13,6 +13,7 @@ import org.gradle.api.publish.PublishingExtension; import org.gradle.api.publish.maven.MavenPublication; import org.gradle.api.publish.maven.tasks.PublishToMavenRepository; import org.gradle.authentication.http.HttpHeaderAuthentication; +import org.gradle.plugins.signing.Sign; import org.gradle.plugins.signing.SigningExtension; /** @@ -145,6 +146,9 @@ public final class LibraryPublishingPlugin implements Plugin { SigningExtension signing = project.getExtensions().getByType(SigningExtension.class); signing.useInMemoryPgpKeys(signingKey, signingPassword); signing.sign(publication); + // The root's verifySigningKey says what is wrong with a key before Gradle's signing reports + // it only as "Could not read PGP secret key". + project.getTasks().withType(Sign.class).configureEach(task -> task.mustRunAfter(":verifySigningKey")); } // Nothing leaves the machine before the release checks have passed, and nothing reaches Gitea diff --git a/build.gradle b/build.gradle index fd71d64..70020c3 100644 --- a/build.gradle +++ b/build.gradle @@ -191,6 +191,21 @@ publishing { } def signingKey = providers.environmentVariable('SIGNING_KEY').getOrElse('') + +// Before anything is signed: the secret's shape, that gpg imports it as the release key and that +// SIGNING_PASSWORD signs with it, printing no part of either. Gradle's signing reports every one of +// these as "Could not read PGP secret key" (v1.0.0 release run 9); this says which. A key other +// than the release key passes with -PsigningKeyFingerprint= (a rehearsal key). +tasks.register('verifySigningKey', Exec) { + group = 'verification' + description = 'Checks SIGNING_KEY and SIGNING_PASSWORD without printing them (scripts/release/check-signing-key.sh).' + outputs.upToDateWhen { false } + commandLine 'bash', file('scripts/release/check-signing-key.sh'), + providers.gradleProperty('signingKeyFingerprint').getOrElse('') +} +tasks.withType(Sign).configureEach { + mustRunAfter tasks.named('verifySigningKey') +} if (!signingKey.isBlank()) { signing { useInMemoryPgpKeys(signingKey, providers.environmentVariable('SIGNING_PASSWORD').getOrElse('')) @@ -220,6 +235,9 @@ tasks.register('releaseRehearsal') { group = 'release' description = 'releaseCheck, then publishes every module and the SBOM to build/staging-repository and checks the files.' dependsOn tasks.named('releaseCheck') + if (!signingKey.isBlank()) { + dependsOn tasks.named('verifySigningKey') + } dependsOn tasks.named('publishAllPublicationsToStagingRepository') dependsOn leafPaths.collect { "${it}:publishAllPublicationsToStagingRepository" } def staging = layout.buildDirectory.dir('staging-repository') @@ -244,6 +262,7 @@ tasks.register('release') { group = 'release' description = 'releaseCheck, publish to Gitea Packages, then verify the version is readable anonymously.' dependsOn tasks.named('releaseCheck') + dependsOn tasks.named('verifySigningKey') dependsOn tasks.named('publishAllPublicationsToGiteaRepository') dependsOn leafPaths.collect { "${it}:publishAllPublicationsToGiteaRepository" } def url = providers.gradleProperty('packagesUrl') diff --git a/gradle.properties b/gradle.properties index c391713..764f198 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,8 @@ libraryGroup=dev.cakit.grpc packagesUrl=https://git.learn.hyeonworks.com/api/packages/donghyeon.kang/maven repositoryUrl=https://git.learn.hyeonworks.com/donghyeon.kang/grpc-library +# The release signing key (public fingerprint). verifySigningKey refuses any other key in SIGNING_KEY. +signingKeyFingerprint=92646CEAFE816CF8B9C249F0A1C936D7F791F8AB # Build defaults, copied from the backend template's src/gradle.properties. org.gradle.workers.max=4 diff --git a/scripts/release/check-signing-key.sh b/scripts/release/check-signing-key.sh new file mode 100755 index 0000000..03988d7 --- /dev/null +++ b/scripts/release/check-signing-key.sh @@ -0,0 +1,136 @@ +#!/usr/bin/env bash +# Checks the release signing secrets before anything is signed, without printing them. +# +# scripts/release/check-signing-key.sh [expected fingerprint] +# +# Reads SIGNING_KEY (an ASCII-armoured PGP secret key) and SIGNING_PASSWORD from the environment and +# prints only shapes and verdicts: line and character counts, whether the armour lines and the blank +# line after BEGIN are where OpenPGP puts them, whether the base64 body decodes and its CRC24 matches, +# the first packet's tag, whether gpg imports it, the imported key's fingerprint (public), and whether +# SIGNING_PASSWORD signs with it. No value, line or fragment of either secret is ever printed; do not +# add `set -x` here. +# +# Why it exists: Gradle's signing reports any of these problems as one "Could not read PGP secret +# key", and the cause sits in a secret nobody can look at in the job log (v1.0.0 release run 9). +# Exit codes: 0 = the key would sign, 1 = a check failed (the line says which), 2 = usage. +set -euo pipefail + +expected=${1:-} +fail=0 + +if [ -z "${SIGNING_KEY:-}" ]; then + echo "check-signing-key: SIGNING_KEY is empty or not set" + exit 1 +fi +[ -n "${SIGNING_PASSWORD:-}" ] || echo "check-signing-key: SIGNING_PASSWORD is empty (only right for a key without a passphrase)" + +python3 - <<'PY' || fail=1 +import base64, os, re, sys + +key = os.environ["SIGNING_KEY"] +BEGIN = "-----BEGIN PGP PRIVATE KEY BLOCK-----" +END = "-----END PGP PRIVATE KEY BLOCK-----" +problems = [] + +print(f"shape: {len(key)} characters, {key.count(chr(10)) + 1} lines," + f" CR {'present' if chr(13) in key else 'absent'}," + f" literal backslash-n sequences {key.count(chr(92) + 'n')}," + f" non-ASCII characters {sum(1 for c in key if ord(c) > 127)}," + f" leading whitespace {'yes' if key[:1].isspace() else 'no'}," + f" trailing whitespace {'yes' if key[-1:].isspace() else 'no'}") + +lines = key.replace("\r\n", "\n").replace("\r", "\n").split("\n") +while lines and lines[-1].strip() == "": + lines.pop() +if "\n" not in key.replace("\r", "\n"): + problems.append("the value is one line: the newlines were lost (paste the file as is, with its line breaks)") +first = lines[0].strip() if lines else "" +last = lines[-1].strip() if lines else "" +print(f"armour: first line is BEGIN {'yes' if first == BEGIN else 'no'}, last line is END {'yes' if last == END else 'no'}") +if first != BEGIN: + kind = "a PUBLIC key block" if "PUBLIC KEY BLOCK" in first else "something else" + problems.append(f"the value does not start with the BEGIN PGP PRIVATE KEY BLOCK line (it starts with {kind})") +if last != END: + problems.append("the value does not end with the END PGP PRIVATE KEY BLOCK line (cut short?)") + +body = lines[1:-1] if first == BEGIN and last == END else lines +headers = [] +while body and ":" in body[0] and body[0].strip(): + headers.append(body.pop(0)) +blank_after = bool(body) and body[0].strip() == "" +print(f"armour headers: {len(headers)}, blank line after them {'yes' if blank_after else 'no'}") +if not blank_after: + problems.append("no blank line between the BEGIN line (and its headers) and the base64 body") +data = [l.strip() for l in body if l.strip()] +checksum = data.pop() if data and data[-1].startswith("=") else None +lengths = [len(l) for l in data] +full = sum(1 for n in lengths[:-1] if n == lengths[0]) if lengths else 0 +print(f"body: {len(data)} base64 lines, first {lengths[0] if lengths else 0} characters wide," + f" {full + (1 if lengths else 0)} of {len(data)} lines that width or the last," + f" checksum line {'present' if checksum else 'absent'}") +if lengths and any(n != lengths[0] for n in lengths[:-1]): + problems.append("base64 lines of different widths before the last one (lines joined, split or cut)") +joined = "".join(data) +bad = sum(1 for c in joined if not re.match(r"[A-Za-z0-9+/=]", c)) +if bad: + problems.append(f"{bad} characters outside the base64 alphabet in the body") +try: + raw = base64.b64decode(joined, validate=False) +except Exception as error: + raw = b"" + problems.append(f"the body does not decode as base64 ({type(error).__name__})") +if raw: + def crc24(data): + crc = 0xB704CE + for byte in data: + crc ^= byte << 16 + for _ in range(8): + crc <<= 1 + if crc & 0x1000000: + crc ^= 0x1864CFB + return crc & 0xFFFFFF + if checksum: + try: + stated = int.from_bytes(base64.b64decode(checksum[1:]), "big") + match = stated == crc24(raw) + except Exception: + match = False + print(f"CRC24 of the decoded body matches the checksum line: {'yes' if match else 'no'}") + if not match: + problems.append("the CRC24 checksum does not match: the base64 body was changed (a line lost, added or edited)") + header = raw[0] + tag = (header & 0x3F) if header & 0x40 else ((header & 0x3C) >> 2) + names = {5: "secret key", 6: "public key", 7: "secret subkey"} + print(f"first packet: tag {tag} ({names.get(tag, 'not a key packet')}), {len(raw)} bytes decoded") + if not header & 0x80 or tag != 5: + problems.append("the first packet is not a secret key packet (tag 5)") + +for problem in problems: + print(f"PROBLEM: {problem}") +sys.exit(1 if problems else 0) +PY + +home=$(mktemp -d) +trap 'rm -rf "$home"' EXIT +chmod 700 "$home" +if printf '%s\n' "$SIGNING_KEY" | GNUPGHOME="$home" gpg --batch --quiet --import >/dev/null 2>&1; then + fingerprint=$(GNUPGHOME="$home" gpg --batch --with-colons --list-secret-keys 2>/dev/null | awk -F: '/^fpr/{print $10; exit}') + echo "gpg import: ok, secret key fingerprint ${fingerprint:-none}" + if [ -n "$expected" ] && [ "${fingerprint:-}" != "$expected" ]; then + echo "PROBLEM: the imported key is not the release key ${expected}" + fail=1 + fi + printf 'signing check\n' > "$home/message" + if printf '%s' "${SIGNING_PASSWORD:-}" | GNUPGHOME="$home" gpg --batch --pinentry-mode loopback \ + --passphrase-fd 0 --local-user "${fingerprint:-none}" --detach-sign --output "$home/message.sig" \ + "$home/message" >/dev/null 2>&1; then + echo "signing with SIGNING_PASSWORD: ok" + else + echo "PROBLEM: SIGNING_PASSWORD does not unlock the key for signing (wrong passphrase, or the key is not a signing key)" + fail=1 + fi +else + echo "PROBLEM: gpg cannot import SIGNING_KEY" + fail=1 +fi +exit "$fail" From 732cb26eb5c98cfabfe2122f88ce6d3db265cc36 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 15:07:06 +0900 Subject: [PATCH 2/6] =?UTF-8?q?fix(release):=20SIGNING=5FKEY=EC=97=90=20?= =?UTF-8?q?=EC=A7=80=EB=AC=B8=EC=9D=B4=20=EB=93=A4=EC=96=B4=EA=B0=84=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=EB=A5=BC=20=EC=9D=B4=EB=A6=84=20=EB=8C=80?= =?UTF-8?q?=EA=B3=A0=20=EB=84=A3=EB=8A=94=20=EB=B2=95=EC=9D=84=20=EC=A0=81?= =?UTF-8?q?=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit signing-check(run 10)로 v1.0.0 서명 실패의 원인을 찾았다. SIGNING_KEY secret은 40글자 한 줄이었고 BEGIN·END 줄이 없었다. base64로 읽으면 30바이트, 첫 패킷 tag 55(0x37)였다. 16진수 40글자 지문 `92…`를 base64로 읽으면 첫 바이트가 0xF7, 곧 tag 0x37이다. 비밀 키 대신 키 지문이 들어갔다. - check-signing-key.sh: 값이 16진수 8·16·40글자(키 ID·지문)면 그렇다고 말한다. 릴리스 키 지문과 같으면 그것도 말한다(공개 정보만 비교한다). - release.md 1절: SIGNING_KEY에 넣을 것(export 파일 전체, 줄바꿈 그대로), 넣는 곳, signing-check로 확인하는 법. 3절: 비밀 값을 바꾼 뒤 첫 태그 전에 signing-check. 5절: 서명 실패 행. 아무것도 게시되지 않았으면 태그를 고친 커밋으로 옮겨 같은 버전을 쓴다는 규칙(총괄 결정과 같게). 검증: 지문 40글자를 넣은 경우 rc=1과 「key ID or fingerprint (the release key's fingerprint)」. 앞 커밋의 시험 다섯은 그대로 통과한다. --- docs/work/release.md | 16 ++++++++++++++-- scripts/release/check-signing-key.sh | 10 +++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/work/release.md b/docs/work/release.md index 1f25dd0..ab041cc 100644 --- a/docs/work/release.md +++ b/docs/work/release.md @@ -27,6 +27,17 @@ main 병합 ──> 소유자가 태그 vX.Y.Z push ──> .gitea/workflows/rel - 서명 키: RSA 4096, 지문 `92646CEAFE816CF8B9C249F0A1C936D7F791F8AB`, 2028-11-07 만료. 공개 키는 README 「서명」이다. - 첫 태그는 `v1.0.0`이다(3절). +**`SIGNING_KEY`에 넣는 것**은 키 지문이나 키 ID(16진수 40·16·8글자)가 아니라 비밀 키 파일 전체다. + +```bash +gpg --armor --export-secret-keys 92646CEAFE816CF8B9C249F0A1C936D7F791F8AB > signing-key.asc +``` + +1. `signing-key.asc`를 열어 첫 줄 `-----BEGIN PGP PRIVATE KEY BLOCK-----`부터 끝 줄 `-----END PGP PRIVATE KEY BLOCK-----`까지 줄바꿈 그대로 복사한다. RSA 4096 키면 100줄 남짓이다. +2. Gitea → 그 repo(grpc-library, messaging-library 둘 다) → 설정 → Actions → Secrets → `SIGNING_KEY`를 고쳐 붙여 넣는다. +3. Actions → `signing-check` → Run workflow(main). 로그에 `PROBLEM` 줄이 없고 `gpg import: ok, secret key fingerprint 92646CEA…F791F8AB`, `signing with SIGNING_PASSWORD: ok`가 나오면 된다. 이 workflow는 값을 출력하지 않는다(`scripts/release/check-signing-key.sh`). +4. `signing-key.asc`를 지운다(`shred -u signing-key.asc`). + ## 2. 버전 규칙 - SemVer, repo 하나에 버전 하나. 모든 모듈이 같은 버전으로 나간다. 태그는 `vMAJOR.MINOR.PATCH`이고 접미사(`-rc.1` 등)는 없다. 다른 모양의 태그는 `ca.java-conventions`가 빌드 전에 거부한다. @@ -39,7 +50,7 @@ main 병합 ──> 소유자가 태그 vX.Y.Z push ──> .gitea/workflows/rel 1. main이 초록인지 본다(main.yml 마지막 실행). 2. `CHANGELOG.md`에 그 버전 절을 쓰고 PR로 병합한다. -3. 올리기 전까지를 desktop에서 미리 돌려 본다(비밀 값 없이, 4절). +3. 올리기 전까지를 desktop에서 미리 돌려 본다(비밀 값 없이, 4절). 비밀 값을 넣거나 바꾼 뒤 첫 태그라면 `signing-check` workflow도 한 번 돌린다(1절). 4. 태그를 단다. ```bash @@ -65,7 +76,8 @@ scripts/verify.sh release --on desktop | 어디서 | 뜻 | 할 일 | | --- | --- | --- | -| 1~4단계 | 아무것도 올라가지 않았다 | 고쳐서 main에 병합하고 같은 태그 이름을 새 커밋에 다시 달지 않는다. 다음 PATCH 태그를 쓴다 | +| 1~4단계, 서명 | 아무것도 올라가지 않았다 | 고쳐서 main에 병합한다. 그 버전의 파일이 Packages에 하나도 없으면(`maven-metadata.xml`에 없음) 태그를 지우고 고친 main 커밋에 같은 태그를 다시 단다. 하나라도 올라갔으면 다음 PATCH를 쓴다 | +| 서명 직전 `verifySigningKey`, 또는 `Could not read PGP secret key` | 서명 비밀 값이 키로 읽히지 않는다 | `signing-check` workflow의 `PROBLEM` 줄이 원인이다(지문을 넣음, 줄바꿈 잃음, BEGIN·END 줄 빠짐, base64 손상, 다른 키, 틀린 암호). 1절대로 다시 넣는다 | | 5단계 중간 | 일부 모듈만 올라갔을 수 있다 | 그 버전은 버린다(지우지 않는다). 원인을 고치고 다음 PATCH를 낸다. `CHANGELOG.md`에 버린 버전을 적는다 | | 6단계 | 올라갔지만 익명으로 안 읽힌다 | owner 공개 설정을 확인한다. 템플릿 이미지 빌드가 토큰 없이 읽는다는 전제(설계 8.3절 R1)가 깨진 것이다 | diff --git a/scripts/release/check-signing-key.sh b/scripts/release/check-signing-key.sh index 03988d7..6fef35d 100755 --- a/scripts/release/check-signing-key.sh +++ b/scripts/release/check-signing-key.sh @@ -24,7 +24,7 @@ if [ -z "${SIGNING_KEY:-}" ]; then fi [ -n "${SIGNING_PASSWORD:-}" ] || echo "check-signing-key: SIGNING_PASSWORD is empty (only right for a key without a passphrase)" -python3 - <<'PY' || fail=1 +EXPECTED_FINGERPRINT=$expected python3 - <<'PY' || fail=1 import base64, os, re, sys key = os.environ["SIGNING_KEY"] @@ -39,6 +39,14 @@ print(f"shape: {len(key)} characters, {key.count(chr(10)) + 1} lines," f" leading whitespace {'yes' if key[:1].isspace() else 'no'}," f" trailing whitespace {'yes' if key[-1:].isspace() else 'no'}") +stripped = key.strip() +if re.fullmatch(r"(0x)?[0-9A-Fa-f]{8}|(0x)?[0-9A-Fa-f]{16}|[0-9A-Fa-f]{40}", stripped): + expected = os.environ.get("EXPECTED_FINGERPRINT", "") + same = " (the release key's fingerprint)" if expected and stripped.upper() == expected.upper() else "" + print(f"PROBLEM: SIGNING_KEY holds a {len(stripped)}-hex-digit key ID or fingerprint{same}, not the key." + " Put in the output of `gpg --armor --export-secret-keys ` instead, BEGIN to END lines.") + sys.exit(1) + lines = key.replace("\r\n", "\n").replace("\r", "\n").split("\n") while lines and lines[-1].strip() == "": lines.pop() From 97f7381aaeb55fa8bf5455941e96a351ebcea8cf Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 15:14:28 +0900 Subject: [PATCH 3/6] =?UTF-8?q?fix(release):=20base64=EB=A1=9C=20=EA=B0=90?= =?UTF-8?q?=EC=8B=BC=20armored=20=EC=84=9C=EB=AA=85=20=ED=82=A4=EB=8F=84?= =?UTF-8?q?=20=EB=B0=9B=EB=8A=94=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 진단을 다시 돌리자(signing-check run 11) SIGNING_KEY가 바뀌어 있었다. 4,632글자 한 줄, base64로 읽으면 3,474바이트이고 그 첫 바이트가 `-`였다. 곧 armored 키 파일을 base64로 한 줄에 감싼 값이다(CI secret에 여러 줄 값을 넣을 때 흔히 쓰는 방법). Gradle의 useInMemoryPgpKeys는 armored 글만 읽어서 이 값도 「Could not read PGP secret key」로 실패한다. build-logic SigningKeys.armoured가 값을 받아, armored 블록을 base64로 감싼 것이면 풀어서 돌려준다. 그 밖의 값은 그대로 돌려줘 원래 오류로 실패하게 한다. 모듈 서명(LibraryPublishingPlugin)과 SBOM 서명(루트 build.gradle)이 이것을 거친다. check-signing-key.sh도 같은 규칙으로 풀어 본다. 「form: base64 of an armoured key file」을 알리고 풀린 글로 나머지를 검사한다. 키는 gpg에 환경 변수 대신 임시 폴더(0700, 끝나면 지움)의 파일로 넘긴다. 버린 대안: 소유자에게 여러 줄로 다시 넣게 하기. 지금 값도 키로는 맞을 수 있고, base64 한 줄은 secret 저장소가 여러 줄을 망가뜨릴 때의 표준 우회다. 검증(desktop, 버리는 RSA 4096 키): - SigningKeysTest: 클래스가 없어 컴파일 실패(RED) → 통과(GREEN) - check-signing-key.sh: armored·base64 둘 다 rc=0, base64 + 틀린 암호 rc=1, 지문 rc=1 - base64 키로 서명 리허설: rc=0, 서명된 artifact 10개, gpg --verify Good signature --- .../publishing/LibraryPublishingPlugin.java | 6 ++- .../buildlogic/publishing/SigningKeys.java | 42 +++++++++++++++++++ .../publishing/SigningKeysTest.java | 41 ++++++++++++++++++ build.gradle | 4 +- docs/work/release.md | 2 +- scripts/release/check-signing-key.sh | 24 ++++++++--- 6 files changed, 110 insertions(+), 9 deletions(-) create mode 100644 build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/SigningKeys.java create mode 100644 build-logic/src/test/java/dev/caskeleton/buildlogic/publishing/SigningKeysTest.java diff --git a/build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/LibraryPublishingPlugin.java b/build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/LibraryPublishingPlugin.java index 5aac5a4..92a9e19 100644 --- a/build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/LibraryPublishingPlugin.java +++ b/build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/LibraryPublishingPlugin.java @@ -37,7 +37,8 @@ import org.gradle.plugins.signing.SigningExtension; * the versions its own resolution chose ({@code versionMapping}), and the plugin's POM * customization, which would add the BOM imports a consumer never inherits, is off. * - *

Signing: with {@code SIGNING_KEY} (an ASCII-armoured PGP secret key) and {@code + *

Signing: with {@code SIGNING_KEY} (an ASCII-armoured PGP secret key, or the base64 of one; + * {@link SigningKeys}) and {@code * SIGNING_PASSWORD} in the environment, every published file gets an {@code .asc}. Without them * nothing is signed, and a task that uploads to {@code gitea} fails before it starts: an unsigned * release is not a release. @@ -138,7 +139,8 @@ public final class LibraryPublishingPlugin implements Plugin { .dir("staging-repository")); }); - String signingKey = project.getProviders().environmentVariable("SIGNING_KEY").getOrElse(""); + String signingKey = + SigningKeys.armoured(project.getProviders().environmentVariable("SIGNING_KEY").getOrElse("")); String signingPassword = project.getProviders().environmentVariable("SIGNING_PASSWORD").getOrElse(""); boolean signed = !signingKey.isBlank(); diff --git a/build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/SigningKeys.java b/build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/SigningKeys.java new file mode 100644 index 0000000..2996b87 --- /dev/null +++ b/build-logic/src/main/java/dev/caskeleton/buildlogic/publishing/SigningKeys.java @@ -0,0 +1,42 @@ +package dev.caskeleton.buildlogic.publishing; + +import java.nio.charset.StandardCharsets; +import java.util.Base64; + +/** + * The ASCII-armoured key Gradle's in-memory signatory reads, from what a CI secret holds. + * + *

A secret store keeps a multi-line value badly or not at all, so the common practice is to put + * the armoured key file in base64 on one line ({@code base64 -w0 signing-key.asc}). Gradle's {@code + * useInMemoryPgpKeys} reads only the armoured text and reports the base64 form as "Could not read + * PGP secret key" (v1.0.0 release run 9 and the secret put in after it). Both forms are accepted: + * a value that decodes to an armoured private key block is unwrapped, anything else is passed on + * unchanged, so a wrong value still fails, and {@code verifySigningKey} says why. + */ +public final class SigningKeys { + private static final String BEGIN = "-----BEGIN PGP PRIVATE KEY BLOCK-----"; + + private SigningKeys() {} + + /** + * The armoured key: {@code value} itself, or the armoured block it is the base64 of. + * + * @param value the secret as given (armoured, base64 of the armoured file, or anything else) + * @return the armoured key, or {@code value} unchanged when it is neither form + */ + public static String armoured(String value) { + if (value == null || value.isBlank() || value.contains(BEGIN)) { + return value; + } + String compact = value.replaceAll("\\s", ""); + if (!compact.matches("[A-Za-z0-9+/]+={0,2}")) { + return value; + } + try { + String decoded = new String(Base64.getDecoder().decode(compact), StandardCharsets.UTF_8); + return decoded.strip().startsWith(BEGIN) ? decoded : value; + } catch (IllegalArgumentException notBase64) { + return value; + } + } +} diff --git a/build-logic/src/test/java/dev/caskeleton/buildlogic/publishing/SigningKeysTest.java b/build-logic/src/test/java/dev/caskeleton/buildlogic/publishing/SigningKeysTest.java new file mode 100644 index 0000000..9be7ffd --- /dev/null +++ b/build-logic/src/test/java/dev/caskeleton/buildlogic/publishing/SigningKeysTest.java @@ -0,0 +1,41 @@ +package dev.caskeleton.buildlogic.publishing; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +class SigningKeysTest { + private static final String ARMOURED = + "-----BEGIN PGP PRIVATE KEY BLOCK-----\n\nlQdGBGrv1SYBEADGgq8C\n=abcd\n" + + "-----END PGP PRIVATE KEY BLOCK-----\n"; + + @Test + @DisplayName("armour 그대로인 키는 바꾸지 않는다") + void anArmouredKeyIsUsedAsItIs() { + assertThat(SigningKeys.armoured(ARMOURED)).isEqualTo(ARMOURED); + } + + @Test + @DisplayName("armour 파일을 base64로 감싼 값은 풀어서 armour로 쓴다") + void aBase64WrappedArmouredKeyIsUnwrapped() { + String wrapped = Base64.getEncoder().encodeToString(ARMOURED.getBytes(StandardCharsets.UTF_8)); + + assertThat(SigningKeys.armoured(wrapped)).isEqualTo(ARMOURED); + assertThat(SigningKeys.armoured(wrapped.substring(0, 40) + "\n" + wrapped.substring(40))) + .isEqualTo(ARMOURED); + } + + @Test + @DisplayName("지문이나 armour가 아닌 base64는 그대로 두어 서명이 원래 오류로 실패하게 한다") + void anythingElseIsLeftAlone() { + String fingerprint = "92646CEAFE816CF8B9C249F0A1C936D7F791F8AB"; + String otherBase64 = Base64.getEncoder().encodeToString("not a key".getBytes(StandardCharsets.UTF_8)); + + assertThat(SigningKeys.armoured(fingerprint)).isEqualTo(fingerprint); + assertThat(SigningKeys.armoured(otherBase64)).isEqualTo(otherBase64); + assertThat(SigningKeys.armoured("")).isEmpty(); + } +} diff --git a/build.gradle b/build.gradle index 70020c3..021e0eb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ import dev.caskeleton.buildlogic.java.JavaConventionsPlugin +import dev.caskeleton.buildlogic.publishing.SigningKeys plugins { id 'ca.architecture' @@ -190,7 +191,8 @@ publishing { } } -def signingKey = providers.environmentVariable('SIGNING_KEY').getOrElse('') +// The armoured key, or the base64 of the armoured file (the usual way to keep it in a CI secret). +def signingKey = SigningKeys.armoured(providers.environmentVariable('SIGNING_KEY').getOrElse('')) // Before anything is signed: the secret's shape, that gpg imports it as the release key and that // SIGNING_PASSWORD signs with it, printing no part of either. Gradle's signing reports every one of diff --git a/docs/work/release.md b/docs/work/release.md index ab041cc..2f33f64 100644 --- a/docs/work/release.md +++ b/docs/work/release.md @@ -27,7 +27,7 @@ main 병합 ──> 소유자가 태그 vX.Y.Z push ──> .gitea/workflows/rel - 서명 키: RSA 4096, 지문 `92646CEAFE816CF8B9C249F0A1C936D7F791F8AB`, 2028-11-07 만료. 공개 키는 README 「서명」이다. - 첫 태그는 `v1.0.0`이다(3절). -**`SIGNING_KEY`에 넣는 것**은 키 지문이나 키 ID(16진수 40·16·8글자)가 아니라 비밀 키 파일 전체다. +**`SIGNING_KEY`에 넣는 것**은 키 지문이나 키 ID(16진수 40·16·8글자)가 아니라 비밀 키 파일 전체다. 파일 그대로(여러 줄)나 그 파일을 base64로 한 줄로 만든 값(`base64 -w0 signing-key.asc`) 둘 다 된다. 빌드가 base64를 풀어 쓴다(`SigningKeys`). ```bash gpg --armor --export-secret-keys 92646CEAFE816CF8B9C249F0A1C936D7F791F8AB > signing-key.asc diff --git a/scripts/release/check-signing-key.sh b/scripts/release/check-signing-key.sh index 6fef35d..d1cb1c6 100755 --- a/scripts/release/check-signing-key.sh +++ b/scripts/release/check-signing-key.sh @@ -24,7 +24,10 @@ if [ -z "${SIGNING_KEY:-}" ]; then fi [ -n "${SIGNING_PASSWORD:-}" ] || echo "check-signing-key: SIGNING_PASSWORD is empty (only right for a key without a passphrase)" -EXPECTED_FINGERPRINT=$expected python3 - <<'PY' || fail=1 +home=$(mktemp -d) +trap 'rm -rf "$home"' EXIT +chmod 700 "$home" +KEY_OUT=$home/key.asc EXPECTED_FINGERPRINT=$expected python3 - <<'PY' || fail=1 import base64, os, re, sys key = os.environ["SIGNING_KEY"] @@ -40,6 +43,18 @@ print(f"shape: {len(key)} characters, {key.count(chr(10)) + 1} lines," f" trailing whitespace {'yes' if key[-1:].isspace() else 'no'}") stripped = key.strip() +compact = re.sub(r"\s", "", key) +if "-----BEGIN" not in key and re.fullmatch(r"[A-Za-z0-9+/]+={0,2}", compact or "x"): + try: + unwrapped = base64.b64decode(compact).decode("utf-8") + except Exception: + unwrapped = "" + if unwrapped.strip().startswith("-----BEGIN PGP PRIVATE KEY BLOCK-----"): + print("form: base64 of an armoured key file on one value; the build unwraps it (SigningKeys), so the checks below read the unwrapped text") + key = unwrapped + stripped = key.strip() + print(f"unwrapped shape: {len(key)} characters, {key.count(chr(10)) + 1} lines") + if re.fullmatch(r"(0x)?[0-9A-Fa-f]{8}|(0x)?[0-9A-Fa-f]{16}|[0-9A-Fa-f]{40}", stripped): expected = os.environ.get("EXPECTED_FINGERPRINT", "") same = " (the release key's fingerprint)" if expected and stripped.upper() == expected.upper() else "" @@ -115,13 +130,12 @@ if raw: for problem in problems: print(f"PROBLEM: {problem}") +with open(os.environ["KEY_OUT"], "w", encoding="utf-8") as out: + out.write(key) sys.exit(1 if problems else 0) PY -home=$(mktemp -d) -trap 'rm -rf "$home"' EXIT -chmod 700 "$home" -if printf '%s\n' "$SIGNING_KEY" | GNUPGHOME="$home" gpg --batch --quiet --import >/dev/null 2>&1; then +if [ -s "$home/key.asc" ] && GNUPGHOME="$home" gpg --batch --quiet --import "$home/key.asc" >/dev/null 2>&1; then fingerprint=$(GNUPGHOME="$home" gpg --batch --with-colons --list-secret-keys 2>/dev/null | awk -F: '/^fpr/{print $10; exit}') echo "gpg import: ok, secret key fingerprint ${fingerprint:-none}" if [ -n "$expected" ] && [ "${fingerprint:-}" != "$expected" ]; then From a892a4507377d79cc0f22c3c0ebb2996f836d9fd Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 15:21:16 +0900 Subject: [PATCH 4/6] =?UTF-8?q?fix(release):=20=EC=84=9C=EB=AA=85=20?= =?UTF-8?q?=EC=A7=84=EB=8B=A8=EC=9D=B4=20=EB=B9=84=EB=B0=80=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EB=AA=A8=EC=96=91=EC=9D=84=20=EC=95=8C=EB=A6=AC?= =?UTF-8?q?=EA=B3=A0=20Gradle=20=EC=84=9C=EB=AA=85=EA=B8=B0=EB=A1=9C?= =?UTF-8?q?=EB=8F=84=20=EC=84=9C=EB=AA=85=ED=95=B4=20=EB=B3=B8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit signing-check(run 13)에서 base64를 푼 키는 맞았다. armor·CRC24·tag 5가 정상이고, 가져온 키 지문이 릴리스 키 92646CEA…F791F8AB였다. 남은 실패는 「SIGNING_PASSWORD로 서명이 안 된다」 하나인데, 비밀번호가 틀렸는지, 붙여 넣을 때 줄바꿈·공백이 섞였는지, gpg 쪽 문제인지 가를 수 없었다. gpg는 비밀번호의 첫 줄만 읽고 Gradle은 값 전체를 쓰므로, gpg 판정이 Gradle 판정과 다를 수도 있었다. - check-signing-key.sh: 비밀번호의 모양(글자 수, 줄바꿈·CR 수, 앞뒤 공백, 비ASCII 수)과 서명 실패 때의 gpg 상태 키워드만 출력한다. 값은 출력하지 않는다. - verifySigningKey: 스크립트 뒤에 Gradle의 in-memory 서명기 (signing.signatory)로 몇 바이트를 서명해 본다. Sign 태스크와 같은 판정이다. 실패 문구는 BouncyCastle 예외 문장뿐이다. 둘 중 하나라도 실패하면 태스크가 실패한다. 검증(로컬 gpg, 버리는 키): 맞는 비밀번호 ok, 틀린 비밀번호 「gpg status: BEGIN_SIGNING FAILURE KEY_CONSIDERED」. 끝에 줄바꿈이 붙은 비밀번호는 gpg로 ok이고 모양 줄이 「line breaks 1」을 알린다(Gradle 판정은 desktop과 runner). --- build.gradle | 24 ++++++++++++++++++++++++ scripts/release/check-signing-key.sh | 21 +++++++++++++++++---- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 021e0eb..ef690e8 100644 --- a/build.gradle +++ b/build.gradle @@ -198,12 +198,36 @@ def signingKey = SigningKeys.armoured(providers.environmentVariable('SIGNING_KEY // SIGNING_PASSWORD signs with it, printing no part of either. Gradle's signing reports every one of // these as "Could not read PGP secret key" (v1.0.0 release run 9); this says which. A key other // than the release key passes with -PsigningKeyFingerprint= (a rehearsal key). +// gpg reads only a passphrase's first line and Gradle the whole value, so the task then signs a few +// bytes with Gradle's own signatory: the verdict is the one the Sign tasks would reach. tasks.register('verifySigningKey', Exec) { group = 'verification' description = 'Checks SIGNING_KEY and SIGNING_PASSWORD without printing them (scripts/release/check-signing-key.sh).' outputs.upToDateWhen { false } + ignoreExitValue = true commandLine 'bash', file('scripts/release/check-signing-key.sh'), providers.gradleProperty('signingKeyFingerprint').getOrElse('') + def signed = !signingKey.isBlank() + doLast { + boolean scriptPassed = executionResult.get().exitValue == 0 + boolean gradlePassed = !signed + String verdict = 'skipped: no SIGNING_KEY' + if (signed) { + try { + signing.signatory.sign(new ByteArrayInputStream('signing check'.bytes), OutputStream.nullOutputStream()) + gradlePassed = true + verdict = 'ok' + } catch (Exception failure) { + // Exception text only: BouncyCastle names what failed (checksum mismatch, a tag), never the key. + def cause = failure.cause ? " (${failure.cause.class.simpleName}: ${failure.cause.message})" : '' + verdict = "failed: ${failure.message}${cause}" + } + } + logger.lifecycle("signing as Gradle's Sign tasks do (in-memory key): ${verdict}") + if (!scriptPassed || !gradlePassed) { + throw new GradleException('verifySigningKey: the signing secrets would not sign; the PROBLEM lines above say why.') + } + } } tasks.withType(Sign).configureEach { mustRunAfter tasks.named('verifySigningKey') diff --git a/scripts/release/check-signing-key.sh b/scripts/release/check-signing-key.sh index d1cb1c6..ea66519 100755 --- a/scripts/release/check-signing-key.sh +++ b/scripts/release/check-signing-key.sh @@ -23,6 +23,15 @@ if [ -z "${SIGNING_KEY:-}" ]; then exit 1 fi [ -n "${SIGNING_PASSWORD:-}" ] || echo "check-signing-key: SIGNING_PASSWORD is empty (only right for a key without a passphrase)" +# The passphrase's shape only: a pasted value often carries a line break or spaces the key was not +# protected with, and Gradle uses the value as given. +python3 - <<'PY' +import os +p = os.environ.get("SIGNING_PASSWORD", "") +print(f"password shape: {len(p)} characters, line breaks {p.count(chr(10))}, CR {p.count(chr(13))}," + f" leading whitespace {'yes' if p[:1].isspace() else 'no'}, trailing whitespace {'yes' if p[-1:].isspace() else 'no'}," + f" non-ASCII characters {sum(1 for c in p if ord(c) > 127)}") +PY home=$(mktemp -d) trap 'rm -rf "$home"' EXIT @@ -143,12 +152,16 @@ if [ -s "$home/key.asc" ] && GNUPGHOME="$home" gpg --batch --quiet --import "$ho fail=1 fi printf 'signing check\n' > "$home/message" - if printf '%s' "${SIGNING_PASSWORD:-}" | GNUPGHOME="$home" gpg --batch --pinentry-mode loopback \ - --passphrase-fd 0 --local-user "${fingerprint:-none}" --detach-sign --output "$home/message.sig" \ - "$home/message" >/dev/null 2>&1; then + # gpg reads only the first line of the file; the shape line above says whether there is more. + printf '%s' "${SIGNING_PASSWORD:-}" > "$home/passphrase" + if GNUPGHOME="$home" gpg --batch --pinentry-mode loopback --passphrase-file "$home/passphrase" \ + --status-fd 3 --local-user "${fingerprint:-none}" --detach-sign --output "$home/message.sig" \ + "$home/message" >/dev/null 2>&1 3>"$home/status"; then echo "signing with SIGNING_PASSWORD: ok" else - echo "PROBLEM: SIGNING_PASSWORD does not unlock the key for signing (wrong passphrase, or the key is not a signing key)" + # gpg's status keywords only (BAD_PASSPHRASE, MISSING_PASSPHRASE, ERROR …): no values. + status=$(awk '$1 == "[GNUPG:]" {print $2}' "$home/status" | sort -u | tr '\n' ' ') + echo "PROBLEM: SIGNING_PASSWORD does not unlock the key for signing (gpg status: ${status:-none})" fail=1 fi else From f88f180ab6ed7bea7346f21e1c3feb291d7cc8e4 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 15:22:32 +0900 Subject: [PATCH 5/6] =?UTF-8?q?fix(release):=20SIGNING=5FPASSWORD=EC=97=90?= =?UTF-8?q?=20=ED=82=A4=20=EB=B8=94=EB=A1=9D=EC=9D=B4=20=EB=93=A4=EC=96=B4?= =?UTF-8?q?=EA=B0=84=20=EA=B2=BD=EC=9A=B0=EB=A5=BC=20=EC=9D=B4=EB=A6=84=20?= =?UTF-8?q?=EB=8C=84=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit signing-check(run 15)가 남은 실패의 원인을 보였다. SIGNING_PASSWORD는 3,473글자에 줄바꿈 56개였다. 앞 run에서 base64를 푼 armored 키(3,474글자, 58줄)와 같은 모양이다. Gradle 서명기는 「checksum mismatch at in checksum of 20 bytes」, 곧 틀린 비밀번호로 실패했다. 비밀번호 칸에 키가 들어갔다. 진단이 이 경우를 바로 말한다. 비밀번호에 「-----BEGIN PGP」가 있거나 1,000글자를 넘으면, 그것이 비밀번호가 아니라는 PROBLEM 줄을 낸다(값은 출력하지 않는다). release.md 1절에 SIGNING_PASSWORD는 키를 만들 때 정한 암호 한 줄이라고 적었다. 검증: 로컬 gpg로 armored 키를 비밀번호로 준 경우 PROBLEM 줄과 rc=1(아래 signing-check 실행). --- docs/work/release.md | 4 ++-- scripts/release/check-signing-key.sh | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/work/release.md b/docs/work/release.md index 2f33f64..0692ef1 100644 --- a/docs/work/release.md +++ b/docs/work/release.md @@ -21,7 +21,7 @@ main 병합 ──> 소유자가 태그 vX.Y.Z push ──> .gitea/workflows/rel | --- | --- | --- | | `PACKAGE_TOKEN` | Gitea 개인 토큰. 권한은 `package` 읽기·쓰기만(repository·user 권한 없음). Gitea job 토큰(`GITEA_TOKEN`)은 패키지를 올릴 수 없어서 사람 토큰이 필요하다 | Gitea 웹 → 설정 → 애플리케이션에서 새로 만들어 secret을 덮어쓰고 옛 토큰을 지운다 | | `SIGNING_KEY` | 서명용 PGP 비밀 키(ASCII armor 전체). 두 라이브러리(grpc, messaging)가 같은 키를 쓴다 | 새 키 쌍을 만들고 README 「서명」의 공개 키와 지문을 같은 PR에서 바꾼다. 만료(2028-11-07) 전에 한다 | -| `SIGNING_PASSWORD` | 그 키의 암호 | 키와 함께 | +| `SIGNING_PASSWORD` | 그 키를 만들 때 정한 암호 한 줄. 키 파일이나 그 base64가 아니다 | 키와 함께 | - 이름: 설계(design-docs `repo-structure/05-library-repos.md` 7절)는 `PACKAGES_TOKEN`이라고 적었지만, 등록된 이름 `PACKAGE_TOKEN`에 workflow와 빌드를 맞췄다. 소유자에게 다시 등록을 부탁하지 않는다. - 서명 키: RSA 4096, 지문 `92646CEAFE816CF8B9C249F0A1C936D7F791F8AB`, 2028-11-07 만료. 공개 키는 README 「서명」이다. @@ -77,7 +77,7 @@ scripts/verify.sh release --on desktop | 어디서 | 뜻 | 할 일 | | --- | --- | --- | | 1~4단계, 서명 | 아무것도 올라가지 않았다 | 고쳐서 main에 병합한다. 그 버전의 파일이 Packages에 하나도 없으면(`maven-metadata.xml`에 없음) 태그를 지우고 고친 main 커밋에 같은 태그를 다시 단다. 하나라도 올라갔으면 다음 PATCH를 쓴다 | -| 서명 직전 `verifySigningKey`, 또는 `Could not read PGP secret key` | 서명 비밀 값이 키로 읽히지 않는다 | `signing-check` workflow의 `PROBLEM` 줄이 원인이다(지문을 넣음, 줄바꿈 잃음, BEGIN·END 줄 빠짐, base64 손상, 다른 키, 틀린 암호). 1절대로 다시 넣는다 | +| 서명 직전 `verifySigningKey`, 또는 `Could not read PGP secret key` | 서명 비밀 값이 키로 읽히지 않는다 | `signing-check` workflow의 `PROBLEM` 줄이 원인이다(지문을 넣음, 줄바꿈 잃음, BEGIN·END 줄 빠짐, base64 손상, 다른 키, 암호 칸에 키를 넣음, 틀린 암호). 1절대로 다시 넣는다 | | 5단계 중간 | 일부 모듈만 올라갔을 수 있다 | 그 버전은 버린다(지우지 않는다). 원인을 고치고 다음 PATCH를 낸다. `CHANGELOG.md`에 버린 버전을 적는다 | | 6단계 | 올라갔지만 익명으로 안 읽힌다 | owner 공개 설정을 확인한다. 템플릿 이미지 빌드가 토큰 없이 읽는다는 전제(설계 8.3절 R1)가 깨진 것이다 | diff --git a/scripts/release/check-signing-key.sh b/scripts/release/check-signing-key.sh index ea66519..3b79946 100755 --- a/scripts/release/check-signing-key.sh +++ b/scripts/release/check-signing-key.sh @@ -31,6 +31,9 @@ p = os.environ.get("SIGNING_PASSWORD", "") print(f"password shape: {len(p)} characters, line breaks {p.count(chr(10))}, CR {p.count(chr(13))}," f" leading whitespace {'yes' if p[:1].isspace() else 'no'}, trailing whitespace {'yes' if p[-1:].isspace() else 'no'}," f" non-ASCII characters {sum(1 for c in p if ord(c) > 127)}") +if "-----BEGIN PGP" in p or len(p) > 1000: + print("PROBLEM: SIGNING_PASSWORD holds a PGP key block (or something as long), not the passphrase." + " Put in only the passphrase chosen when the key was made.") PY home=$(mktemp -d) From ed8baf3a916b373a075973a5ef9623f4f97ea8ed Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sun, 8 Nov 2026 15:30:34 +0900 Subject: [PATCH 6/6] =?UTF-8?q?fix(release):=20=EB=B9=84=EB=B0=80=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EC=B9=B8=20=EA=B2=80=EC=82=AC=20=EC=8B=A4=ED=8C=A8?= =?UTF-8?q?=EA=B0=80=20=EC=A7=84=EB=8B=A8=20=EA=B2=B0=EA=B3=BC=EC=97=90=20?= =?UTF-8?q?=EB=93=A4=EC=96=B4=EA=B0=80=EA=B2=8C=20=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 앞 커밋이 더한 「SIGNING_PASSWORD에 키 블록」 검사는 PROBLEM 줄만 내고 스크립트 종료 코드에 들어가지 않았다. 다른 검사가 같이 실패해 지금은 결과가 같지만, 이 검사만 걸리는 경우에는 통과로 보였을 것이다. 그 python 블록이 실패하면 fail=1이 되게 했다. 검증: 키 블록을 비밀번호로 준 경우 rc=1. --- scripts/release/check-signing-key.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/release/check-signing-key.sh b/scripts/release/check-signing-key.sh index 3b79946..20a8db2 100755 --- a/scripts/release/check-signing-key.sh +++ b/scripts/release/check-signing-key.sh @@ -25,8 +25,8 @@ fi [ -n "${SIGNING_PASSWORD:-}" ] || echo "check-signing-key: SIGNING_PASSWORD is empty (only right for a key without a passphrase)" # The passphrase's shape only: a pasted value often carries a line break or spaces the key was not # protected with, and Gradle uses the value as given. -python3 - <<'PY' -import os +python3 - <<'PY' || fail=1 +import os, sys p = os.environ.get("SIGNING_PASSWORD", "") print(f"password shape: {len(p)} characters, line breaks {p.count(chr(10))}, CR {p.count(chr(13))}," f" leading whitespace {'yes' if p[:1].isspace() else 'no'}, trailing whitespace {'yes' if p[-1:].isspace() else 'no'}," @@ -34,6 +34,7 @@ print(f"password shape: {len(p)} characters, line breaks {p.count(chr(10))}, CR if "-----BEGIN PGP" in p or len(p) > 1000: print("PROBLEM: SIGNING_PASSWORD holds a PGP key block (or something as long), not the passphrase." " Put in only the passphrase chosen when the key was made.") + sys.exit(1) PY home=$(mktemp -d)