feat(release): encrypt release snapshots#18
Open
anserwaseem wants to merge 2 commits into
Open
Conversation
Plain JSON in Storage exposed secrets. Snapshots now AES-256-GCM to .enc.json; use decrypts locally and restores env files.
Member
Contributor
Author
- Release create now orders snapshot lists from .manifest.json so filesystem/readdir order cannot scramble widgets or langs. - Release use writes manifest literally via manifestFromSnapshot instead of merging stale local state. - Env files upsert on use to preserve key order.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #4
Summary
Encrypt release snapshots before upload so secrets and app state are not stored as plain JSON in Firebase Storage.
releases/{appId}/{versionId}.enc.jsonENSEMBLE_ENCRYPTION_KEYin alias-scoped.env.secrets(or.env.secrets.<alias>); generate withopenssl rand -hex 32.jsonreleases rejected onrelease use; re-create after adding the keyWhat’s in Storage
A new release in the bucket is an encrypted envelope — not readable app JSON:
{ "v": 1, "comp": "br", "alg": "AES-256-GCM", "iv": "…", "tag": "…", "ciphertext": "…" }ciphertextholds the brotli-compressed snapshot; only a holder ofENSEMBLE_ENCRYPTION_KEYcan decrypt it locally.UX
release create,list, andusefail immediately with a clear message + hintusewith a user-friendly errorRelease metadata (date, message, hash) comes from Firestore. Encryption protects snapshot content in Storage.
Test plan
npm run build && npm testrelease create/list/usewith valid key (dev +--app uat)release use --hash <id>(non-interactive).jsonrelease → rejected on use.enc.jsonblob is encrypted envelope, not plaintextAPP_ALIAS=dev ./scripts/test-secure-release-local.shfrom project rootrelease use→ensemble pushend-to-endScreenshots
an example release enc.json file accessed using authenticated url

Ops [DONE]
Storage rules: tightened
releases/{appId}/* to collaborator-scoped read (before: any authenticated user). Encryption protects content; rules control who can download ciphertext.Read more on the blog post here