Skip to content

Security: thomasfosterau/pulpit

Security

docs/SECURITY.md

Security Policy

Reporting a vulnerability

Please report security vulnerabilities privately via GitHub's Report a vulnerability button (Security → Advisories), not through public issues.

You can expect an initial response within a few days. Please include a description, reproduction steps, and the affected version.

Supply chain

  • Publishing is npm trusted publishing (OIDC) from the protected release environment, which needs the owner's approval; only that job holds id-token: write. See PUBLISHING.md.
  • Release jobs install with --ignore-scripts and run only the workspace's own prepare; CI runs only the install scripts allowBuilds names.
  • Actions are pinned by exact tag and locked to commits by .github/workflows/actions.lock. Workflows default to permissions: {}, and CI holds no secret, so Dependabot PRs run it safely.
  • minimumReleaseAge holds new third-party versions for 24 hours; Dependabot's cooldown is 1 day.

Invariant IDs

Code comments, tests and the agent guidance cite these IDs. They are grep handles carried over from the website and gardeneria applications, which have no surviving written definition for most of them, so this table is where each rule is defined for this repository. Each rule is stated as pulpit honours it, derived from pulpit's code and tests and from the apps' citing sources. Paths are under packages/pulpit/.

ID Rule Enforced by
VERSION-CHAIN-001 Every edit to a node is a new version written through the leaf's VersionChain port, as defineVersionChain binds it: create, update, restore, delete and restoreVersion all append, and nothing else writes a version row. The one sanctioned destructive path is erasure: ./Purge's purge, at its own rung, hard-deletes a node's whole chain through the port's purge (every version row on every level, and its identity row), never part of one, together with the documents and bytes no other version references. Nothing else deletes or rewrites a version row. src/version-chain.ts (the port's contract); versionChainConformance and makeInMemoryVersionChain in src/testing.ts; src/purge.ts (the erasure path); tests/version-chain.test.ts (the conformance suite: "appends at N_max + 1 …", "purge — the erasure's whole-chain delete"); tests/purge.test.ts
VERSION-CHAIN-002 The chain is append-only. Every write lands at N_max + 1, no version row is ever updated, deleted or reordered (save by a purge, which deletes the whole chain: VERSION-CHAIN-001), and a concurrent append colliding on (id, version) fails VersionConflict and is never retried. src/version-chain.ts; the implementation's (id, version) primary key (docs/seams.md → VersionChain); tests/version-chain.test.ts (the conformance suite: "never rewrites an existing version", "a lost race at the append is VersionConflict …"; and "the append is pinned to the head the hook saw …")
VERSION-CHAIN-006 A plain update never resurrects a tombstone (it fails NodeNotFound); only the explicit restore / restoreVersion write over one. src/version-chain.ts; tests/version-chain.test.ts (the conformance suite: "never resurrects a tombstone", "restore — the explicit resurrection surface")
DOC-001 A stored document is never rewritten, and a changed document is a new hash. DocumentStore.put writes a document only when its hash is unseen and is otherwise a no-op returning the same hash; no store method updates a stored document, and only erasure deletes one: ./Purge deletes a document once no version of any node references its hash, so a hash any surviving version recorded still reads back. So a hash a version row recorded always reads back the document it was written with, and restoreVersion restores the reference, not a copy. The hash is SHA-256 over the document's canonical jsonb text (docs/seams.md → DocumentStore). The DocumentStore contract and canonicalText (the hash contract's text) in src/documents.ts; the store's primary key on the hash with ON CONFLICT DO NOTHING (docs/seams.md → DocumentStore); tests/documents.test.ts ("put — idempotent, never rewritten (DOC-001)", "restoreVersion restores the old hash …")
PUB-003 Edits are recorded as appended (version, action, timestamp, actor) rows on the node's chain, never rewritten in place, and only the chain operations write them; code that applies an edit on someone's behalf goes through the target's own update. Partly grounded: the apps cite this ID only alongside READ-009 and VERSION-CHAIN-001, and no written definition survives. src/version-chain.ts (the only writer of VersionRow); ./Proposals' accept applies a contributor's proposal through the target's own update, as the account that accepted it, recording the contributor as the version's proposedBy: src/proposals.ts; tests/proposals.test.ts ("accept appends through the target's update as the acceptor, with the proposer as proposedBy")
PUB-005 A moderated family's moderationState is a publication gate: only approved is cache-serveable. On an owned leaf that declares its moderationColumn (ownedAccess({ moderation: true })), the kernel also gates reads: a row whose state isn't exactly approved reads only to its author and the view-private rung, as a draft does, through the same predicate and list filter. Without the declaration, and on a reference leaf, who reads an unapproved row stays the application's rule. The state moves only by the kernel's moderation rules: a new row starts pending, only the moderate rung changes the state, and an edit to a declared re-review attribute sends an approved row back to pending. isPubliclyServeable in src/publication.ts; canViewOwnedRow / ownedFacts in src/internal/owned-columns.ts and ownedListFilter in src/subtype.ts (the read gate); tests/subtype.test.ts ("ownedListFilter ≡ canViewOwned", "a moderated leaf shows an unapproved row only to its owner and moderator+"); moderatePatch / moderationHook in src/moderation.ts; tests/publication.test.ts ("the moderationState axis"), tests/moderation.test.ts ("moderatePatch — the rules, case by case", "the rules through a leaf's hooks")
PUB-009 visibility (public / followers / group / private) is an explicit axis, independent of soft-delete and draft. A reference leaf lists and reads (get / getMany) only public rows unless the viewer holds the view-private rung or the view has no visibility column, plus, when the leaf declares followersOfColumn and its view carries it, the followers rows whose column names the viewer or an account the viewer follows (the account the column names gets no other owner rights, so its private rows stay the rung's alone, and a non-string value names nobody, matching no viewer and never reaching the follower seam), and, when the leaf declares groupColumn and its view carries it, the group rows whose column names a group the viewer belongs to (a non-string value names no group and never reaches the audience seam); an owned row is read through canViewOwned, which opens a published group row to the members of the group its declared groupColumn names, a non-string value (a deleted group) leaving it private. A member is an active membership: a pending invitation opens nothing until the invitee accepts it, because the membership store's isMember and groupsOf read status = 'active' rows alone. On a reference leaf the write and history operations (update, restore, delete, getVersion, restoreVersion) also require that read: a corpus writer who can't get the row (for its visibility, or because it is tombstoned and they lack the view-deleted rung) gets NodeNotFound before the chain is reached. referencePrivacyFilter, canViewOwned and ownedListFilter in src/subtype.ts; the reference arm's one filter and one predicate, referenceListFilter and canViewReferenceRow in src/internal/reference-columns.ts, which referencePrivacyFilter, defineSubtype's visibleRow (shared by get and the reference write gate) and ./Edges all use; tests/subtype.test.ts ("canViewOwned", "the reference list predicates" and its "the followers arm", "a reference leaf with a followers column: visibility × curator × tombstone, for every viewer", "a group row reads to its group's members", "a reference leaf's write and history gates answer a hidden row as get does", with its followers-column variants)
PUB-010 draft is a binary axis orthogonal to visibility: a draft is visible only to its owner and the view-private rung, whatever its visibility, and is never cache-serveable. Anything but an explicit false (null included) reads as a draft. On a publish-gated leaf draft means "no live version", computed from the publication log by both views, and a reader below the head-reading rungs reads the live version, never an unpublished head. canViewOwned / ownedListFilter in src/subtype.ts, isPubliclyServeable; tests/subtype.test.ts ("a draft narrows even public …"), tests/publication.test.ts ("REFUSES a draft …")
READ-009 A node's history is data: any version can be read back (getVersion, and compared field by field with compare), listed (history) and re-applied as a new version (restoreVersion), never by rewinding the chain. In ./Subtype, reading history is gated like a write: getVersion and compare run one shared gate before any version is read, so compare answers exactly as getVersion does. src/version-chain.ts, src/subtype.ts; tests/version-chain.test.ts ("getVersion / restoreVersion — history as data", "compare — two getVersion reads and diffStates"), tests/subtype.test.ts ("the version history is gated like a write …", "compare: getVersion's gate, then the chain's compare", "a reference leaf's write and history gates answer a hidden row as get does")
PERF-DB-001 Every read is bounded: history is capped at MAX_HISTORY_LIMIT (1000), and the store seams specify a LIMIT on head, entries, get / getMany and list. src/version-chain.ts; tests/version-chain.test.ts ("is bounded: the limit applies, and is capped"); docs/seams.md; the WordPress adapter's id modes read the IdCodec once per batch, deduplicated, and a decode batch past MAX_SET_VALUES decodes to none without reading it (see SEC-INPUT-003; packages/pulpit-wordpress/src/Ids.ts; packages/pulpit-wordpress/tests/ids.test.ts)
SEC-INPUT-003 A list page is capped at MAX_PAGE_LIMIT (1000), so no request can drive an unbounded LIMIT; a literal-set filter (anyOf / noneOf) is capped at MAX_SET_VALUES (1000) values, past which it is never; a list order reaches the store with at most one key per sortable view column (a column that isn't sortable, or input not shaped as an order, fails InvalidListOrder, never a defect; a repeated column is dropped). list in src/subtype.ts; anyOf / noneOf / evaluate in src/filter.ts; tests/subtype.test.ts ("list clamps the page to the cap …", "hands the store each column once …", "refuses an order not shaped as one …"), tests/filter.test.ts ("a set past MAX_SET_VALUES …"); the WordPress adapter's id decode applies the same cap to a wire-id batch, past which every id decodes to none and the IdCodec isn't read (integerIds / stringIds in packages/pulpit-wordpress/src/Ids.ts; packages/pulpit-wordpress/tests/ids.test.ts ("answers none throughout past MAX_SET_VALUES …"))
F-OP-02 A create is never an upsert: a caller-supplied id that already belongs to a node fails NodeAlreadyExists (409), and so does a racing create's version-0 collision. src/version-chain.ts; tests/version-chain.test.ts ("… never an upsert over an existing node", "maps a version-0 collision …")
CACHE-AUTH-005 Nothing that only some viewers may read is served from the KV read-through cache. isPubliclyServeable refuses a non-public visibility (a group row included), a draft, a tombstone and a non-approved moderation state, plus, by family posture, a missing visibility (owned) or an unarrived stamp (publish-gated). A leaf that declares the live pointer has its cache written only from the resource an anonymous reader gets (the live version, publicResource), never from the writer's re-read of an unpublished head. A write nested inside an outer transaction (SubtypeHandlersConfig.inTransaction reads true once its transact, then a SAVEPOINT, has returned) is not yet committed, so the handlers evict at its version instead of writing it through, and an outer rollback leaves no cached entry. A localised leaf's cache is keyed by (id, locale) under one compare-on-set version per id, so no locale's reader is answered from another's entry. Its handlers (SubtypeHandlersConfig.localised) evict every locale at each write's version and write nothing through, because the writer's re-read is the node's shared row. ./Cache's makeResourceCache keys a locale entry beside a per-id generation and serves it only while its rank equals the generation, so a behind fill in any locale is a no-op, an eviction wins a tie in every locale, and one conditional write on the generation evicts them all. Its publication events stamp the cache with the node's head version, which a publish does not advance, so a publish after an update lands at the version the update's write-through raised the cache to. Delegated owned axes: an owned family's axes are effect-auth's Cacheability.publiclyServeable(OwnedAccess.serveableAxes) (effect-auth ≥ 0.3.0): visibility required and exactly public, draft / unapproved exactly false when present, moderationState exactly approved when present, and no deletedAt key at all (so an unapproved of true or null, and an explicit deletedAt: undefined, now refuse). The time-dependent publish stamp and the posture of families that aren't owned stay pulpit's. tests/effect-auth.test.ts pins the delegation. src/publication.ts, subtypeHandlers in src/subtype.ts (a write whose re-read fails evicts); ResourceCacheSeam's compare-on-set: every set and delete carries its version, and a set below the highest version the cache holds for the id is a no-op, so no racing write-through or read-through fill re-caches a resource older than one already evicted or replaced; makeInMemoryResourceCache in src/testing.ts; tests/publication.test.ts, tests/effect-auth.test.ts, tests/subtype.test.ts ("… evicts the cached resource", "the resource cache's compare-on-set", "a write nested in an outer transaction caches nothing …", "publish and unpublish are gated like a write, record facts and fire their events; the cache only holds the live resource")
PERF-CACHE-004 The KV read-through resource cache serves anonymous reads, so every mutation writes through it (evicting on delete, and on a failed post-write re-read) and both of its paths apply isPubliclyServeable. An interrupt can't separate a committed write from its write-through or eviction. Each write-through, eviction and fill carries its node version and the cache compares on set, so the order in which they land can't make it serve an older version than one already evicted or replaced. Only a committed write writes through: inside an outer transaction the handlers evict instead. Cited only in tests here. subtypeHandlers in src/subtype.ts, makeInMemoryResourceCache in src/testing.ts; tests/subtype.test.ts ("subtypeHandlers — the handlers seam", "… evicts the cached resource", "the resource cache's compare-on-set"), tests/publication.test.ts
SEC-AUTH-ENUM-001 In pulpit, the read operations get, getMany and list answer a row the viewer may not see exactly as a missing one: get fails NodeNotFound, never Forbidden, and getMany / list omit it. On an owned leaf, the write and history operations (update, restore, delete, getVersion, restoreVersion) deliberately do not honour this: their gate (requireWriter) answers Forbidden for an existing owned row the caller doesn't own, and NodeNotFound for a missing one, so they confirm existence to a signed-in caller; an anonymous caller gets Unauthorized for every id. On a reference leaf they do honour it: a corpus-rung caller gets NodeNotFound for a row get hides from them, exactly as for a missing one, before any content is read or written. The per-gate behaviour is under Existence disclosure by the write gates. Edge reads and writes honour it: EdgeCardinalityExceeded counts only edges the caller can read, and under "fail" a collision with a hidden edge answers exactly as one with a readable edge; under "ignore" only a readable, live edge resolves (to its id), and any other collision is EdgeConflict. The one residue is that a generic EdgeConflict says the key is taken, which a family whose unique key leaves an end out can make about a hidden edge; the trade-offs are under EDGE-001. A list's order only places the rows the filters already chose: it never changes which rows are listed nor Page.total, and a column that isn't sortable fails InvalidListOrder before the viewer or the store is read. What an order does disclose: which columns are sortable is the leaf's optional sortable allow-list, and when a leaf declares none, every declared view column is sortable, the ones the resource never shows included. So a caller can learn the ranking of the rows it may already see by any sortable column (a rank it can't read, say), and the InvalidListOrder 400 tells it which names are view columns. No hidden row and no total leaks. A leaf that must not disclose a column's order declares sortable without it. A comment reads only through all three of its gates (its own leaf's, the moderation gate's, and its target leaf's own get), so a comment on a target the viewer can't read is NodeNotFound, as is a target they list comments on. Collision: website's SECURITY.md uses this ID for sign-up email enumeration, and gardeneria's code uses it for both meanings; pulpit uses only the hidden-row meaning. get / getMany / list in src/subtype.ts; defineComments in src/comments.ts and tests/comments.test.ts ("defineComments — the read gates"), and search: searchScopeFilter, the filter list reads under, and hydrateSearchHits, which re-reads the hits through the gated getMany; tests/subtype.test.ts ("a private target refuses a stranger and the anonymous as NotFound, never Forbidden", "list and getMany apply the same facts as get", "never changes membership or the total …" (every order × viewer × includeDeleted), "checks the order before the viewer is read", "sorts only by a declared sortable allow-list …", "without a sortable list … every declared view column sorts", "get / getMany never serve a row list hides": every row state (each also read under searchScopeFilter straight from the store, and hydrated from a poisoned index naming every row), out-of-enum visibility and a null or absent draft included, × viewer, and a reference leaf's followers rows by curator × viewer; "an owner column holding no string is no owner": a NULL, absent or numeric owner never matches a viewer whose id is its String form, nor reaches the follower seam; and, for the write and history gates, "the write and history gates confirm existence …" on an owned leaf and "a reference leaf's write and history gates answer a hidden row as get does"); for edges, get / list in src/edges.ts (see EDGE-001); for routable content, resolve in src/paths.ts, which reads the node through the leaf's own get, so a hidden node's path, and an alias to it, is PathNotFound, never a redirect (PathTaken says only that a path is taken, never by whom, as a unique-key conflict does), tests/paths.test.ts ("answers a hidden node's path, and an alias to it, as not found …"); for the WordPress adapter's ids, integerIds / stringIds in packages/pulpit-wordpress/src/Ids.ts, where a wire id the codec doesn't know and one that is no WordPress id at all both decode to none, which the adapter answers as a hidden row; packages/pulpit-wordpress/tests/ids.test.ts ("answers none for … without reading the codec", "answers a malformed id exactly as an unknown one"); for the PostgreSQL search branches, searchOver in packages/pulpit-drizzle-pg/src/internal/rows.ts (makeSearchBranch, a gated leaf's searchBranch), which renders the scope into the ranking statement, packages/pulpit-drizzle-pg/tests/integration/search.test.ts (every viewer × includeDeleted against makeInMemorySearchBranch, and "ranks the expected hits, best first, and honours the limit", where the anonymous reader's top hit is the best one they can read)
EDGE-001 An edge is readable only if the viewer can read the node at every end, each checked by its own leaf's access rule. An end whose node is missing or hidden hides the edge: get fails EdgeNotFound, list omits it (so a related list omits it too), and a create naming such a node fails NodeNotFound before the write gate runs. A tombstoned end hides the edge from every viewer below the view-deleted rung; that rung reads the tombstone by its leaf's access rule, as the leaf's own get does, so it can list, get and delete an edge whose only hidden end is tombstoned, while an end hidden for any other reason (a private node below the view-private rung) still hides the edge from it. A create naming a tombstoned node is NodeNotFound to every caller, the rung included. The list filter and the per-endpoint predicate are one rule in two readings and never disagree. Edge membership (memberFilter) applies the same list filter, so an edge the viewer can't read never makes a node a member of another leaf's list (?categories=<hidden term> confirms nothing). An ordered collection (./Collections) applies the same rule to its members: list omits a member the viewer can't read, from the page and from its total; append and resync adopt only members the writer can read; and a versioned family's recorded order, which names every member, stays out of the parent's resource through hideRecordedOrder. The parent's history still shows it, behind the write gate (READ-009). Tombstoning a node deletes none of its edges; restoring it brings them back. pulpit's own rule, introduced with ./Edges. What a write discloses (create runs ends → write gate → unique-key collision → cardinality count): no hidden edge's state beyond the collision residue below. maxEdges counts only the edges the caller can read whose every end is live, so EdgeCardinalityExceeded depends on readable edges alone. EdgeConflict carries only the family's type, so under "fail" a collision with a hidden edge answers exactly as one with a readable edge; under "ignore" only a readable, live edge resolves to { created: false, id }, and any other collision (a hidden edge, or one with a tombstoned end, the view-deleted rung included) is EdgeConflict. Accepted trade-offs: the limit holds per caller, so a writer who can't read every edge at a node can take it past maxEdges in all, and restoring a tombstoned partner can put a node past its limit (the next create there still fails); and a collision still says the key is taken, which, in a family whose unique key leaves an end out, tells a writer that some edge it can't read holds the key when no readable one does (not which edge, nor at which node). A family that must not reveal even that should key on every end. canViewEndpoint, endpointFilter and defineEdgeOps (its memberFilter included) in src/edges.ts; tests/edges.test.ts and defineCollection / hideRecordedOrder in src/collections.ts (tests/collections.test.ts: "resync adopts only members the writer can read …", "keeps the recorded order out of the parent's resource …"); in tests/edges.test.ts ("memberFilter: edge membership never disagrees with EDGE-001's per-edge predicate"; "EDGE-001: the endpoint filter never disagrees …", including "a tombstoned node, by rung"; "EDGE-001: an edge is readable only if every end is"; "EDGE-001: a tombstoned end hides its edges below the view-deleted rung …"; "EDGE-001 by rung × end state …"; "what a create discloses: nothing that tells a hidden edge from a readable one, or from none"; "counts only edges whose other end is live …" and "a restore may bring a node past its limit …"; "an owner column holding no string is no owner": a NULL, absent or numeric owner on an owned end never matches a viewer whose id is its String form, nor reaches the follower seam, and the list filter agrees with the per-endpoint predicate; "a reference end whose leaf declares a followers column": the filter agrees with the predicate, and the predicate with the endpoint leaf's own get)
EDGE-002 An edge is never updated, with one exception: on a family that declares a validity interval, closeValidity sets the interval's end column, and nothing else, to an instant that narrows it (never after a closed end, never before the start). Every other change to an edge is a delete and a new create. The exception keeps a closed office holding or membership as the record it is, rather than deleting and re-creating it under a new id; it touches no version chain (an edge has none). Its read gate is EDGE-001's: a missing or hidden edge is EdgeNotFound, checked before the write gate. While the interval is open, maxEdges counts only the edges whose intervals overlap, so closing one frees its slot from that instant on. closeValidity and defineEdgeOps in src/edges.ts, the EdgeStore.closeValidity contract (docs/seams.md → EdgeStore); tests/edge-validity.test.ts ("closes an open interval, updating only its end …", "only narrows …", "gates a close …", "counts maxEdges only over the edges valid at the same time"); for PostgreSQL, closeValidity in packages/pulpit-drizzle-pg/src/Edges.ts (UPDATE … SET <column> = $to WHERE id = $id, the end column alone), packages/pulpit-drizzle-pg/tests/integration/edges.test.ts ("closeValidity sets the end column alone; delete removes the edge")

Existence disclosure by the write gates

The read operations hide a row the viewer may not see (SEC-AUTH-ENUM-001). The write and history gates of an owned leaf are a deliberate exception. Each one tells a signed-in caller whether an owned row exists. A reference leaf's gates are not an exception: they hide a row as get does. The disclosure is accepted because it needs a signed-in account and a caller must already hold a node id to probe it. Ids the version chain mints (a VersionChain.create with no id, or the kernel's hook layer) are UUIDs, so they can't be guessed; an application that lets callers choose their own ids makes them guessable and weakens this. The gate says only that the row exists. It reveals no content, no visibility and no owner. A change to this rule is a behaviour change with a changeset, and the test pins below change with it.

What each gate answers(paths under packages/pulpit/):

  • ./Subtype, owned leaf: requireWriter in src/subtype.ts. update, restore, delete, getVersion, compare and restoreVersion all run it first, through defineSubtype's writer (getVersion and compare through one shared history-read path).
    • An anonymous caller gets Unauthorized before any row is read. The answer is the same for every id, existing or not, so it discloses nothing. This is deliberate.
    • A signed-in caller makes the gate read the row's owner (LeafStore.ownerOf, the core.node_owner record). No owner fails NodeNotFound. The owner or the moderate rung passes. Anyone else fails Forbidden.
    • The gate never reads the row's visibility, draft or delete state. So a stranger gets Forbidden for a private, followers-only or draft row, and for a tombstone whose owner record remains, exactly as for a public one. To a caller the gate refuses, NodeNotFound therefore means only that no owner record exists.
    • getVersion and compare are reads, but they are gated like a write (READ-009). A stranger gets Forbidden even on a public row.
    • Only a caller the gate admits reaches the chain, so only that caller learns the chain's errors: NodeNotFound for a tombstone on update, VersionNotFound, StaleVersion and VersionConflict.
    • Tests: tests/subtype.test.ts pins this behaviour in "the write and history gates confirm existence: a stranger gets Forbidden on every hidden row, the anonymous Unauthorized" (a private, followers, draft and tombstoned row, and a missing id, on all six operations, getVersion and compare also at a version no row has), and in "the write gates" ("an owned write admits the owner …", "a missing owner on an owned leaf is NotFound …"), "a stranger cannot write; the owner can …", "the version history is gated like a write …" and "gates first: a caller who may not write learns Forbidden, never the head".
  • ./Subtype, reference leaf: requireWriter and requireCreator, then get's read check. Both gates are a pure role check at the corpus-write rung (atRung), and neither reads a row. Anonymous gets Unauthorized and a signed-in caller below the rung gets Forbidden, for any id, so neither discloses anything. Test: "a reference write needs the corpus rung and never loads an owner".
    • For update, restore, delete, getVersion, compare and restoreVersion, defineSubtype's writer then reads the row through visibleRow, the check get itself runs. A row that is missing, or that get hides from the caller, fails NodeNotFound before the chain is reached, so no content is read and nothing is written. get hides a row whose visibility isn't exactly public (when the view has a visibility column) from a caller without the view-private rung, and a tombstone from a caller without the view-deleted rung (PUB-009). So only the view-deleted rung can restore a tombstone, or delete one (idempotently) without learning NodeNotFound; a tombstoned private row needs both rungs.
    • A missing id answers NodeNotFound on all six operations, getVersion, compare and restoreVersion included (the chain alone would answer VersionNotFound), so a hidden row and a missing one are indistinguishable.
    • Only a caller who can get the row reaches the chain, and so learns its errors: NodeNotFound for a tombstone on update, VersionNotFound for a version with no row, StaleVersion and VersionConflict.
    • Because the check is get's own, a change to the reference read rule (such as followers on reference leaves) changes these gates with it.
    • The check is against the row's current state. A caller who can get the row can read every earlier version through getVersion, including one written while the row was private.
    • Tests: tests/subtype.test.ts, "a reference leaf's write and history gates answer a hidden row as get does". It runs every row (public, private, followers, out of the enum, a null visibility, a public draft, a tombstoned public and a tombstoned private row, and a missing id) × every caller (anonymous, below the corpus rung, the corpus rung with neither view rung, with view-private only, with view-deleted only, a moderator, an admin) × the six operations (the history reads also at a version no row has, on either side of a compare). Each answer must equal what that caller's get of the row implies, a refused operation must write nothing, and a refused history read must read no version. "compare: getVersion's gate, then the chain's compare" runs every owned row (each visibility, a draft, a tombstone, an ownerless row, a missing id) × every caller × version pair (absent on either side) and requires compare's answer to equal getVersion's for from and then to.
  • ./Subtype, requireCreator on an owned leaf. Any signed-in account passes. The gate reads no row. But create takes a caller-supplied id (subtypeHandlers passes the client's input through), and the chain fails NodeAlreadyExists when that id already has a head (F-OP-02, src/version-chain.ts). Any signed-in caller can therefore probe an id for existence through create, on an owned leaf, and so can a corpus-rung caller on a reference leaf. This answers for any node, whatever its visibility, delete state or owner.
  • ./Edges: create and delete in src/edges.ts. Both check visibility before the write gate runs. create reads each end's node first, and an end the viewer can't read, or a tombstoned one, fails NodeNotFound for every caller, anonymous included. delete answers an edge that is missing or hidden as EdgeNotFound (the view-deleted rung reads, and so may delete, an edge whose only hidden end is tombstoned). The gate's Unauthorized / Forbidden therefore never confirms a hidden node or edge. rungGate / corpusWriteGate are pure role checks. A gate the application supplies (EdgeWriteGate) may read an end's owner.
    • Past the gate, create discloses no hidden edge's state. The cardinality count reads only edges the caller can read with every end live, so EdgeCardinalityExceeded answers a node holding hidden edges as one holding none. A unique-key collision is EdgeConflict, carrying only the family's type: under "fail" a collision with a hidden edge answers exactly as one with a readable edge; under "ignore" only a readable, live edge resolves, and otherwise it is EdgeConflict.
    • What remains is accepted: a limit that holds per caller (a writer who can't read every edge at a node can take it past maxEdges), and a collision that says a key is taken, which, where the unique key leaves an end out, tells the writer some hidden edge holds it. Both are under EDGE-001.
    • Tests: tests/edges.test.ts, "what a create discloses: nothing that tells a hidden edge from a readable one, or from none". A contributor's creates at a node holding 0, 1 or 2 hidden edges answer alike, at limits 1 and 2; a collision with a hidden edge answers exactly as one with a readable edge under "fail", and as the unresolved EdgeConflict under "ignore", below and at the limit; under "ignore" an edge with a tombstoned end never resolves, to the view-deleted rung either ("resolves a collision only to a readable edge whose every end is live …", "never resolves a race to a winner with a tombstoned end …").

There aren't any published security advisories