Changelog
Unreleased
Security
GET /docconfirmed that a document existed when its read rule refused the caller (every published version, through 0.4.0). The handler spread the refusal into the response and answered 200 with just{_path}instead of the opaque 404, so anyone could probe for non-public pages (blog:pagewithout thepublictag) and modules, and since 0.4.0 a lookup by field (blog:page/path=<slug>) also named the hidden document's id. Nothing of its content was returned. Action: deploy functions.- A
since=delta returned whole rows where the list grant projects fields (0.2.0-beta.2 to 0.4.0). It kept the stored row instead of what the grant's filter returned, so fields aproject(or a field map) hides went out in every delta. No shipped or known manifest combines a projection withenvelope.seq. Action: deploy functions. - A capability token could create documents its method caveats leave out
(0.2.0-beta.2 to 0.4.0). A
/docswrite with no method is an upsert; the gate asked whether the token mayPUT, and a create is aPOST, which was never asked. So a token minted withoutPOSTcreated documents wherever its roles may write. Each write is now checked inside the commit for the method it resolves to. Action: deploy functions.
Added
- Row visibility relative to the caller (#4449). A visibility rule can
compare a row to the caller instead of a constant:
{"field": "owner", "op": "eq", "principal": "uid"}keeps each account to its own rows, and{"field": "readers", "op": "includes", "principal": "uid"}limits a row to the people it names. Onlyeqandincludestake a principal, and a caller with no uid (anonymous) matches nothing. The uid is the verified credential's (a token's owner), never the first uid on a role document. It applies to/doc, lists andsince=deltas alike. Principal attributes (anorgon a grant) are next; a manifest naming one is refused until then. - A signed-in caller without a role document keeps their uid. They still
hold no roles, so only
publicgrants apply, as before; but apublicrule can now say "your own rows", so an app whose accounts never get a role document needs no per-user collection. On a collection with apublicwrite grant (none ships), their writes are now attributed:_bycarries their uid and display name, andrequireAttributionaccepts them. - Restricted write grants are enforced (#4449), so each account can write
its own rows:
write: {"visible": {"field": "owner", "op": "eq", "principal": "uid"}, "accept": <schema>}. A write is admitted when one of the caller's grants sees the stored row (if there is one) AND the row they would store, and itsaccepttakes the content; a delete needs the stored row to be visible. Someone else's row is refused with the same opaque 404 as a missing one: not "exists" to a POST, not a no-op for an identical body./doc, a/docsbatch (all or nothing) and the transactional path of sequenced and immutable collections all enforce it; on/doca restricted write commits transactionally, so the row it judged is the row it replaces. Until now a restricted write refused every write. Don't approximate one withpublicwrite: "ALL"plusderive: principal: the derive fills only a missing field. What a guard does not stop, by design:- Ids are first come, first served. Anyone may create a row at an id
nobody holds, so an id derived from a uid (
library/<uid>) can be taken by someone else first, and a create answers 404 where the id is taken. Give rows fresh, unguessable ids and find an account's rows by listing. uniquesees every row. A write refused asuniquetells the caller that some row, perhaps one they cannot see, holds that value.- An
includeswrite rule lets any listed member list others, which puts the row in their view. Useeqon an owner field for writes.
- Ids are first come, first served. Anyone may create a row at an id
nobody holds, so an id derived from a uid (
Changed
The site's tjs-lang, which tosijs-ui's live examples load, moves from 0.13.13 to 0.14.3 (GHSA-q4jm-6mqc-w3g2 affects it through 0.14.1). Those chunks load only when a live example renders; they grow 76 KB gzipped, and the entry is unchanged.
A visibility rule that would fail open is refused at install: an unknown key (a misspelled
principlecompiled toowner === undefined), a comparison with neithervaluenorprincipal, avaluethat is not a string, number or boolean, and avalueonnonEmptyorabsent. An installed manifest keeps running; the next install or upgrade of one that breaks a rule is refused, naming it.
Fixed
getDoc's read cache (a collection withcacheLatencySeconds, read by SSR and the blog) held the first caller's filtered view and handed it to anyone holding any grant for the TTL. Latent, since every cached collection grants onlyALL; it now caches the stored document and filters each read.- Replacing the datastore empties the registry and document caches, which are keyed without it. A test starting another host in the same process was served the previous host's collections for up to 5 s.
0.4.0 — 2026-12-04
The platform runs without Firebase, posts and pages become the blog's, and
setup needs no cloud console (D22). The kernel reaches its datastore, files,
identity, logging and HTTP only through ports, so the same endpoints run on
Cloud Functions or in one Bun process on SQLite (serve:local). Posts and
pages move into the installable blog manifest (D28), and the asset manager
ships as service-compris/assets. The ceremonies (claim, install approval,
authorization) are pages, pages are rendered when content is stored (D23),
and game rooms run on a small host of their own (D26, D27).
Security
Holes this release closes in versions already published, with the versions affected and what to do.
- One
/authorizeapproval could mint several tokens (0.2.0-beta.1 to 0.3.0). The exchange read, decided and wrote with no transaction, so concurrent exchanges each saw "approved, unused": on the sandbox, 8 at once minted 7. Only the holder of the verifier could exchange, so the extra tokens went to the party being authorized, and every one was listed and revocable. Each step now runs in a transaction that re-reads the request. Action: list your tokens (GET /token) and revoke any you do not recognise. Advisory: GHSA-mvm9-r54r-fjj6. storage.ruleslet content roles write straight toblog/, and any signed-in user tousers/<uid>/(0.3.0 and earlier). A file written there skips/blob's limits, metadata and provenance, and lands where the asset manager no longer looks. Both folders are now read-only;public/keeps its admin-only writes. Action: deploystorage.rules(bun run deploydoes) on every host, consumer hosts included. Advisory: GHSA-3c39-mx76-47qp./cachedQueryfetched anyhttp(s)URL for anyone, followed redirects, and so reached loopback, the private network and the metadata server (0.3.0 and earlier, on Firebase). It now fetches only public addresses, checks each redirect hop, gives up after 15 s and reads at most 1 MB (functions/src/egress.ts), and it answers only callers holding a role beyondpublic(403 otherwise). Action: deploy functions. Advisory: GHSA-qx2p-23mm-fc32.- Hardening:
/tokenrefuses to revoke an id containing/.
None of these is in the npm package: they are in the host code deployed from
this repository. So no published version is deprecated, and npm audit has
nothing to find. Host operators learn of them from this entry, its upgrade
steps and the three GitHub advisories, which name the repository
(ecosystem "other"), not the npm package.
Two more were found and fixed before release, in code this release adds: the
rooms host read up to 32 MB of body on any path for anyone (now 4 KB, on its
two routes that take one), and serve:local's unsigned dev identities could
be used by any web page (it now answers only loopback names, and only pages
served from the same machine).
Added
bun run serve:local: the whole platform in one Bun process, with no Firebase and no emulators: every endpoint and the site, documents and the render cache in SQLite, files in a directory, and dev identities that a browser picks at/__dev/login. Dev identities are unsigned, so they are served only on loopback.bun run import:local -- <backup dir>loads abun run backupsnapshot, so a copy of a real site can run locally.- Game rooms (D26, D27):
/roommakes rooms and manages their members, and the/roomsWebSocket relays messages between members. They are served by Bun hosts only, since Cloud Functions cannot hold a socket. The rooms host (functions/src/adapters/bun/rooms-host.ts) serves rooms and nothing else, with host-signed guest tokens instead of accounts;bun run build:rooms-hostcompiles it andscripts/deploy-rooms-host.tsdeploys it. The client is thetosijs-roomspackage. /docs?modifiedAfter=<ISO time>lists the documents edited after a time, newest first (#4050). It is a convenience for polling collections without sequences; replication usessince=<seq>.- A post is readable without JavaScript (#4063). With render on store,
the page carries the post as plain HTML (
<article data-ssr>), written fresh from an allowlist of tags and attributes (D25), for fetchers and readers that run no script. The client removes it when it mounts. - A bad URL is a 404, showing a short note over the home page, on both render paths (#3891, #3913). It used to be a 200.
- Blog editor: drafts list most recently edited first and refresh on switching (#4003); Generate Summary reports failures, and its prompt is editable; URLs and Markdown marks are readable in the editor.
- An endpoint may set its own time limit;
/gentakes five minutes, so a long proofread no longer times out. scripts/set-post-keywords.jssets posts' keywords from a reviewed plan;migrate-blog-files.js --only <name>copies one file.service-compris/assets: the asset manager as an installable extension (D28). The<asset-manager>component,blobFiles()(anAssetFilesover a host's storage areas:/blobfor the bytes,/docsfor the listing, a refused write retried once with a fresh token), andservice-compris/assets/manifest.json, which installs two storage areas,assets:publicandassets:private. The component is told itsfiles,foldersandinsertInto, and assumes nothing about the host. tosijs and tosijs-ui are optional peer dependencies: the root import still needs neither, and has no DOM.bun run deploy: the whole host in order (indexes, then functions, rules and hosting), then checked from outside.bun run deploy:sandboxdoes the same for a sandbox and refuses a host that is not marked as one.- Every endpoint declares
invoker: 'public'in code (functions/src/endpoint-options.ts), so every deploy re-applies it. There is no IAM step to remember; a lost one is fixed by redeploying. - Signing set up by code:
bun scripts/enable-signing.js --alias <host>grants the functions' service account Token Creator on itself and sets the bucket CORS a page needs to read a signed redirect. New hosts get both from the provisioner. - One-click claim (board #2489):
bun scripts/claim.js --alias <host> [--for <email>]arms the claim for one verified email and opens/claim?page, where that person signs in and clicks Claim. - Install approval in the browser (board #2490):
install-manifest.jsproposes a manifest with no credentials and prints a link and a confirmation code; a configurator opens the link, sees a dry run of what would happen, and approves. The host installs the manifest it stored, as that person. Endpoints:POST /install?action=propose|preview|approve,GET /install?request=<id>(the page),GET /install?action=status. POST /blob {op: "import"}: copy a file from a legacy folder (blog/,public/,users/) into a storage area on the server.scripts/migrate-blog-files.jsuses it to copy a whole folder, with clean names; the originals stay. See BETA.md "Store files".- Render on store (D23, board #2698), behind
RENDER_ON_STORE(false|compare|true; default off). Pages, the nav, the blog index and the sitemap are computed on first read, stored with the documents they depend on, and invalidated when one of those is written. Rendering is always done as the public.scripts/render-store.jslists, shows and purges stored values;scripts/compare-render.jscompares the two engines URL by URL. SetSITE_HOSTwhen turning it on: stored pages and the sitemap name it. - The asset manager uses storage areas: uploads, list, rename and delete
go through
/blobfor a folder that is an area (blog:public); file names are cleaned on upload. - Kernel (npm):
afterWrite(data, userRoles, change?)gains a third argument,WriteChange {path, before?, after?}.
Changed
- Relicensed: code is Apache-2.0, content is CC0 1.0. Apache's patent
grant is the reason. Documentation, images and the code samples in the docs
are CC0 (
LICENSE-CONTENT, now in the package). The logos are not: they are CC BY 4.0, so credit is required (LICENSE-LOGOSlists them, and the marks that aren't ours). 0.3.0 and earlier stay under MIT, the licence they shipped with.create-tosijs-platform-appis Apache-2.0 from 1.0.7, which also stops handing new projects our logos, author and licence: they get a placeholder logo, their own README and a privatepackage.json, and the platform's licence stays with its code asLICENSE-tosijs-platform. /cachedQueryneeds a signed-in role (see Security). An anonymous caller gets 403, cached answers included; nothing in this repo called it anonymously.- Posts and pages are the blog's, not the platform's (D28). They are
blog:postandblog:page, collections the blog manifest (1.1.0,manifests/blog.json) installs, with the rulespostandpagehad (including D24's author rule, below). The platform no longer definespostorpage: a host without the blog manifest has no blog. Side effects attached by name (the blog cache, render on store) now reach namespaced collections too. Render artifacts arer5. bun run deploynow means the whole host, and it passes--force: indexes and functions that exist on the host but not in the checkout are deleted without a prompt.deploy-functionsanddeploy-hostingremain for partial deploys.enable-gen-invoker.shis gone (the invoker is in code).- The backup takes every collection the database has, minus a short list
of caches. It used to name five, which left out storage-area metadata,
installed manifests, the registry and grants. The off-site archive keeps
tokenandsystem:claimlocal along withrole. - A post always names its author (D24). An empty
authoris filled from the writer's published name, the one_byrecords, and a write with no name to use is refused. A post went out with no byline when the editor had not yet loaded the signed-in name. /docGET reports the document's own path in_path(blog:post/<id>), not the lookup it was fetched by (blog:post/path=<slug>). The editor saves to_path, so after a slug change the next save could not find the post./docs?p=<collection>/<id>(a document, not a collection) lists nothing; it answered 500.- The kernel names no vendor. Endpoints are plain handlers, and the datastore, files, identity, logger and HTTP are ports a host installs: Firebase is one set of adapters, SQLite and Bun another. Nothing changes for a Firebase host.
- Dependencies: functions adds
express,linkedomandtosijs-kilpi, andmarked(now 16) moves todependencies; tjs-lang is pinned at 0.14.2. GHSA-q4jm-6mqc-w3g2 affects tjs-lang through 0.14.1, but not the platform: nothing deployed loads tjs-lang, and a manifest's$predicateis refused. The client moves to tosijs-ui 1.20 and tosijs 1.10, which make the site's entry about 44 KB larger gzipped. - Size: the package is 204.6 KB in 45 files (0.3.0: 112.6 KB in 21), 59 KB of
it the asset manager. The site's JavaScript is 857 KB gzipped, 412 KB of it
the entry (corrected after the tag: the 1359 KB first given here counted
older builds' chunks left in
dist/).bun run sizesprints these againstdist-sizes.json. - The deploy check fails when a function is not serving its newest revision.
A revision that cannot start leaves the old one serving, so the check used
to pass (it happened when
markedwas a dev dependency). /storedignores a query string.- An install proposal holds at most 64 KB (
413 too-largepast that), and an authorization request's label and caveats together at most 4 KB. - Approving a proposed upgrade whose new capabilities are still not approved
answers
409 conflict; it was reported as installed.
Fixed
- Google sign-in never worked on the
/authorize,/claimand/installpages. Their CSP blocked the loader popup sign-in needs (auth/internal-error), and the scripts linked to the functions' address, which is not an authorized sign-in domain. The pages are now served from the site's own domain, with a CSP that allows the loader. - Those pages could be framed by another site. They grant authority on a
click; they now send
frame-ancestors 'none'andX-Frame-Options: DENY. - Server-rendered data could end its own
<script>. A post containing</script>broke out of the embedded JSON. Both render paths use one safe embedder. - Anonymous authorization requests and install proposals were never deleted. Each new one now deletes a batch of long-expired ones. There is no cap on how many may be pending: a cap would let a few anonymous requests lock out real ones.
- Approving an upgrade that adds capabilities in the browser approved nothing, and the parked upgrade was reported as installed.
- Stored-data validators no longer fail a document for the fields the endpoint
stamps (
_byand friends). - The blog editor's Path field fills in after a new post is saved (#3747).
- The dev server (
bun start) no longer writesdist/, which the deploy uploads. A running dev server could race a deploy, and a deploy could upload a client built for the wrong project. - A read-only token could not list (#35). A token asked for with
methods: ['GET']read single documents, but everyGET /docs(thesince=delta included) is checked asLIST, so lists came back as an opaque 404, like an empty collection. Asking forGETnow recordsLISTbeside it, at/tokenand when an/authorizerequest starts, so the consent page shows both. Tokens minted before this keep exactly what they were approved with: mint a new one to list.
Upgrading a host
Run bun run deploy (or deploy functions, rules and hosting: this release
changes all three).
A host with a blog moves its posts and pages first, in this order:
bun run backup; install the blog manifest 1.1.0 (bun scripts/install-manifest.js manifests/blog.json); copy the documents (bun scripts/migrate-blog-collections.js --alias <host> --apply); deploy; check (… --check). The copy keeps every id and field, renames the blog page's prefetch pattern, clearsconfig/blog-cache, and deletes nothing;postandpagestay as the rollback.bun run deployrefuses a host whose posts are still only inpost. Anything that reads or writes/doc?p=post…directly (scripts, agents, a token scoped topost) must nameblog:post. Then retire the old rules: once the deployed site checks out, runbun scripts/migrate-blog-collections.js --alias <host> --retire. Until then the registry still holdspostandpage, and they still accept writes. The data stays either way.Deploy
storage.rules(see Security).bun run deploydoes.Anything that calls
/cachedQueryanonymously now gets 403: send a signed-in user's token.firebase.json, if you maintain your own: add rewrites for/authorize,/claimand/installto their functions, before any catch-all, and the header rule for/@(authorize|claim|install)from this repo'sfirebase.json. Without them, browser sign-in on those pages fails. Hosting replaces a function's headers, so the rule must carry the pages' CSP exactly (functions/src/page-csp.ts; a test compares them).Signed URLs: if you granted Token Creator by hand for 0.3.0, also run
bun scripts/enable-signing.js --alias <host>. It adds the bucket CORS; without it a page'sfetch()cannot read a/blobredirect (found by tosijs-virta's upgrade, board #2488). It is safe to re-run.Render on store is off unless you set
RENDER_ON_STORE. To adopt it: setcompare, runscripts/compare-render.js, then settrueandSITE_HOST. After changing an access rule on a host that has it on, purge withscripts/render-store.js. The invalidation hooks run whether or not the flag is set (a few small writes on each post, page or config save).Kernel (npm): nothing breaks; the
afterWriteargument is optional.
0.3.0 — 2026-09-30
File storage: storage areas and the /blob endpoint (board #1136).
Added
- Storage areas. A manifest collection with
blob: {maxBytes, contentTypes?}stores files; its access rules are the files' access rules, and public vs private is derived from them./blob/<area>/<path>:PUTto upload or replace,GETto fetch,DELETE;POST /blob {op: "move"}. The server measures size and hash; each file has a metadata document with_byprovenance, listable through/docs. See BETA.md "Store files".- Consistency: bytes live under a content-hash key, and metadata is committed before an old object is removed, so a metadata document always means its file exists. A crash can orphan an object, never corrupt one.
- Delivery is a redirect to a signed URL when the host can sign (never
cached), otherwise the bytes are streamed (public ones cache for 300s).
A content type must be exactly one type. Streamed files are
nosniffand sandboxed unless they are inert media. - A move needs read access to its source, and never overwrites its destination, even under concurrency.
- To a caller who may write but not read, a PUT's answer never depends on
the stored file (no
unchanged; the same409in an immutable area). - Cost to know: a public file fetched through a redirect costs one function call per view (the redirect is uncached). Streamed files cache for 300s.
- Error codes
too-large(413) andunsupported-type(415). New codes break exhaustiveswitches onerror, which is why this is a minor release. - Kernel (npm): the storage-area decisions are exported:
decideRead,decidePut,decideDelete,decideMove,isBlobStore,isPublicArea,validateBlobPath,contentTypeAllowed,blobLimitsProblems,BLOB_META_SCHEMA, and friends. Provisional through 0.3.x.decideReadanddecideMoveare async (they may evaluate a visibility filter);awaitthem —decideMove(...).statuson the bare promise isundefined. - The install response lists a
blobcapability undersuperseded: it grants nothing; declare a storage area instead. It is still accepted.
Changed
- Cloud Functions run on Node 22 (
engines.node). Node 20 is end of life. /docand/docsrefuse writes to a storage area (403 refused); its metadata is written only through/blob.- A manifest upgrade cannot turn a collection into a storage area, or back.
Fixed
- SSR rendered posts with the site's generic title on a fresh instance. The blog's prefetch handler read the resolved page from a module global that a concurrently running handler set; it only worked when a warm instance still held a previous request's page. The page is now resolved once per request.
/storedread the whole bucket with the Admin SDK — which ignoresstorage.rules— so it could have served storage-area objects, private ones included, and answered "does this content exist?" to anyone. It now serves only the legacy folders.- Files served from the site's origin were not sandboxed in practice.
Hosting's site-wide CSP replaced the sandbox CSP the functions set, so an
SVG uploaded to
blog/(any content role can) could run script as the site via/stored. Hosting now sandboxes/blob/**and/stored/**. - Social previews:
og:urlandog:imageare absolute; a post's fallback image finds Markdown images, not only<img>;twitter:cardis set.
Upgrading a host
Deploy storage.rules and hosting too (firebase deploy --only storage,hosting), before installing a manifest that declares an area.
- Behaviour change — direct reads are now an ALLOWLIST. The old default rule
granted public read on the whole bucket, which exposed PRIVATE storage areas.
Now only
blog/,public/andusers/are readable directly (client SDK and/stored); everything else in the bucket is served only by/blob. If your host keeps files anywhere else, move them or add the folder to bothstorage.rulesandfunctions/src/legacy-storage.ts(a test checks they agree). The bucket root can no longer be listed. firebase.jsongains a header rule for/blob/**and/stored/**: Hosting's site-wide CSP replaces a CSP set by a function, so the sandbox for files served from your origin has to come from Hosting./storednow reads the project's default bucket (it hardcoded<project>.appspot.com).
Deploy the functions (the new one is blob), and add
{"source": "/blob/**", "function": "blob"} to firebase.json's hosting
rewrites before any catch-all. A first deploy normally makes a new function
publicly invokable; check that blob is. Signed-URL delivery additionally needs
the functions service account to hold "Service Account Token Creator" on itself;
without it, files are streamed (correct, just proxied).
0.2.1 — 2026-09-26
Two fixes reported by tosijs-virta, the proving consumer.
Fixed
- Provenance recorded the wrong person (#28).
_by.uidwas the first uid on the role document that matched, so a principal matched by contact email, or one sharing a role document, was recorded as whoever is listed first. On virta's host, every board write from a human was stamped as the host's service principal._by.uidis now who authenticated._by.rolestill names the document that granted the authority.- Kernel (npm):
UserRolesgains an optionalprincipal: {uid, name?}, which a host sets from the verified credential.principalIdentity(userRoles)is the one rule every attribution uses: provenance, a manifest'sderive: {op: 'principal'}(which had the same bug), and/token. If you don't setprincipal, you get the 0.2.0 behaviour. _by.name, "curated when owned":- The principal is the role document's sole owner: its operator-curated name.
- A contact or shared match: the principal's own display name, or no name at all, never the document's.
- The rule, exactly: a candidate name is dropped if it contains
@or equals one of the principal's contact values (ignoring case). It fails closed, so a curated name like "Team @ Acme" is dropped too; attribution then falls back to the display name, or to no name._by.uidis the identity either way. - Enforced where
_byis produced, so future writes are covered even where role documents and tokens stored on live hosts carry an email./claimused to name the first owner's role document after their email; it now uses their display name, orHost owner <uid prefix>. - Display names are self-asserted, so spoofing is confined to the case where no curated name exists.
- An agent's writes carry its human's name. The minting human's display
name is stored on the token (
principalName, captured at/tokenmint or at/authorizeapproval). Tokens minted before 0.2.1 fall back.
- Kernel (npm):
- An immutable or sequenced collection could be re-sequenced by concurrent
/docwrites (board #1184)./docread existence outside its commit, so concurrent creates of one new id all saw "missing" and all committed. Those collections now commit through the same transaction as/docsbatches: the existence check, the pipeline, uniqueness and the sequence counter all happen inside it.
⚠️ Action required on existing hosts
Documents written before 0.2.1 may carry an email address in _by.name,
and publicly readable ones (posts) are still served with it. The filter
applies to new writes only. To find what to fix:
scripts/audit-host.jsnow lists role documents whosenameis an email or one of their own contacts, and tokens whoseprincipalNameis.- Rename those role documents to the name you want shown.
- Re-save, or scrub
_by.nameon, public documents written by those principals.
Verified:
- Unit tests: 775 passing.
- Emulator suites: 54 pass, including a new step: a contact-matched writer on a document listing someone else first is stamped as themselves.
- Live on the sandbox: a 5-way race on one id gives exactly one
200, four403s, one_seq, and a changed rewrite gets409. All six ceremonies pass (99 checks), plus the signed-in suite (17).
0.2.0 — 2026-09-26
The first stable release since 0.1.0. The npm package is the decision kernel:
RBAC, the write pipeline, and role resolution. The repository is a host you can
deploy, claim, install onto and hand to agents. Two production hosts run it:
tosijs-virta's, the consumer that broke the betas and got every break fixed, and
loewald.com. The beta entries below are the detailed history. This entry is
what changed since 0.1.0, which is what npm install service-compris
gave you until now.
Verified for this release:
- Unit tests: 750 functions and 799 root, all passing.
- Emulator integration suites: 53 pass, 0 fail, run against this code with the registry switch on, as production runs.
- Live host checks on the sandbox: the signed-in suite 17/17, and six ceremonies with 94 assertions.
Upgrading the npm package from 0.1.0
- Authorization results can change.
getMethodAccessnow joins every applicable grant as a lattice. In 0.1.0 the last matching role in key order won, so whether a principal with two roles got more or less depended on how the map was written. Now holding more roles never grants less, and key order is irrelevant. - Token caveats deny. When
userRoles.tokenis present, a method or collection outside its caveats resolves toundefined, the same as no access. Sub-collections of an allowed collection are allowed.LISTis its own method, distinct fromGET. (TokenContextis exported.) RoleNamegainsconfigurator, the role that installs libraries.WriteOutcome's rejection reasons gainunattributedandimmutable. This breaks an exhaustiveswitchoverreason.- Provenance:
data._byis stamped fromuserRoles(uid, role document, name, and the token's id and label when there is one). It is never taken from the body.STAMPED_FIELDSis exported. - The schema validates content, not stamps. A closed schema
(
additionalProperties: false) now works; in 0.1.0 it rejected every write.isUnchangedignores_seqand_by. uniquemay list several fields, each unique on its own. A missing or non-scalar value in a unique field is refused asunique.- What the kernel enforces, and what only a host does.
- Kernel:
requireAttribution, andimmutablefor rewrites. This needs a correctexistsfrom the caller. - Host:
seq,afterWrite, and refusing deletes of an immutable document.
- Kernel:
- 0.1.0 could not be imported under Node ESM (extensionless specifiers). 0.2.0 can, and the publish workflow smoke-tests the packed tarball and the registry's copy.
- Packaging: the package has no runtime dependencies besides its
tosijs-schemapeer. It used to pull the Firebase SDK for nothing.
Upgrading a host (from 0.1.0 or 0.2.0-beta.1/beta.2)
- Errors have one shape,
{error: <code>, message, details?}, and the codes are a contract: see BETA.md, "Errors". New since the betas:immutable(409);rate-limited(429), in that shape (it used to be plain text);- a
/docsbatch now uses the same statuses as/doc, so itsvalidateanduniquerefusals are 400, not 403.
- A
/docsbatch checks uniqueness within itself too: two writes in one commit claiming the sameuniquevalue are refused (400 unique), and nothing is written. Before, both committed. immutable: truemakes a collection a log: an identical rewrite is a no-op; a different rewrite, or a delete, is refused (409). An upgrade may add it but never drop it.- An upgrade may not switch
envelope.seqon or off for an existing collection. - A contact-email grant resolves only for a VERIFIED email. A user who held a role only through a contact and signs in with a password loses it. Bind them by uid, or have them use Google.
systemis a reserved namespace.derive: slug, when: 'absent'leaves a supplied value exactly as written. It used to re-slugify it on every write.- API responses are
Cache-Control: no-store. Behind Firebase Hosting, error responses used to be CDN-cached across credentials. - The platform's own rules can be served as data
(
PLATFORM_CONFIGS_FROM_REGISTRY, off by default). Seed withscripts/seed-registry.js, and run--checkbefore turning it on. - Audit an existing host with
scripts/audit-host.js. See the beta.3 "Action required" section: older seeds grantedownerto a claimable address.
Security: what was affected
Each of these was a HOST issue. The npm kernel was not affected by any of them.
| Issue | Affected | Fixed |
|---|---|---|
Seeded role documents granted owner to claimable real addresses |
hosts seeded from 0.1.0 – beta.2 (remediate with audit-host.js) |
beta.3 |
| A contact-email grant resolved for an UNVERIFIED email | hosts with password sign-in, 0.1.0 – beta.2 | beta.3 |
A library named system could declare the platform's system:* collections |
beta.1 – beta.2 | beta.3 |
| Error responses cached by the Hosting CDN across credentials | hosts behind Hosting rewrites, ≤ beta.3 | beta.4 |
Repository
- Published through GitHub OIDC with npm staged publishing. No token
exists; a maintainer's 2FA approval publishes. The workflow is the shared
template (
.github/workflows/publish.yml). It builds the package withbuild:lib, and a declared extra install runs after the tarball is packed. - Tasks moved to the virta board (project
tosijs-platform).TODO.mdis a pointer, and the old contents are indocs/archive/. - loewald.com serves its own rules from the registry.
bun seedseeds the emulator's registry too, so the emulator matches production.
0.2.0-beta.5 — 2026-09-26
The platform's own collections can run on the same rules engine as everyone
else's (D19, step 2), behind a switch that is off by default. With
PLATFORM_CONFIGS_FROM_REGISTRY=true, post, page, role, config,
module and the install records are served from stored configs in
system:registry instead of compiled TypeScript. It is rehearsed on a
production clone and not yet enabled in production.
Added
- Platform configs as data.
scripts/seed-registry.jswrites them (dry run by default;--applyis one atomic commit of every changed config plus an epoch bump; it never deletes; production needs--production).--checkexits non-zero unless the stored registry matches the code. Run it before enabling the switch anywhere.systemis reserved, so only datastore access can change or fix these rules. - Failure is per collection. A config that is missing or fails to compile
makes that collection inaccessible; there is no compiled fallback. Missing
and unknown configs are logged. Role resolution does not go through the
registry, so a broken
roleconfig never touches anyone's authority. - Side-effect hooks by name.
post's cache clear stays in code (collections/hooks.ts), attached to the loaded config; it is not authority. scripts/bench-registry.js: interleaved latency, bare-name vs installed.
Changed
- The registry refreshes in the background. Past its 60 s TTL, when the epoch confirms nothing changed, it serves the cached rules and reloads behind the request. The inline reload was a ~950 ms p99 on a production clone. A real change still reloads inline, and concurrent requests share one load. A failed background reload keeps the confirmed rules; a failed first load still denies everything.
uniquemay list several fields, each unique on its own. This was refused as a "composite constraint needing an index", which misread it.- Behaviour change for installed manifests:
derive: slug, when: 'absent'now leaves a supplied value exactly as written. It used to re-slugify it on every write. No known consumer relies on the old behaviour.
Fixed
- The blog editor moved existing post URLs on save. It re-slugified every path, including an unchanged stored one. A URL-safe path is now kept exactly. All 851 production paths are URL-safe, so none moves. This was live in production regardless of the switch.
getRef/getRecordsno longer default to the compiled configs; the map is required, so a forgotten call site fails to compile.
Found by the review before production
The pre-release review (reviews/0.2.0-beta.5-registry-swap.md) blocked
this twice, correctly. The stored configs did not match the shipped code in
five ways, any of which the swap would have put live:
- existing post paths rewritten on edit (96 of 791);
post/commentopened, although the code never registers it;- unlisted pages listed publicly;
- page-path and post-title uniqueness lost;
- looser
moduleandroleschemas. Role contacts are authority.
A behavioural parity test (seed-parity.isolated.ts) now runs the real
compiled rules and the stored ones over fixtures for every role and method,
and over schemas. The seeded and compiled collection names are pinned equal.
0.2.0-beta.4 — 2026-09-25
One fix, found by the first consumer the day they put the API behind their own domain.
Fixed
- Error responses were CDN-cached across credentials behind Firebase
Hosting (#27). A function response with no
Cache-Controlgetsmax-age=600from Hosting, and its CDN keys on the URL alone — not onAuthorization— so one caller's401/403/404was served to every caller of that URL for ten minutes, and no request header could opt out. The worst case is a cached401making a client drop a valid token. The platform API endpoints (doc,docs,user,hello,claim,install,token,authorize) now sendCache-Control: no-storeon every response, success included, set before anything else runs. On every endpoint, errors sent through the shared writers (fail(),notFound()) andoptionsResponse's own 429/403 areno-storetoo. The site's SSR endpoints (prefetch,esm,sitemap,stored,cachedQuery) keep CDN caching for their successes. Some of their error paths still bypass the shared writers; that is tracked in TODO.md, and none of them is part of the platform profile a consumer host deploys.
0.2.0-beta.3 — 2026-09-24
A log you can trust. The first consumer (tosijs-virta) found that a sequenced
collection could be silently re-sequenced by an upsert, and silently
truncated by an upgrade. Both are now refused rather than applied. The
pre-release review (reviews/0.2.0-beta.3-log-integrity.md) then found three
security holes and a broken verify script, all fixed here.
⚠️ Action required on existing hosts
The seed fix below protects hosts seeded from now on. A host seeded from an earlier version, or one the verify scripts have run against, may still carry grants that anyone can claim — and nothing removes them.
Audit (read-only; needs this repo and
gclouduser credentials):bun scripts/audit-host.js --alias <alias>It reports claimable grants — role documents keyed on the old seed addresses (role-named Gmail addresses:
owner@,admin@,writer@,rando@), and FIXED sandbox identities (sandbox-<role>,-pin) whose password was once public — and separately, per-run verify leftovers, which are not claimable (random passwords) but worth deleting. Exit 1 means claimable grants; 3 means the Auth half could not be listed. Without the repo, checkroledocuments and Auth users in the Firebase console for the same addresses.Replace before you delete. If a claimable grant holds
ownerorconfigurator, it may be your only path in. Grant that authority to a verified identity of yours first and confirm it withGET /hello. (The audit says when this applies. Deleting first is recoverable — re-run the claim ceremony — but needlessly.)Delete the claimable entries, then re-run the audit until it is clean.
Check contact-email grants for lock-out. A role that reaches its holder only through a contact email now needs a verified email (see Security). A user who signs in with a password — which never verifies, because nothing here sends a verification email — loses it silently. Bind such users by uid (
userIds), or have them sign in with Google.
Added
immutable: true(#25). An identical re-write is a no-op; a different one is refused with the new stable codeimmutable(409), and in aPOST /docsbatch the whole commit is refused with it. Creates are unaffected; deletes are refused (see Security), and once declared an upgrade may not drop it. The field was already in the manifest type and accepted by the validator — and compiled to nothing, so a consumer could declare its log immutable and every writer could still rewrite it. Without it, an upsert over an existing id replaces the document and assigns a new_seq, moving history. Opt-in, likeseq; a non-boolean value is now refused.
Security
- A contact-email role resolved for an UNVERIFIED email (review M1). Role
lookup falls back to matching
contactsby the token's email, and never checkedemail_verified. With password sign-in enabled on every provisioned host (#17) and a public API key, anyone could create an account under an address a role was waiting for — a pre-assigned grant, a clone's owner document, or the old seed — and hold those roles. Now the email path is taken only whenemail_verified === true. - The
systemnamespace was not reserved (review M2). A manifest namedsystemcould declaresystem:claim,system:hostorsystem:seq, which are safe only because nothing registers them — one configurator approval from reopening the claim ceremony, marking a consumer's host a sandbox, or rewinding a sequence. Refused at install, dropped at registry load, and unreachable at lookup. - An immutable document could be deleted and re-created at a fresh
_seq(review M3), which is the rewriteimmutableexists to prevent. DELETE on an immutable collection is now refused with409 immutable.
Fixed
- An upgrade could switch
envelope.seqon under stored documents (#22), leaving them with no_seq—since=0answered "nothing" and a replica started from a silently truncated log. An upgrade now refuses turningseqon or off for an existing collection (off silently stops replicas receiving). Backfilling in_createdorder was declined: it reintroduces the clock orderingseqexists to replace. - The seed granted
ownerto a real, claimable address (#23 audit).initial_staterole documents keyed on role-named Gmail addresses (owner@et al.) meant anyone controlling that address could sign in to any host seeded from this repo as owner. Seeded roles now grant nothing and use RFC 2606.invalid;seed-safety.test.tsasserts both. - Platform verification could run against a consumer's host (#23). Hosts
now record whose they are (
system:host/identity); everyverify-*.jsrefuses anything but a marked sandbox and fails closed on an unmarked host. Per-run identities, random passwords by default, cleanup keyed on the run. prepublishOnlyprinted a wall of expected red on a successful publish; the gate is now readable, and the dead shadow-mode scaffolding is deleted.verify-token.jsrevoked a role document that no longer existed (review M4). The grant moved to a per-run id with #23; the script still PATCHed the old fixed id, which the REST API silently creates — a false red, and a stray author+admin grant left behind. It now reads the id from the minter, refuses to create on revoke, and deletes the per-run grant when it is done.- The emulator integration suites depended on the seeded
owner@Gmail address and had been passing only because they skip without emulators. They now mint their own owner; 53 pass against emulators.
Contract changes
- New error code
immutable(409), on rewrite and on delete. - Upgrades that change
envelope.seqon an existing collection are refused. - Contact-email role resolution requires a verified email.
- An upgrade may not drop
immutablefrom a collection that declared it. systemis a reserved namespace.
Still open
- #24 — a hand-written role document without
_createdis invisible to role resolution. Write_createdon any role document you create by hand.
0.2.0-beta.2 — 2026-09-21
Everything the first consumer found. Eight issues, all filed within a day of picking up beta.1, all closed. See BETA.md for the current guide.
Verified end to end on the consumer's own host, not only in tests: 94 live
assertions across six ceremonies (scripts/verify-*.js), re-run after every
change. 663 functions + 655 root unit tests.
Fixed
- A closed schema rejected every write (#16 — the blocker). The pipeline
stamped
_created/_modifiedand then validated the stamped document against the caller's schema, soadditionalProperties: falsefailed with "Unexpected _created" — which is the schema an append-only log wants. Worse than the missing feature: the same JSON Schema validated locally accepted a document the host refused, so a consumer could not pre-check their own writes. The comment above the bug claimed the strip already covered it. derive: { op: 'principal' }was compiled withprincipal: {}hardcoded, so it produced''for every caller — a declared feature wired to nothing. Found while fixing #18, which was the same shape of defect._bywas promised and never stamped (#18). BETA.md said "the token is the provenance"; nothing was written, so provenance lived only in a field the writer chose to populate.
Added
_seqand a delta cursor (#14):GET /docs?p=…&since=<seq>&c=<n>→{rows, cursor, more}. Opt in withenvelope: { seq: true }. Timestamps cannot order a resume — two writes in a millisecond are indistinguishable, and the stamps come from the function instance's clock, which drifts — so a counter, read and written in the same transaction as the document. A total order serialises writes to the collection at roughly one per second; that is what a total order is, hence opt-in.- Atomic multi-document commit (#15):
POST /docs {writes:[…]}, all-or-nothing, one transaction. An unnamedmethodmeans upsert. A sequenced commit takes a contiguous range, so a replica never sees half of one. _byprovenance on every write:{uid, role, name, token?, label?}, unforgeable, hidden from the caller's schema. Every token a person mints shares their uid, so the label is what distinguishes one agent from another — and from its human.envelope: { requireAttribution: true }refuses a write the endpoint cannot attribute.- One error shape (#20):
{error: "<stable code>", message, details?}across the platform routes. Clients switch on the code; the prose is free to change. Opaque 404s stay opaque. GET /install?name=<ns>(#19), answerable by any authenticated principal including a token — an agent could not previously ask whether its own library was installed.provision-sandbox.js --profile platform(#21): a consumer host gets the platform routes only — no site functions, no LLM secrets, no blog seed.- The provisioner enables email/password sign-in, and reports a gcloud
failure before printing anything, naming
CLOUDSDK_PYTHON(#17).
0.2.0-beta.1 — 2026-09-20
The first release a third party can install onto. See BETA.md for the walkthrough and, more usefully, for what is not ready.
Verified end to end against a real deployed host: 64 assertions across three
ceremonies (scripts/verify-install.js 27, verify-token.js 17,
verify-authorize.js 20). 617 functions + 655 root unit tests.
Added
/install— a manifest becomes collection config, schemas and access rules. Requiresconfigurator, and specifically notowner: owner's power is the datastore (D3), not an in-system bypass. Upgrades are additive-only; a published version's content is immutable; revoking tombstones the grant and never drops rows./claim— a fresh host mints its firstconfiguratorby proving datastore write access, with no first-run secret to leak. Rotates on success, so it is not replayable and doubles as break-glass recovery.- Installed collections reach
/docand/docs. Bare names still resolve from compiled TypeScript with no extra read, so a live blog's request path is unchanged (D18). /token— scoped capability tokens. They attenuate and never grant: authority is recomputed live per request, so revoking a human revokes every agent they authorised.owner/configurator/developercan never be carried; a token cannot mint a token; the secret is never stored./authorize— a browser loop giving a CLI its first token without anyone pasting a secret. PKCE's shape, not OAuth. The browser never receives a token; minting happens at the exchange from live roles. Consent page served by the function so it cannot desync from the code that processes it.scripts/cli-login.js, a readable reference client for the above.llms.txtandCHANGELOG.md(#1), and a consumer walkthrough inBETA.md.- Composite indexes for
role.contactsandtoken.hash. provision-sandbox.jsgrantsallUserstherun.invokerrole on the public endpoints (step 5b), so a freshly provisioned host is reachable without four manualgcloudcalls. Idempotent, grant-only, and it reads even on a dry run so the dry run reports what would actually change.
Fixed
The published package could not be imported at all.
service-compris@0.1.0is"type": "module", and TypeScript undermoduleResolution: "bundler"emitted relative specifiers with no.jsextension — which Node's ESM loader refuses. Installing 0.1.0 and importing it by name fails withERR_MODULE_NOT_FOUND. It type-checked, built, tested green, andnpm packlisted every file; nothing exercised the artifact the way a consumer would. Fixed by writing.jsin the source specifiers, and guarded byscripts/verify-package.js, which packs the tarball, installs it into a scratch project, imports it by package name, and calls something — now part ofprepublishOnly.getUserRolesscanned only the 100 newest role documents for its email fallback, matching client-side. On a host with more roles, a principal whose grant fell outside that window silently resolved to anonymous — indistinguishable from having no access. Now an indexed query.Revocation by uid was undone by the read path. The email fallback wrote the uid back into
userIds"for future fast lookups", making it a cache wearing a grant's costume: removing a uid was re-granted on the next request, by a write that happened during a read and so appeared in no audit of writes.ID tokens were not checked for revocation. A revoked or disabled session kept full access for up to an hour.
roles[0]of a two-document query. A principal grantedauthorin one role document andadminin another got whichever_created descordered first — a nondeterministic answer to "who is this". Roles are now unioned.A parked upgrade took the library offline: the registry loaded only
activegrants, and parking setspending. A safety prompt that causes an outage teaches operators to approve without reading.Approving a parked upgrade
500d — approval re-POSTs the same version, andbatch.createrejects an existing document./installattributed installs touserRoles.userIds[0], which is a union across role documents and could name the wrong person in the ledger.
Changed
- Capability manifest shape settled (#11): a map keyed by namespaced name,
with
accessrules inside each declaration so the existing diff catches a widening fromadmintopublicthe same way it catchesmaxBytesgrowing. Unrecognised kinds are refused rather than granted; enforcement is not built, and the install response reportsunenforced: [...]rather than implying a live power. lte/gteadded to the visibility vocabulary — without them it could not express a ceiling, which is the most common capability constraint. They deny on type mismatch rather than coercing.
0.1.0 — 2026-09-17
Initial publish of the decision kernel, to claim the name.