Skip to content

fix: sign app via occ integrity:sign-app instead of PHP openssl_sign#2

Merged
strobelpierre merged 1 commit into
mainfrom
fix/signing-pss
May 13, 2026
Merged

fix: sign app via occ integrity:sign-app instead of PHP openssl_sign#2
strobelpierre merged 1 commit into
mainfrom
fix/signing-pss

Conversation

@strobelpierre
Copy link
Copy Markdown
Owner

Why

Every release shipped so far (v1.0.0 and v1.1.0) has an invalid appinfo/signature.json:

  • PHP's openssl_sign() only produces RSA PKCS#1 v1.5 signatures.
  • Nextcloud's integrity check requires RSA-PSS / SHA-512 / MGF1-SHA-512 / saltLen=0 (see lib/private/IntegrityCheck/Checker.php).

The current Sign app step in this workflow uses openssl_sign(...) with no padding option, so the signature it produces never passes NC's check. The failure is silent on the publishing side (openssl_sign returns true, the tarball is generated, the App Store accepts it), and only shows up at runtime as a generic InvalidSignatureException: Signature could not get verified. in the admin overview of installed instances. That's what #1 was actually about — the version-gate hypothesis turned out to be a red herring once the bug was reproduced on a NC 33 sandbox.

What changes

  • Sign step: replace the PHP-native signing with the canonical path — start nextcloud:32-apache as a sidecar, copy the unpacked app + key + cert into it, drive occ integrity:sign-app, copy the resulting appinfo/signature.json back out, repackage. occ integrity:sign-app is Nextcloud's own tool and emits the correct PSS signature.
  • Verify step (new): after signing, install the freshly signed tarball into a clean NC container and run occ integrity:check-app. If the output is non-empty (any error), the workflow fails. This closes the silent-failure mode that let two releases ship broken.
  • The detached tarball signature (used by the App Store REST API) is unchanged — that endpoint accepts PKCS#1.

Test plan

  • Verified locally on a nextcloud:33-apache container: occ integrity:sign-app produces a signature.json that occ integrity:check-app accepts (exit 0, empty output).
  • Cross-checked v1.0.0 and v1.1.0 tarballs against openssl dgst -verify: both verify under PKCS#1 SHA-512, both fail under PSS — confirming the bug exists in published artifacts.
  • After merge, release.yml should pick up this as fix: and bump to v1.1.1 automatically; the new appstore-publish run should produce a valid signature and pass the new verify step.

PHP's openssl_sign() only emits PKCS#1 v1.5 signatures, but Nextcloud's
integrity check requires RSA-PSS / SHA-512 / MGF1-SHA-512 / saltLen=0.
The previous CI step therefore shipped every release with a signature
that fails verification, causing a silent "Signature could not get
verified" warning in the admin overview for any installed app.

Switch to the canonical signing path: spin up nextcloud:32-apache in a
container, run `occ integrity:sign-app` with the project key and cert,
and pull the resulting signature.json back into the tarball before
repackaging.

Add a separate verify step that installs the freshly signed tarball into
a clean Nextcloud and runs `occ integrity:check-app`. Any non-empty
output fails the build, so we never silently ship a bad signature again.
@strobelpierre strobelpierre merged commit 4dd650d into main May 13, 2026
10 checks passed
@strobelpierre strobelpierre mentioned this pull request May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant