feat: harden self-update trust with cosign-signed checksum manifest#144
Draft
feat: harden self-update trust with cosign-signed checksum manifest#144
Conversation
- Add ECDSA P-256 public key embedded in binary (embeddedCosignPublicKeyPEM) - Add verifyChecksumSignature() using Go stdlib crypto/ecdsa; no new deps - Runner now downloads sha256sums.txt.sig and verifies it before trusting checksums - Result struct gains SignatureAssetName/SignatureVerified fields - Human output shows signature verification status - Release workflow installs cosign and signs sha256sums.txt → sha256sums.txt.sig - Tests updated: new key-pair helpers, all update paths include signature assets Agent-Logs-Url: https://github.com/vriesdemichael/bitbucket-server-cli/sessions/052ffbeb-281e-414d-bb15-39b44f9d4c46 Co-authored-by: vriesdemichael <9072548+vriesdemichael@users.noreply.github.com>
Agent-Logs-Url: https://github.com/vriesdemichael/bitbucket-server-cli/sessions/052ffbeb-281e-414d-bb15-39b44f9d4c46 Co-authored-by: vriesdemichael <9072548+vriesdemichael@users.noreply.github.com>
Co-authored-by: vriesdemichael <9072548+vriesdemichael@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Harden self-update trust with signed checksum manifest
feat: harden self-update trust with cosign-signed checksum manifest
Apr 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bb updatetrustedsha256sums.txtwithout authentication — an attacker who could swap release artifacts could also swap the checksum file, defeating the integrity check entirely.Changes
Release pipeline
cosignviasigstore/cosign-installer@v3sha256sums.txt, signs it withcosign sign-blob --keyusing aCOSIGN_PRIVATE_KEYActions secretsha256sums.txt.sigas an additional release artifactUpdater (
runner.go)embeddedCosignPublicKeyPEM) compiled into the binarysha256sums.txt.sig→ download → verify ECDSA signature against embedded key → only then parse and trust the checksum fileverifyChecksumSignature()uses only Go stdlib (crypto/ecdsa,crypto/x509,encoding/pem) — no new dependenciesResultgainsSignatureAssetName/SignatureVerified; human output showssignature sha256sums.txt.sig (verified)Dependencies.ChecksumPublicKeyPEMallows tests to inject a test key without touching the embedded constantTests
testKeyPairhelper generates fresh ECDSA P-256 key pairs and produces cosign-format signatures inlinesha256sums.txt.sigassets and valid signaturesTestVerifyChecksumSignaturecovers: valid, wrong key, tampered content, malformed base64, invalid PEMmissing_signature_asset,signature_download_failure,invalid_signature,malformed_signatureSetup required
Two Actions secrets must be configured to activate signing:
COSIGN_PRIVATE_KEYCOSIGN_PASSWORDThe
embeddedCosignPublicKeyPEMconstant inrunner.gomust match the private key used in CI. To rotate: generate a new key pair, update the constant, update the secret, cut a release.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
invalid-url-that-does-not-exist.local/tmp/go-build479556031/b355/hook.test /tmp/go-build479556031/b355/hook.test -test.paniconexit0 -test.timeout=10m0s -test.count=1 go_.�� ache/go/1.24.13/x64/src/os/user .cfg ate.test =0,multipathtcp=git nternal/cli/cmd/rev-parse SPGCdsl/0qV5eYI5--show-toplevel ate.test ache�� /opt/hostedtoolcache/go/1.24.13/x64/src/runtime/--log-target 1868047/b175/ ux_amd64/vet -pthread -Wl,--no-gc-sectrev-parse -fmessage-length--show-toplevel ux_amd64/vet(dns block)login-json.local/tmp/go-build479556031/b302/auth.test /tmp/go-build479556031/b302/auth.test -test.paniconexit0 -test.timeout=10m0s -test.count=1 conf�� x64/src/os/user _MHy/2B4ahMNRoA9-nolocalimports ux_amd64/vet(dns block)/tmp/go-build803342620/b304/auth.test /tmp/go-build803342620/b304/auth.test -test.paniconexit0 -test.timeout=10m0s -test.count=1 _ _ _ _ _ _ --print-diagnostics-summary --print-metrics-summary -o /tmp/go-build862652771/b118/_pkg_.a -trimpath x64/pkg/tool/linux_amd64/compile -p github.com/mark3-f -lang=go1.23 x64/pkg/tool/linux_amd64/compile(dns block)/tmp/go-build3404619558/b304/auth.test /tmp/go-build3404619558/b304/auth.test -test.paniconexit0 -test.timeout=10m0s -test.count=1 remo�� 2145bea0:internal/cli/update.go k/bitbucket-server-cli/bitbucket-server-cli/internal/services/reposettings/service_test.go /usr/bin/git REDACTED -nolocalimports -importcfg git rev-�� --show-toplevel /home/REDACTED/work/bitbucket-server-cli/bitbucket-server-cli/internal/mcp/tools_branch.go git x64/src/net mxfl/fl1TLN58PjN-c /usr/local/.ghcugit status --porcelain --ignore-submodules | head -n 10 /opt/hostedtoolcache/go/1.24.13/x64/pkg/tool/linux_amd64/vet(dns block)resolved.local/tmp/go-build479556031/b302/auth.test /tmp/go-build479556031/b302/auth.test -test.paniconexit0 -test.timeout=10m0s -test.count=1 conf�� x64/src/os/user _MHy/2B4ahMNRoA9-nolocalimports ux_amd64/vet(dns block)/tmp/go-build803342620/b304/auth.test /tmp/go-build803342620/b304/auth.test -test.paniconexit0 -test.timeout=10m0s -test.count=1 _ _ _ _ _ _ --print-diagnostics-summary --print-metrics-summary -o /tmp/go-build862652771/b118/_pkg_.a -trimpath x64/pkg/tool/linux_amd64/compile -p github.com/mark3-f -lang=go1.23 x64/pkg/tool/linux_amd64/compile(dns block)/tmp/go-build3404619558/b304/auth.test /tmp/go-build3404619558/b304/auth.test -test.paniconexit0 -test.timeout=10m0s -test.count=1 remo�� 2145bea0:internal/cli/update.go k/bitbucket-server-cli/bitbucket-server-cli/internal/services/reposettings/service_test.go /usr/bin/git REDACTED -nolocalimports -importcfg git rev-�� --show-toplevel /home/REDACTED/work/bitbucket-server-cli/bitbucket-server-cli/internal/mcp/tools_branch.go git x64/src/net mxfl/fl1TLN58PjN-c /usr/local/.ghcugit status --porcelain --ignore-submodules | head -n 10 /opt/hostedtoolcache/go/1.24.13/x64/pkg/tool/linux_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: