How rowstile is checked
Nobody outside the project has audited rowstile. This page says what does check it, so that you can judge for yourself. Every line names the test that does the checking; they all run in CI, in the open, and the table of suites lists every one.
Two ways to answer, which must agree
rowstile answers "may this person do that?" in two ways: with lookups into views for reads and lists, and with a check of the single row for writes and authz.can. They are written separately, and they must give the same answer. After every random change, tests/difftest.py asks both, for every user, and compares.
A second implementation
Tests written by the author of the code share the author's mistakes. So the answers are also compared with a second implementation: the reference evaluator (authzlib/evaluate.py), which works straight from the policy, on sets of ids, to a fixed point, and knows nothing of the SQL the compiler writes. The two share one thing, the parser: a policy misread there would be misread by both, and they would agree. So the evaluator is held to answers that neither of them wrote, below.
- A second reading of the language: the editors' grammar (
editor/tree-sitter-authz) was written apart from the parser.tests/parse_agreement.pyhas both read every policy in the repository, two hundred random ones and the small policies up to size four (1,379, each written two ways: as listed, and with its names swapped and its parts turned round), and compares what they read: the types, each relation's sources, the permissions with their grouping, the rules, the sync lines, each line of the tests part by part, and of a policy that includes a file, its own lines. They read each one alike. Each night they read all 130,431 small policies, and each written another way where that is a policy. (The grammar takes more than the parser does, as an editor must: what the parser refuses isn't compared.) - Random data:
tests/difftest.pyfills six policies' tables with random rows and makes random changes to each (moves, links, loops, groups inside groups, inheritance through two types at once, shares that start and end, ids that change,TRUNCATE, several statements in one transaction): fifteen on each push, a hundred in the full run, and five hundred with a new seed in each night's soak. After each change,authz.can,authz.list,authz.explain,authz.who, what row-level security lets each user read, every rule's condition and the masked views are compared with the evaluator's answer. One user a change, in turn, is also askedauthz.listin pages of two: the pages, one after another, must be the whole list in key order, as the database orders the key (a text key by its collation).authz.explainis asked by each user too: about a row they can't see, it must say nothing more than about a missing one. So isauthz.explain_rule: nothing about such a row, and on the others, for an update or a delete, the rules' own answer. A quarter of the changes aim at the parts of the policy (a source, a part of a permission, a depth of inheritance) that haven't yet decided an answer. The run ends with a report of the parts that never did, whose SQL was never judged there (tests/decisions.py): it is for people to read, in the run's log, and fails nothing. - Random policies:
tests/genpolicy.pywrites policies at random, with their tables and data, and checks them the same way: in the full run each night, the few policies, of a thousand, in which every two of the shapes below meet (twenty-three), and a hundred with new seeds every night. A third of them name their tables and columns as an app's own may be: with capitals, with words SQL reserves (select,order,user), with a quote or an accent, or as long as Postgres allows. Every name the compiler writes into SQL is then one it must quote. Nearly half give their keys another type thanbigint:int,textoruuid; some key their rows by two columns, an org's and the row's own. Half of those withtextkeys make them words, not numerals: with a space, quotes of both kinds, capitals, accents, a dotted and a dotlessi, one the start of another, in an order each collation has its own of (Bcomes beforeabin the C locale, after it in English). A key folded to lower case, or compared in another collation than the database's, then changes an answer. Some put two types' rows inside each other, so that one recursion runs through both. Some have caveats, which some of their shares carry, and some scopes, with which one user is asked again after each change. Some mask a column in a view, and some give permissions by custom roles, or share by links; some rules say they are checked before or after the change, some are on two columns. Some share by the type'sshare, to every service (bot:*), or make a share a link of a tree; some link tables name the type of the row they link to; some permissions read who is signed in, or another table. A quarter are written in two files, one including the other. - Random worlds: the two above compare answers in one setting: plain tables, and the owner's session switched to the app role.
tests/around.pytakes the random policies again and draws what is around each one too, under the names and with the keys the policy drew (the awkward names,uuidandtextkeys, text keys that are words, keys of two columns): tables that are partitioned, or have a table that inherits from them (the governed tables, the users' table, the link tables); a database in the C locale, in LATIN1, or in Turkish, wherelower('I')is noti; default privileges of the owner's; a login role that is a member of the app role and signs each user in, withauthz.act_asor with the user's own API key or JWT (limited to a scope, for the one asked with a scope); planner settings, a read-only transaction, a search path that starts with a schema of decoys; and, halfway, something changed behind the policy's back (a grant on rowstile's own tables, row-level security turned off, a new partition). Besides the comparisons above, asked in that session, it tries real writes as the app role on every row and undoes them (updates, deletes, and inserts of rows like the ones there), shares too (against who may share and what the relation'sshared ifsays of the share), checks that no share outlives its row, that a role the policy doesn't name gets nothing, and thatauthz.lint()reports what changed androwstile applyputs it right. A few on every run; in the full run each night the two dozen or so worlds, of a thousand seeds, in which every two of those features meet (words for keys in the Turkish database among them); sixty with new seeds every night. - Every small policy: a random draw can wait long for the one small policy, and the one small world, that a mistake needs.
tests/small.pylists every policy of the core language up to a size instead, each once (two that differ in their names alone, or in the order of anor's or anand's parts, are one): the user type with or without awhere; one object type, or two, the second naming the first; relations from each kind of source (a column, a link table or shares; to users, touser:*, toanyone, to a link, to a group's members; aparentfrom a column, from a link table, or from a pair of columns or a link table naming two types; anupfrom a column, a link table or shares); one or two permissions a type, each of up to three parts joined byor,andandand not, or one ofsigned_in,anyoneandnobodyalone: inheritance, and denies. Up to six sources, parts andwheres there are 94,599, and 35,832 of seven with a deny (the whole of size seven is out of reach). For each, the reference evaluator answers in every world of one and two rows of each type (up to 400 of each; a column false, true or NULL where its table lets it be), and in some of three; in each, the same policy written another way (its names swapped, its parts turned round) must get the same answers. Then each part of the policy is made wrong in turn (held by nobody or by anyone, anandfor anor, anotleft out, a link read the other way round, inheritance one step deep), and the few worlds that tell every such part apart are loaded as rows (two or three a policy), with the world where the policy grants most and one drawn (the database's own mistakes need not look like a part made wrong): forty policies applied as one, and difftest's checks hold every answer of the database's to the evaluator's. Each push checks those up to size three and the denies of four (122); each night, a fourteenth of them all; every two weeks, the whole list. - Answers worked out by hand: each paragraph of the language's reference that says who may do what, given a policy and rows, carries an anchor readers don't see, and each anchor has a case whose answers were worked out from that paragraph, by hand, and written down before anything ran.
HandAnswersintests/unit_test.pygives the reference evaluator the cases it can answer: small policies and worlds,notand parentheses, inheritance through any mix of sources and stopped by a condition or a type'swhere, a suspended user, groups inside groups and in a loop, each kind of subject (user:*,anyone, a link, a service), a relation followed to a user's own permission, a deny inside inheritance, custom roles with and withoutfromand a folder moved to another org, NULL in conditions, an invariant asked as a service and as nobody.tests/hand_answers.shgives the database those that are its alone to answer, as named tests intests/hand/: a share that expires or starts later, a caveat,shared if, who may share, a write checked before and after, column rules, an insert, a masked column,thisand a bare column in a subquery, conditions read with the policy's rights, a polymorphic pair naming a type the policy doesn't have, keys of two columns and keys that are text, a group named by a permission (team#manage), a relation declared again for another type. A unit test fails when an anchor has no case, or a case names none. - Conditions, against Postgres:
rowstile proveand the review read simple conditions ({not archived},{size > 10},{owner_id = authz.uid()}) themselves, in worlds they make up. difftest never does: it asks the database. Sotests/conditions_test.pymakes conditions up at random over columns of each kind, some named in quotes, with decimals among the numbers, and each one the evaluator reads itself must get Postgres's answer on every row: three thousand on every run, fifty thousand with new seeds every night. Two of the columns tell texts apart otherwise than byte by byte: one under a collation that ignores case, accents and punctuation, and achar(3). A made-up row holds a text the conditions name or another, so two texts a column may hold as one value are left to the database, and the run asks Postgres which texts are one value, two by two, under five such collations and as eight types (a date, a uuid, a tsvector...): each such pair must be one the evaluator leaves to the database. - The review, against the database:
rowstile reviewsays whether a pull request that rewrites permissions grants the same as before, from small worlds made up for the two policies; it reads no database for that.tests/rewrites.pyholds that verdict against one. It rewrites a permission or a select rule of random policies, in ways that change nothing by whator,andandnotmean (its parts turned round, a part said twice, a part absorbed) and in ways that may (anandfor anor, a part dropped, one relation in place of another). Where the review says "grants the same", the database's own answers on the policy's data, for everyone, before and after the rewrite, are the same too; and a rewrite that changes nothing is given no difference by either, and is refused by the compiler only for a shape the language limits (how a permission recurses or inherits, whererolesis said). The first difference the review shows for each policy is replayed in a database: the small world it was found in, made as rows, gives the user the answers the review says, under the policy and under the rewrite. A condition the review doesn't read (a subquery) holds where the rows say, which may not be where the world says. So what the rows hold is read back: they must hold the world but for such conditions, and the database must answer as the reference evaluator does on them. - Changes that change nothing: a policy written another way says the same, and data renumbered is the same data.
tests/invariance.pywrites each random policy three other ways: its blocks, the lines in each and the operands of everyorandandin another order; its blocks spread over files it includes, one included from a folder below; its expressions broken over lines, then formatted byrowstile fmt. Each compiles to the same objects, read back as migrations read them, each made by the same SQL but for the order things come in, the lines they are on and the names the compiler numbers as it meets them (not a rule on columns: Postgres fires a table's triggers in the order of their names, so each is named after its rule). The SQL is read as SQL, not as a set of words: the operands of anoror anand, the items of a list and statements that don't read what another sets may come in another order, but anandin place of anor, or an operand moved across one, is another SQL. Each is applied, and every answer on the policy's data is the same: lists (whole, and in pages of two), checks, the rows each select rule shows, who holds what, why a write would be refused, which rule on columns refuses an update two of them guard, the invariants. Then every key of each type is replaced by another drawn at random, in the rows, the link tables, the shares and the custom roles, and the answers are the same, mapped back. One policy and the nine fixed policies' SQL on every run; eight policies, and the fixed policies' answers, in the full run each night; twenty with new seeds every night.
The boundary
The app role is the one rowstile doesn't trust (the threat model says who is trusted with what).
tests/adversarial.shlogs in as the app role and tries to read hidden rows (by id, withCOPY, through leaky functions and prepared statements), to reach rowstile's own tables and functions, to turn row-level security off, to change or share what it may not, and to learn whether a hidden row exists. It also checks the catalog each policy leaves: which functions run with their owner's rights, and that the app role may call the API and nothing else.tests/sessions.shchecks that the app role can't choose who is signed in by setting a variable, widen an API key's scopes, or reuse a sign-in in another transaction or connection. Whenauthz.who,authz.explain,authz.who_amongorauthz.check_invariantsfail half way, signed in as someone else, the transaction goes on signed in as before: the same settings and signature, the same rows seen and changed.tests/identity.shcovers API keys and JWTs: a bad signature, an expired token, one without an expiry,alg: none.- Every refusal the runtime can raise is asked for by its words by some check, not only by its error code (two guards that answer with the same code look alike), and words several functions raise (
no type ... in the policy) beside the name of each function of the API that raises them:Guardsintests/unit_test.pyfails when one isn't.
Trees, under load
Inherited permissions are kept in tables by triggers, and those tables must match the tree at every commit. tests/interleave.py runs two writes to a tree in two sessions, in ten worlds: the docs app's folders (a folder created, moved, linked, unlinked, deleted, given a new id, shared, unshared), with its sync index (a preview); the same twice more, the index keyed by folder, and brought up to date by a worker after commit; a tree of two types whose condition reads another table (folders and projects); a tree on a partitioned table, whose links and the table its condition reads each have a table that inherits from them; a tree of two types linked by their own columns, whose condition reads the tree's own table; the docs app without its sync index, whose own locks would hide a missing lock of the trees', twice (the second where a write of more than one folder takes its whole type); and two trees of one type that differ, one through a share that is a link, twice (the second where a write is to the second tree alone). Each of the 232 pairs runs in every order of its steps that Postgres allows (a read, the write, the commit: 3,626 of the 4,640 orders written out), with each session at each isolation level, 32,634 schedules. Where a world's two writes are to different parts of a tree, neither may wait for the other or fail on it, at any level. It sends one step at a time and asks Postgres which session waits for a lock, so no order depends on timing. After each, the tables are compared with a rebuild (and the sync index with what it should hold), what authz.list says with the reference evaluator, and in SERIALIZABLE the rows with the two transactions run one after the other. In READ COMMITTED no write ever needs a retry. Each change runs it in READ COMMITTED, and every night at all three levels on 16, 17 and 18. tests/stress.sh lets sixteen clients write one tree at once; after it, the tables are compared with a rebuild, and the biggest moves on the tree it leaves are timed alone.
Proofs in small worlds
rowstile prove takes a policy's invariants ("never: someone views a workspace of an organisation they aren't in") and looks for a small world in which one fails: a few users, a few rows, every way of linking them, and at each size worlds where every condition holds on every row or on none (a counterexample that needs several at once is rare in worlds drawn row by row); then worlds where most links hold (a long and of them), and chains of objects one link longer than the policy reads deep. It answers with the smallest counterexample, or says that there is none among the worlds tried. A counterexample is the world as you would make it: its rows, its links and shares (one to user:* says so), the custom roles given, the values its conditions read, and the rows each type's where keeps. It is a search, not a proof for worlds of any size, and it reads the policy, not your data.
What ships, and what the docs say
- Migrations: for each kind of policy change,
tests/migrate_test.pychecks that the migration leaves exactly what applying the new policy whole leaves: functions and their privileges, views, triggers, policies, the inheritance rows. - Upgrades:
tests/upgrade.shinstalls the release before this one from PyPI and makes the docs app's database with it, each way an app may have one: pushed to, applied, set up by migrations. The app shares, makes an API key and asks for access. This version then upgrades each database as the app would, and each holds what applying this version on a new database leaves, down to the columns of the tables rowstile keeps across applies; the policy's tests and the scenario pass, and what the app made before still works. The release before is one from 0.1.0-beta.1 on: the beta started afresh, and no alpha is upgraded from. The beta is out, so a run that finds no release to upgrade from fails: it doesn't pass having checked nothing. It also makes a world of data the way the random checks do: shares in every state, links, moves, through that release's own triggers andauthz.share; every night it does all of this from every release on PyPI from the beta on. Each release is upgraded with the docs app it was released with: a copy in the tests where it differs from today's (tests/docs_app.py), so a change to the docs app that an old release would not compile leaves its upgrade checked. After the upgrade, byreapplyand by the next migration,authz.cananswers every user, object and permission (1,277 checks) as on a new database with the same rows, all of difftest's questions get the reference evaluator's answers, and the catalog and the inheritance rows are the new database's. - Cut half way:
tests/interrupt.pyrunsrowstile apply(on a new database and over a policy),push,reapply --forceand both migrations of a change that builds an inheritance table beside the one in use, on the docs app, and cuts each after one of its statements: the server ends the session, or the connection is closed under it. After each cut the command says it lost the database and why (the server's words, when the server ended the session; exit 2), the database is as it was before the run, and the app, reading as the app role just before the cut and after it, gets the old policy's answers, whole; after some, the next run leaves what an uncut one does. Between the two migrations the old policy is in force. Each night, after every one of their statements (about 25 minutes); on each push, ten cuts of each. The real command is also ended while one of its statements waits for a lock, and stopped bystatement_timeout; androwstile review --dbas soon as it signs in. Every night the soak cuts the first apply of twenty-five other policies, random ones among them, where its seed says. - Reads that stay fast: where a read or a list needs a permission's starting points (a function that works them out), Postgres runs it once, not again for each row a nested loop looks at.
PointChecksintests/unit_test.pychecks the compiled SQL of six policies and a random one for it, andtests/confidence_test.pycounts the calls of a list of seven rows on that random policy: 76 on PostgreSQL 16, where calling the function for each row made 10,768 and took over a second. - The parser:
tests/fuzz_parser.pyfeeds it thousands of broken policies, each made from one of the suites' own with the language's words put in; each is accepted, or refused with a line number, never a crash. Every nighttests/fuzz_coverage.pygives the parser and the compiler twenty minutes more under Atheris, a fuzzer that watches which branches each input reaches and works from the ones that reach new ground, held to the same rule. - The docs: the getting-started guide runs as written, its Python too, against the client it writes; the policy and the SQL the README and the site's home page show apply and run; every line of policy and tests the cookbook shows is in a recipe that is applied and tested, the SQL it shows runs, and every line of code on the stack pages is in an app whose tests pass. Every block of code in the reference runs too, or says why it can't, and each promise these pages make, and the reference's, names the check that holds it in a comment readers don't see, or says why none does.
- Three versions of Postgres: on PostgreSQL 16 for each change, every suite but genpolicy's random policies and the stress test, in shorter runs, with the orders of two tree writes in READ COMMITTED alone; the full run, with them all, on 16 every night. On 17 and 18 every night, the suites as 16 runs them for each change, every order of two tree writes at each isolation level and the stress test; and the soak, the random checks' long run, on one of the three each night in turn.
- The suites themselves: each passes as many checks as
tests/check_counts.txtsays, no fewer and no more, or the run fails. A suite that stopped checking something (a glob that matches nothing, a loop over an empty list, a test that skips) can't stay green unseen. Nor can a suite that didn't run at all: each part of each run must have a result for every suite counted there. - What the database runs: for each change the suites run on PostgreSQL 16 with plpgsql_check's profiler on (in the test image: rowstile itself needs no extension), and
tests/coverage_report.pylists each statement and branch of rowstile's PL/pgSQL that no suite runs, by kind of function, eachRAISEfirst. It reads each function's source to know which statements begin which branch, and holds that reading to plpgsql_check's own figures. On 14 October 2026 the suites ran 2,926 of 4,551 statements (64%) and 1,634 of 3,046 branches (54%); 26RAISEstatements in functions they call were not reached. Checks for each followed: the same day, with the policy part run again, 3,016 of 4,698 statements (64%) and 1,695 of 3,194 branches (53%), and everyRAISE. A rule on columns counts once for each form of its refusal (a key of one column, of several), not once per policy. A function Postgres counts as called whose statements the profiler read none of is listed: a GRANT, a REVOKE or an apply after the calls made its catalog row anew, and the counts with it. A change fails if it leaves more of the runtime's own PL/pgSQL (authz) or of the rules' (authz_gen) never run thantests/plpgsql_floor.txtsays, and one that leaves fewer writes the file anew, so the count only goes down. A line only functions no suite called hold, of a kind a suite calls in other databases, isn't counted there: it is a policy's own line (WHEN 'tree' THEN ...) along a path other policies' functions run. The policies' own functions (authz_int) are reported, not held: the random checks write other policies on each run, and their counts move with them.
Every feature, and what checks it
Every feature is in one list, tests/features.py: each authz.* function, each command and its flags, each setting of rowstile.toml, each form of the language, each error code, what each SDK exports, the language server's methods, the MCP server's tools and Studio's routes, each in one feature. A feature names the page that documents it, its fixed checks, and the checks that hold it to an answer the code didn't give: the reference evaluator, a rebuild, the policy applied whole, Postgres. The list is read against the code, and Features in tests/unit_test.py fails on each push when a part of the surface is in no feature, when a check the list names is gone from its suite (or left in a comment), when no suite gives a flag to its command or sets a setting, when a feature of tier 1 (it decides access, grants or revokes it, or keeps data) has no check against another answer, or when a refusal isn't asked for by its words. Every feature that grants or revokes access is in tier 1. Requests for access, breaking the glass and access reviews are tried by one user in each snapshot of the random changes, each attempt undone, and held to the reference evaluator: what each call says, the requests it shows, the shares it makes or revokes, and the lines it writes in the audit trail. Tier 2 is otherwise an answer shown to people, tier 3 the tools around them. python3 core/tests/features.py --matrix prints each feature against each suite.
| feature | tier | documented in | fixed checks | held to another answer by |
|---|---|---|---|---|
Checks and lists: authz.can, authz.list, authz.perms, authz.perms_of | 1 | app-code | scenario.sql, devx.sh, capitals.sh, adversarial.sh | difftest.py, small.py, invariance.py, upgrade_world.py, hand answers |
Inheritance tables that match a rebuild: authz.verify | 1 | app-code | scenario.sql, moves.sh, keep.sh, apply.sh | difftest.py, interleave.py, stress.sh |
Who holds a permission: authz.who, authz.who_among | 2 | app-code | devx.sh, principals.sh | difftest.py |
Why, or why not: authz.explain, authz.explain_rule | 2 | app-code | devx.sh, adversarial.sh, docs_test.sh | difftest.py |
Shares: shared, shared by, shared if, their start and end; authz.share, authz.unshare, authz.list_shares | 1 | language | multi_scenario.sql, governance.sh, concurrency.sh, scenario.sql, principals.sh, devx.sh, policy_errors.py | difftest.py, around.py, genpolicy.py, hand answers |
Share links: link, authz.create_link, authz.list_links, authz.revoke_link | 1 | app-code | multi_scenario.sql, adversarial.sh | difftest.py, genpolicy.py |
Custom roles at run time: authz.create_role, authz.set_role_permissions, authz.delete_role, authz.roles_of | 1 | app-code | multi_scenario.sql | difftest.py, genpolicy.py, hand answers |
Signing in: authz.act_as, authz.login_key, authz.login_jwt, authz.view_as, authz.principal, authz.connection_check, authz.session_limited, authz.sign_out; signed sessions, one principal a transaction | 1 | identity | sessions.sh, identity.sh, principals.sh, integrations/fastapi | around.py |
Tokens an identity provider signs with its key (RS256): authz.set_jwks stores its key set, which authz.login_jwt checks them against; rowstile jwks fetches it and stores it | 1 | identity | identity.sh, cli.sh, unit_test.py, sessions.sh | around.py |
API keys: authz.create_api_key, authz.list_api_keys, authz.revoke_api_key | 1 | identity | identity.sh, principals.sh, children.sh | around.py |
Group sync from an identity provider: authz.sync_members | 1 | app-code | identity.sh | difftest.py |
A SCIM endpoint for an identity provider's users and groups, answered in SQL: authz.scim, and authz.set_scim for what it reads | 1 | identity | scim.sh, integrations/fastapi, integrations/nextjs | difftest.py |
Requests for access and breaking the glass: authz.request_access, authz.decide_request, authz.cancel_request, authz.pending_requests, authz.break_glass | 1 | governance | governance.sh, concurrency.sh | difftest.py, hand answers |
Access reviews: authz.start_review, authz.review_items, authz.review_decide, authz.close_review | 1 | governance | governance.sh, principals.sh | difftest.py |
The sync index, a preview: sync role, sync <table> : <permission>, authz.sync_tick, authz.sync_verify | 1 | sync | sync.sh, policy_errors.py, interleave.py, stress.sh | difftest.py |
PowerSync's mirrors on the sync index, a preview: with mirrored on a sync line, a copy of the table in authz_sync, every column but the masked ones and each row's readers, for PowerSync's streams | 1 | sync | sync.sh, children.sh, migrate_test.py, policy_errors.py, unit_test.py, cli.sh, integrations/powersync | difftest.py, integrations/powersync |
A sync line keyed by a type's inheritance, a preview: sync <table> : <permission> by <type> | 1 | sync | sync.sh, policy_errors.py, integrations/electric | difftest.py |
The sync index worked out after commit by a worker, a preview: sync after commit, authz.sync_work, authz.sync_behind | 1 | sync | sync.sh, policy_errors.py, interleave.py, integrations/electric | difftest.py |
Electric on the sync index, a preview: rowstile client electric's shapes, and electricShape, the route in front of Electric | 1 | sync | unit_test.py, cli.sh, integrations/electric | integrations/electric |
Zero on the sync index, a preview: rowstile client zero's tables, relationships and filters, for the app's Zero schema and its query endpoint | 1 | sync | unit_test.py, cli.sh, integrations/zero | integrations/zero |
The change feed: authz.changes_since, authz.changes_position, authz.trim_changes, authz.announce_timed_shares | 2 | governance | governance.sh, integrations/nextjs | difftest.py |
The audit trail: authz.audit, authz.trim_audit | 1 | governance | governance.sh | difftest.py |
Checking the database: authz.lint, authz.check_invariants | 2 | governance | governance.sh, adversarial.sh, apply.sh | around.py |
| What apps see of a refusal: each code's SQLSTATE and HTTP answer, the reason in the error | 1 | app-code | unit_test.py, reference.sh, adversarial.sh, integrations/fastapi, integrations/nextjs | around.py |
Applying a policy: rowstile apply, check, push, diff, remove | 1 | tools | apply.sh, cli.sh, migrations.sh, children.sh | interrupt.py, around.py, migrate_test.py |
Migrations: rowstile migrate, the lock file, trees built beside then swapped in | 1 | migrations | migrations.sh, unit_test.py, migration_tools.sh | migrate_test.py, interrupt.py |
Upgrading rowstile: rowstile reapply, migrations from an older release (from the beta on) | 1 | migrations | upgrade.sh, unit_test.py, apply.sh, cli.sh | upgrade_world.py |
Running the policy's tests: rowstile test | 2 | tools | cli.sh, devx.sh, confidence_test.py | |
Asking the database as someone: rowstile can, explain, perms, list, who, explain-rule, sql | 2 | tools | cli.sh, devx.sh, capitals.sh | |
What would grant a permission: rowstile why | 2 | tools | studio_test.py, unit_test.py | |
Reviewing a change: rowstile review, rowstile snapshot | 2 | review | review.sh, unit_test.py, confidence_test.py | rewrites.py |
One layout for policies: rowstile fmt | 2 | tools | review.sh, unit_test.py | invariance.py |
Invariants in small worlds: rowstile prove | 2 | tools | confidence_test.py, unit_test.py, cli.sh | genpolicy.py |
Speed: rowstile indexes, plans, bench | 2 | tools | capitals.sh, confidence_test.py, unit_test.py | |
The diagram, the clients, lint and help: rowstile graph, client, lint, help, --version | 3 | tools | cli.sh, tools_test.py, unit_test.py | |
The development loop: rowstile dev | 3 | tools | devx.sh, migrations.sh | |
A first policy from the database: rowstile init | 3 | tools | devx.sh, unit_test.py | |
Studio, reading: rowstile studio, the rows as anyone, why, the graph, the access diff, shares, tests | 2 | tools | studio_test.py | |
Studio, writing (--write): share, unshare, decide a request | 1 | tools | studio_test.py | difftest.py |
The language server: rowstile lsp | 3 | tools | lsp_test.py | |
The MCP server, for coding agents: rowstile mcp | 2 | tools | mcp_test.py, reference.sh | |
Types and the rows that count: type, where, app role | 1 | language | unit_test.py, policy_errors.py, principals.sh, apply.sh | difftest.py, small.py, genpolicy.py, hand answers |
| Keys: of any type, of several columns | 1 | language | unit_test.py, policy_errors.py, apply.sh | difftest.py, genpolicy.py, around.py, hand answers |
Policies in several files: include | 2 | language | unit_test.py, cli.sh, policy_errors.py | invariance.py, genpolicy.py |
| Relations and their sources: columns, pairs of columns, link tables | 1 | language | unit_test.py, scenario.sql | difftest.py, small.py, genpolicy.py, hand answers |
Subjects and principals: a type, a group's members, user:*, anyone, link, services | 1 | language | principals.sh, unit_test.py | difftest.py, small.py, hand answers |
Permissions: can, or, and, not, following a relation | 1 | language | unit_test.py, policy_errors.py | difftest.py, genpolicy.py, small.py, rewrites.py, hand answers |
Conditions: {...}, this, read with the policy's rights | 1 | language | devx.sh, apply.sh, policy_errors.py, unit_test.py, governance.sh | conditions_test.py, genpolicy.py, hand answers |
Inheritance and denies: parent.view, and {condition}, and not; moves, loops | 1 | language | scenario.sql, moves.sh, concurrency.sh, policy_errors.py, unit_test.py | difftest.py, interleave.py, small.py, genpolicy.py, stress.sh, hand answers |
Custom roles in the policy: roles : ... from ..., roles in a permission | 1 | language | multi_scenario.sql, unit_test.py | difftest.py, genpolicy.py, hand answers |
Rules: select, insert, update (before, after, on columns), delete | 1 | language | devx.sh, adversarial.sh, unit_test.py, children.sh, integrations/fastapi | difftest.py, around.py, genpolicy.py, hand answers |
Masked columns: mask, the view | 1 | language | masks.sh, multi_scenario.sql, apply.sh | difftest.py, genpolicy.py, hand answers |
Foreign keys whose action is meant: cascade from, and the warning of the others | 2 | language | apply.sh, policy_errors.py, unit_test.py | |
| Scopes: what a key or a token may do | 1 | identity | identity.sh, sessions.sh | difftest.py, genpolicy.py |
| Caveats: conditions a share carries | 1 | language | multi_scenario.sql, apply.sh | difftest.py, genpolicy.py, hand answers |
Invariants: never | 2 | language | governance.sh, principals.sh, unit_test.py | genpolicy.py, hand answers |
The policy's tests: checks, named tests, given, as, with scope | 2 | language | devx.sh, unit_test.py, cookbook.sh | hand answers |
| The Python SDK: signing in, refusals as answers, jobs | 2 | app-code | integrations/fastapi | |
| The Python SDK's background jobs, in Celery's and RQ's workers (preview) | 2 | python | integrations/fastapi | |
| The Python SDK's stacks: FastAPI, SQLAlchemy, psycopg, asyncpg, Alembic, pytest | 2 | app-code | integrations/fastapi | |
| The Python SDK's Django integration (a preview): every transaction signed in, the middleware, pytest-django | 2 | django | integrations/django | |
The TypeScript SDK: @rowstile/client | 2 | app-code | integrations/nextjs | |
The Go SDK (a preview): pgx transactions signed in, refusals as errors, net/http, a database per test package | 2 | app-code | integrations/go | |
The TypeScript SDK's drivers: /pg, /postgres, /prisma, /drizzle | 2 | app-code | integrations/nextjs | |
The TypeScript SDK for Next.js and React: /next, /react, /vitest | 2 | app-code | integrations/nextjs | |
The TypeScript SDK on Neon's serverless driver, the edge runtime, BullMQ and after() (preview) | 2 | nextjs | integrations/nextjs | |
The TypeScript SDK for Jest, a preview: /jest; a plain Node server (Express) | 2 | node | integrations/node | |
The .NET SDK (preview): Rowstile, Rowstile.EntityFrameworkCore, Rowstile.AspNetCore | 2 | app-code | integrations/aspnetcore | |
| The Ruby SDK for Rails (preview): signing in, refusals as answers, jobs, tests | 2 | rails | integrations/rails | |
| The Java SDK (preview): JDBC, and the Spring Boot starter | 2 | app-code | integrations/spring | |
| The Kotlin module of the Java SDK (preview): coroutines, Exposed and Ktor | 2 | app-code | integrations/ktor | |
| The Rust SDK (preview): sqlx and tokio-postgres transactions signed in, refusals as errors, Axum | 2 | app-code | integrations/axum | |
| The Elixir SDK (preview): Ecto and Postgrex transactions, a Plug, Oban jobs, tests | 2 | phoenix | integrations/phoenix | |
| The PHP SDK (preview): PDO, and Laravel's connections, middleware, jobs and tests | 2 | laravel | integrations/laravel |
What a review of every file found
Before the first public release, every file was read with one question: what does the documentation promise here, and does a test hold the code to it? It found 153 things to fix. Eleven were wrong access: a row seen or written that the policy didn't allow, or refused when it allowed it. Ten of those eleven were found by reading, one by the random policies. All 153 are fixed.
Then the suites themselves were tested: 44 mistakes were put into the compiler on purpose, one at a time. The suites caught 42. The two they missed got tests.
That was done again in October 2026, with twenty more mistakes for what had been added since and for checks no mistake had been tried on: 64 in all. The suites caught 60. Each of the four they missed got a test, which fails with the mistake put back.
Then the reference evaluator, whose answers the suites take as the truth: 40 mistakes put into it. The suites caught 26. One of the 14 they missed can't change an answer: the fixed point stopping when a set of ids shrinks, which none ever does. The others were answers nothing else asked for (an assignment of another org's custom role, signed_in for a service, the simple conditions), and how prove and the review make up and shrink their worlds. The answers worked out by hand and the comparison of conditions with Postgres came of that. With them, and four more mistakes for what they changed, the suites catch each of the 44 but that one.
Since October 2026 the mistakes are made by rule rather than picked by hand: core/mutants/ makes about 10,000 of them in the compiler (an operator of its SQL or its Python turned round, a term dropped, a quoting call left out), compiles every policy in the repository with each, and runs the suites on those that change what one of them compiles to, on GitHub's runners, weekly. A mistake no suite catches is listed in core/mutants/survivors.txt, either as one that changes no answer or with the check that would catch it, and one that isn't listed fails the run. Up to 20 October 2026 the runs gave a result for 2,934 of the 10,749 it makes; the rest are still to run. Of those 2,934, 2,749 change what a policy compiles to and aren't listed as changing no answer: the suites caught 2,714 of them (98.7%). Those they missed got a check, or a line in survivors.txt: why no answer changes, or which check would catch it and is still to write.
When something is found
Vulnerabilities are reported privately (SECURITY.md) and published as advisories once fixed. There have been forty-one so far, each found by the project itself: GHSA-6g93-673q-c29f, in @rowstile/prisma, fixed and published the same day; five fixed in 0.1.0-alpha.7 and five in 0.1.0-alpha.9; nine in 0.1.0-beta.1, found by the audit before it; two in 0.1.0-beta.2, three in 0.1.0-beta.3, and sixteen in 0.1.0-beta.4, found by a review of the whole code before it (five rated medium, eleven low). Each release's were published the day it came out. Three of those are rated high: a rule on a column that was not checked on the rows of a partition made since the last apply (GHSA-h92j-8v4p-93hc), the command's Postgres client, which sent the password before it honoured channel_binding=require (GHSA-g2rq-h47r-5v2c), and the TypeScript SDKs, where work a transaction started could run after it ended, in another user's transaction (GHSA-rjcp-7gwg-4mqw). The advisories are all listed there.
What this doesn't cover
- An audit by someone outside the project. There has been none.
- The limits the threat model accepts: side channels such as
EXPLAIN ANALYZErow counts, tables without rules,SECURITY DEFINERfunctions an app adds. - Managed Postgres services other than the two it was tried on.
- macOS and Windows: no machine or runner here has either. The npm packages for them are read by the packaging tests (their Python is built for that system and CPU, and holds every library and module the command loads), but not started. The Linux ones are started, x64 and arm64, glibc and musl. What the command does differently on Windows (a drive in an editor's address, paths on two drives, the console's code page, the shell's quotes, libpq's folder and its default user) is checked by unit tests that stand in for Windows, not on Windows itself.
- Your policy. rowstile enforces what the policy says; whether it says what you meant is what its tests, its invariants and the review of each change are for.