Skip to content

Sign + verify checksums.txt for civitai upgrade (cosign/minisign) — harden self-update trust #40

Description

@ZacxDev

Follow-up from the security audit of #39 (the civitai upgrade self-updater).

Current state (baseline, acceptable)

civitai upgrade downloads the release tarball + checksums.txt, verifies the tarball's SHA-256 against checksums.txt before replacing the binary (hard-abort on mismatch), and now enforces https + GitHub-host allowlist on all asset URLs (incl. redirect re-validation). So integrity rests on: checksum-verify-before-replace + TLS-to-GitHub.

Gap

checksums.txt itself is not cryptographically signed — its only protection is HTTPS to the GitHub asset host. A full forge of the GitHub API + asset host (or a compromised release) could swap both the tarball and its checksum line and pass the gate. This is the standard goreleaser baseline, but for a command that rewrites the user's binary it's the highest-value hardening left.

Proposed

  1. Add a signs: block to .goreleaser.yamlcosign keyless (Sigstore, signs via the GitHub Actions OIDC identity, no stored private key; verifiable against Rekor + the repo's OIDC identity) or minisign (note: aead.dev/minisign is already pulled transitively by minio/selfupdate).
  2. Have civitai upgrade fetch the signature asset and verify the signature over checksums.txt before trusting it (then the existing sha256-of-tarball gate chains off a trusted checksums file).

Acceptance

  • Release publishes a signature for checksums.txt.
  • civitai upgrade refuses to upgrade if the signature is missing/invalid.
  • Unit tests: tampered checksums.txt / bad signature → abort, binary untouched.

Severity: hardening (not a known live vuln; defense against API/asset-host compromise). Tracked separately from #39 which shipped the https/host-allowlist control.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions