Add admin and customer interfaces, orders, signed activation and leases, protected package delivery, keyring verification, migrations, security controls, tests and deployment documentation. Co-Authored-By: Craft Agent <agents-noreply@craft.do>
3.4 KiB
Local release/download DEV slice
Status: in progress, not ready for formal acceptance. U07 resumable chunk upload, crash/orphan reconciliation, formal key rotation and authenticated browser acceptance remain incomplete.
API
- Admin GET
/api/v1/products/:id/releases?page=1: paginated metadata, no physical storage path/key. - Admin POST
/api/v1/products/:id/releases?version=...: raw binary, 1 byte through 64 MiB. SHA-256 content address; transactional publication metadata/audit. Apply migrations 007 and 008 before starting this code. - Instance POST
/api/v1/customers/:customer_id/releases/:id/download: JSON instance ID/secret. Current customer/product entitlement, freeze/revocation and instance ownership checked before transactional audit and X-Accel-Redirect. Secret must not appear in URLs. - Downloads use POST with Range headers; clients must repeat credentials for every resumed request. Not a public download URL.
Storage and consistency
PACKAGE_STORAGE_ROOT must be an absolute trusted non-public existing directory writable only by the application/storage owner. Digest keys are 64 lowercase hex characters plus .bin. Package symlinks are rejected. Directory modification by an untrusted process is outside the safe operating boundary; Nginx also disables symlinks.
Migration 008 package_objects rows serialize same-digest writes across products. New files are removed for metadata/audit failure before rollback. A commit acknowledgement failure or process crash can leave an unreachable object; preserve it for reconciliation rather than risking deletion of an actually committed package. No crash recovery/automatic garbage collection claim is made.
Executed evidence (2026-09-30)
Dedicated license_download_260930 database migrated to 008; no destructive cleanup of normal development data.
TestDownloadsMySQLIntegration: customer/product isolation, bad secret, freeze/revoke/customer inactive/product inactive, unauthenticated publication, audit failure blocking redirect and publication, failure file cleanup, concurrent cross-product same digest, conflicting version, empty file, 67108864-byte success and 67108865-byte denial passed.
Linux container TestLocalPackageRejectsTraversalAndSymlink passed without skip.
Isolated Nginx stable-alpine on http://127.0.0.1:18181 with temporary API 18082: authenticated exact bytes and SHA256 header matched; Range bytes=0-6 returned 206 with package; guessed internal path 404; empty credentials 400. Container and temporary API stopped after automated test. Configuration: deploy/nginx/download-local.conf, storage read-only mounted at /srv/license-packages; no unrelated Nginx modified.
Frontend release list/upload panel compiled; existing frontend tests/build passed, existing bundle-size warning remains. Authenticated browser upload/list/instance interaction needs user login at http://127.0.0.1:15173.
Runtime/key boundary
Existing development 18081 remains v6, development database remains 007; 008 and new code have not been applied to that runtime. Its ephemeral signing key cannot be recovered through supported APIs. Do not rerun the old launcher, since it silently generates a different key. Upgrade requires protected persistent key injection and an explicit decision concerning old DEV certificates/leases, or coordinator approval for deliberate test-only key rotation. See signing-key-operations.md. No private key saved or logged.