feat: add signed client upgrade policies
Some checks failed
Check / delivery-static (push) Has been cancelled
Check / api (push) Has been cancelled
Check / web (push) Has been cancelled

Co-Authored-By: Craft Agent <agents-noreply@craft.do>
This commit is contained in:
2026-10-13 07:28:25 +08:00
parent 5780b27e30
commit d42067746c
25 changed files with 2154 additions and 171 deletions

View File

@@ -29,3 +29,5 @@ On 2026-09-30, a dedicated MySQL 8.0 container was used to verify an empty datab
Schema 10 adds unique administrator usernames. Existing accounts become `admin-{id}` and retain their passwords; login requests must send `username` instead of `email`. Run migrations before starting the current server or `admin-init`.
Schema 11 adds nullable `license_instances.secret_encrypted`. Apply before API startup. Configure `LICENSE_CREDENTIAL_ENCRYPTION_KEY_FILE` as an absolute path to an independent 32-byte raw random key. Mount read-only, back up securely with the database, and never commit it. Missing key preserves first-return-only creation. Existing hashes cannot recover secrets. Losing/changing the key makes ciphertext unreadable; rotation is not implemented. Down migration deletes retained ciphertext and requires backup and confirmation.
Schema 12 adds `product_update_policies`, one policy per product/platform/architecture/channel. Apply before enabling the update-policy administrator UI or `/instances/:instance_id/updates/check`. Only published stable-SemVer releases can be policy targets; the minimum supported version cannot exceed the target. The update response is signed with the configured current P-256 key and expires after 15 minutes. Down migration deletes policy rows and requires an operator-reviewed backup/confirmation. Existing portal snapshot and download APIs remain compatible.