Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
Package repos hardening (coordinator's security read): the site trusts SHA256SUMS.txt only with the release signature (the app's update key); the signing passphrase reaches gpg through a 0600 file, not argv; CI tests both
islandmeda6cb0d1c3865
diff --git a/.github/workflows/repos.yml b/.github/workflows/repos.ymlindex c8343aa5..4d97f715 100644--- a/.github/workflows/repos.yml+++ b/.github/workflows/repos.yml@@ -39,10 +39,17 @@ jobs:REPO_SIGNING_KEY=$(gpg --batch --pinentry-mode loopback --passphrase test --armor --export-secret-keys) \REPO_SIGNING_PASSPHRASE=test tools/publish/package_repos.sh dist dist/sculptforge-package-repos.tar.gz(cd dist && sha256sum sculptforge-package-repos.tar.gz >> SHA256SUMS.txt)+ # The sums signed as release.yml signs them (tools/release/sign_sums.sh), with a throwaway Ed25519 key.+ openssl genpkey -algorithm ed25519 -out "$RUNNER_TEMP/release.pem"+ openssl pkeyutl -sign -inkey "$RUNNER_TEMP/release.pem" -rawin -in dist/SHA256SUMS.txt -out dist/SHA256SUMS.txt.sig+ echo "PACKAGE_REPOS_PUBKEY_HEX=$(openssl pkey -in "$RUNNER_TEMP/release.pem" -pubout -outform DER | tail -c 32 | od -An -tx1 -v | tr -d ' \n')" >> "$GITHUB_ENV"tar -tzf dist/sculptforge-package-repos.tar.gz- name: Site put together (as pages.yml does)run: |mkdir site+ # Sums not signed by the release key: refused before anything is downloaded+ if PACKAGE_REPOS_PUBKEY_HEX=$(printf '%064d' 0 | tr 0 a) PACKAGE_REPOS_LOCAL=dist \+ tools/publish/package_repos_fetch.sh vTEST site; then echo "unsigned sums accepted"; exit 1; fiPACKAGE_REPOS_LOCAL=dist tools/publish/package_repos_fetch.sh vTEST sitefind site -type f | sort(cd site && python3 -m http.server 8000 --bind 127.0.0.1 >/dev/null 2>&1 &)diff --git a/docs/design/package-repos.md b/docs/design/package-repos.mdindex 05618f2d..5f69114b 100644--- a/docs/design/package-repos.md+++ b/docs/design/package-repos.md@@ -30,7 +30,8 @@ files, byte for byte (the ones the release workflow verified and smoke-tested).`REPO_SIGNING_KEY` secret the step says so and does nothing.2. **Website** (`pages.yml`): `tools/publish/package_repos_fetch.sh` takes the latest published release's metadataand downloads the packages it names into `website/apt/pool/...` and `website/rpm/packages/`, each checked against- that release's `SHA256SUMS.txt`, then deploys with the rest of the site. Nothing is committed to git (about+ that release's `SHA256SUMS.txt`, whose release signature (`SHA256SUMS.txt.sig`, the app's one-click update key) is+ verified first, then deploys with the rest of the site. Nothing is committed to git (about120 MB per release); only the newest version is in the repositories (older ones stay on the releases page).3. **Trust chain**: the key signs the metadata; the metadata lists each package's SHA-256; apt and dnf refuse apackage whose bytes differ (`.github/workflows/repos.yml` tests exactly that, plus installs on Debian, Ubuntu,@@ -39,7 +40,7 @@ files, byte for byte (the ones the release workflow verified and smoke-tested).checksum) and `gpgcheck=0`. A later step can sign the `.rpm` in `packages.yml` if a distribution policy needs it.The key lives only in the `release` environment (tags `v*` only), reaches one step, and is never written to disk-outside that step's temporary keyring. The tools are installed in an earlier step that never sees it. pages.yml+outside that step's temporary keyring (the passphrase goes to gpg through a 0600 file, never a command line). The tools are installed in an earlier step that never sees it. pages.ymland everything else never see it.## The signing key (maintainer: once, about 5 minutes)diff --git a/tools/publish/package_repos.sh b/tools/publish/package_repos.shindex 4065a6a3..1e428202 100755--- a/tools/publish/package_repos.sh+++ b/tools/publish/package_repos.sh@@ -23,7 +23,9 @@ mkdir -m 700 "$GNUPGHOME"printf '%s\n' "$REPO_SIGNING_KEY" | gpg --batch --quiet --importfpr=$(gpg --batch --with-colons --list-secret-keys | awk -F: '$1 == "fpr" {print $10; exit}')[ -n "$fpr" ] || { echo "package_repos: REPO_SIGNING_KEY holds no secret key" >&2; exit 2; }-sign() { gpg --batch --yes --quiet --pinentry-mode loopback --passphrase "${REPO_SIGNING_PASSPHRASE:-}" \+# The passphrase from a 0600 file in the 0700 work folder, never on a command line (the runner's process list).+(umask 077; printf '%s' "${REPO_SIGNING_PASSPHRASE:-}" > "$work/passphrase")+sign() { gpg --batch --yes --quiet --pinentry-mode loopback --passphrase-file "$work/passphrase" \--digest-algo SHA512 --local-user "$fpr" "$@"; }shopt -s nullglobdiff --git a/tools/publish/package_repos_fetch.sh b/tools/publish/package_repos_fetch.shindex bda7ea91..123106b9 100755--- a/tools/publish/package_repos_fetch.sh+++ b/tools/publish/package_repos_fetch.sh@@ -1,7 +1,9 @@#!/usr/bin/env bash# Puts the apt and dnf repositories into the website (pages.yml): the latest release's signed metadata# (sculptforge-package-repos.tar.gz, made by tools/publish/package_repos.sh in the release workflow) plus the-# release's .deb and .rpm files it names. Every download must match the release's SHA256SUMS.txt.+# release's .deb and .rpm files it names. SHA256SUMS.txt must carry the release signature (SHA256SUMS.txt.sig, Ed25519,+# the key compiled into the app: kUpdatePublicKeyHex in src/core/SelfUpdate.h, the one-click update's check), and+# every download must match it.# tools/publish/package_repos_fetch.sh TAG WEBSITE_DIR [REPO]# A release without the metadata (before the signing key exists) leaves the site as it is: exit 0, a note.set -euo pipefail@@ -16,6 +18,17 @@ get() {}get SHA256SUMS.txt "$work/SHA256SUMS.txt"+get SHA256SUMS.txt.sig "$work/SHA256SUMS.txt.sig"+# PACKAGE_REPOS_PUBKEY_HEX overrides the app's key (the test signs with a throwaway one).+pub=${PACKAGE_REPOS_PUBKEY_HEX:-$(sed -n 's/.*kUpdatePublicKeyHex = "\([0-9a-f]\{64\}\)".*/\1/p' \+ "$(dirname "$0")/../../src/core/SelfUpdate.h")}+[ ${#pub} -eq 64 ] || { echo "package_repos_fetch: no release public key (kUpdatePublicKeyHex)" >&2; exit 1; }+# Ed25519 SubjectPublicKeyInfo: the fixed 12-byte DER prefix, then the raw 32-byte key.+python3 -c 'import sys; sys.stdout.buffer.write(bytes.fromhex(sys.argv[1]))' "302a300506032b6570032100$pub" |+ openssl pkey -pubin -inform DER -out "$work/release.pub"+openssl pkeyutl -verify -pubin -inkey "$work/release.pub" -rawin -in "$work/SHA256SUMS.txt" \+ -sigfile "$work/SHA256SUMS.txt.sig" >/dev/null 2>&1 ||+ { echo "package_repos_fetch: $tag's SHA256SUMS.txt is not signed by the release key ($pub)" >&2; exit 1; }check() { # check <asset name> <file>local wantwant=$(awk -v n="$1" '$2 == n || $2 == "*" n {print $1}' "$work/SHA256SUMS.txt")