@xano/developer-mcp 2.3.0-beta.4 → 2.3.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -16
- package/dist/cli_docs/index.js +0 -4
- package/dist/cli_docs/topics/function.js +0 -2
- package/dist/cli_docs/topics/knowledge.js +1 -2
- package/dist/cli_docs/topics/workspace.js +23 -12
- package/dist/meta_api_docs/index.js +0 -2
- package/dist/meta_api_docs/topics/api.js +6 -6
- package/dist/meta_api_docs/topics/apigroup.js +2 -2
- package/dist/meta_api_docs/topics/authentication.js +1 -1
- package/dist/meta_api_docs/topics/history.js +39 -10
- package/dist/meta_api_docs/topics/mcp_server.js +6 -6
- package/dist/meta_api_docs/topics/middleware.js +1 -1
- package/dist/meta_api_docs/topics/table.js +2 -2
- package/dist/meta_api_docs/topics/workspace.js +1 -1
- package/dist/tools/validate_xanoscript.js +1 -5
- package/dist/xanoscript.js +0 -1
- package/dist/xanoscript_docs/README.md +24 -9
- package/dist/xanoscript_docs/branch.md +109 -29
- package/dist/xanoscript_docs/database.md +7 -5
- package/dist/xanoscript_docs/docs_index.json +10 -20
- package/dist/xanoscript_docs/essentials.md +42 -0
- package/dist/xanoscript_docs/file-uploads.md +4 -4
- package/dist/xanoscript_docs/mcp-servers.md +2 -2
- package/dist/xanoscript_docs/prompts.md +4 -2
- package/dist/xanoscript_docs/realtime-v2.md +4 -2
- package/dist/xanoscript_docs/resources.md +3 -1
- package/dist/xanoscript_docs/survival.md +1 -5
- package/dist/xanoscript_docs/tables.md +58 -0
- package/dist/xanoscript_docs/tools.md +1 -1
- package/dist/xanoscript_docs/triggers.md +133 -3
- package/dist/xanoscript_docs/types.md +14 -1
- package/dist/xanoscript_docs/version.json +2 -2
- package/dist/xanoscript_docs/workflow-tests.md +18 -0
- package/dist/xanoscript_docs/working.md +0 -5
- package/package.json +2 -3
- package/dist/cli_docs/topics/policy.d.ts +0 -2
- package/dist/cli_docs/topics/policy.js +0 -92
- package/dist/cli_docs/topics/skills.d.ts +0 -2
- package/dist/cli_docs/topics/skills.js +0 -57
- package/dist/meta_api_docs/topics/policy.d.ts +0 -3
- package/dist/meta_api_docs/topics/policy.js +0 -140
- package/dist/xanoscript_docs/policies.md +0 -448
- package/dist/xanoscript_docs/policy-templates.md +0 -267
|
@@ -1,448 +0,0 @@
|
|
|
1
|
-
# Workspace policies
|
|
2
|
-
|
|
3
|
-
Requires a platform build with policy support. A policy is its human description plus deterministic rules, saved as branch-scoped workspace XanoScript. Checks inspect stored definitions; nothing runs at request time. This topic is the one reference for the policy language: its syntax, fields, rules, refusal messages and versioning. The Metadata API and CLI `policy` topics cover the routes and commands.
|
|
4
|
-
|
|
5
|
-
## Quick Reference
|
|
6
|
-
|
|
7
|
-
```xs
|
|
8
|
-
policy "AUTH-EXAMPLE" {
|
|
9
|
-
title = "Require authentication"
|
|
10
|
-
statement = "Endpoints require authentication unless the endpoint or its API group is tagged public."
|
|
11
|
-
severity = "high"
|
|
12
|
-
active = true
|
|
13
|
-
enforcement = "advisory"
|
|
14
|
-
|
|
15
|
-
rule {
|
|
16
|
-
check = "object.auth_required"
|
|
17
|
-
params = {except_tags: ["public", "xano:quick-start"]}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
That block is the parser's own output, byte for byte. The key is written quoted, `policy "AUTH-EXAMPLE" {`, which is the form the platform emits in canonical source (parse results, `source` on a read, `workspace pull`). An unquoted key of letters, digits, `.`, `_` and `-` parses too, but write the quoted form so your source matches what comes back. Canonical source also fixes the field order (`title`, `statement`, `severity`, `active`, `enforcement`, then a blank line before the first rule) and the spacing of a `params` map: a map with one key stays inline with no padding inside the braces, `params = {except_tags: ["public"]}`, and a map with several keys is written one key per line with the colons aligned. Write what you like and let `policy parse` format it; do not hand-tune spacing to match.
|
|
23
|
-
|
|
24
|
-
**A policy file carries no comments.** A comment inside a policy block is refused outright, whether it sits on its own line or trails a value. `//` and `/* */` both get the same sentence, naming the line they are on:
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
line 3: policy files cannot contain "//" comments. Put the explanation in the policy's statement, rationale or narrative.
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
with `"/* */"` in place of `"//"` for a block comment. For a trailing comment — `severity = "high" // critical | high` — the message names that line and the position points at the comment, not at the value. `#` is a plain syntax error: `Syntax error: unexpected '#'`. Never annotate policy source; put the explanation in `statement`, `rationale`, `narrative` or a rule's `title`.
|
|
31
|
-
|
|
32
|
-
`enforcement` decides what a finding does. An active `blocking` policy's findings block: they refuse a merge, a set-live, a publish or push to the live branch, and a tenant deploy of a release that has them (see Gates). `advisory` findings are reported and block nothing, and a policy save itself is never gated. An inactive policy (`active = false`) is never evaluated by a branch run; an active one is. **Write a new policy `active = true` with `enforcement = "advisory"`**, the pair a policy that omits both lines gets. It blocks nothing while its findings are reviewed, and, unlike an inactive policy, it is actually evaluated, so the author can see what it reports. Use `active = false` only to park a policy you do not want evaluated at all. Policies can also include `rationale`, `narrative` and `tags`. There is no `owner` field: canonical source never writes one, and every authored path — source parse, dashboard save, Metadata API save and `workspace push` — refuses an `owner` line or key with `policy: "owner" was removed; delete the line. Ownership will return as a reference to a workspace member.` (on the source path the refusal also carries the line and column). There is no `remediation` field either, on a policy or on a rule: it is refused with `policy: "remediation" was removed; put the guidance in the policy statement.` (on a rule the sentence is prefixed by the rule's position instead of `policy:`). Long text such as `narrative` can use a `"""` triple-quoted multiline string. `tags` is a list of strings, for example `tags = ["soc2", "hipaa"]`, the same syntax as tags on any other workspace object; there is no separate framework/mapping concept, a tag is simply how a customer labels a framework.
|
|
33
|
-
|
|
34
|
-
`severity` says how much a violation of this policy matters. It orders findings in reports, and it never blocks a gate — enforcement does. Its four values are `critical`, `high`, `medium` and `low`; nothing else is accepted. It defaults to `medium`, and canonical source omits the line at that default. `active` and `enforcement` are always written, because they are what decide whether a policy blocks.
|
|
35
|
-
|
|
36
|
-
Each rule selects a built-in check and supplies literal parameters:
|
|
37
|
-
|
|
38
|
-
- **A rule cannot be named.** Only `rule { ... }` is legal; `rule foo { ... }` is refused with `A rule cannot be named. Write "rule {" — rules are identified by position (KEY.R1, KEY.R2…).` A rule takes the id `<KEY>.R<n>` from its position, so the first rule of `AUTH-EXAMPLE` is `AUTH-EXAMPLE.R1`. The same goes for the JSON form: a custom `rules[].id` is refused with that sentence, and an echoed `<KEY>.R<n>` is ignored and re-derived. To give a rule a human name, set its `title`.
|
|
39
|
-
- On an existing policy, keep the order of existing rules and add new rules at the end: stored runs cite rule ids, and ids follow position.
|
|
40
|
-
- A rule `title` is optional. An unnamed rule is displayed by its check's label — author title, else check label, else rule id, everywhere the platform names a rule. Title a rule only where its scoping makes the check's own label misleading.
|
|
41
|
-
- **A rule has no `severity`.** Both surfaces refuse it and say the same thing, prefixed by the rule's position: `"severity" is set on the policy, not on a rule.` Every finding carries its policy's severity.
|
|
42
|
-
- `params` lists only what the rule sets. Every omitted parameter takes the catalogue default, and canonical source drops any value equal to that default, so a rule that configures nothing has no `params` line. The stored document stays fully expanded, so a read's `rules[].params` lists every parameter while its `source` stays sparse. The `source` every read serves is canonical, so it can be sent back unchanged (a no-op) or edited.
|
|
43
|
-
|
|
44
|
-
`guard` and `test` blocks are reserved and refused, even when empty: `Policy block "<name>" is reserved. Policies support rule blocks only.`
|
|
45
|
-
|
|
46
|
-
## Authoring workflow
|
|
47
|
-
|
|
48
|
-
1. Read the branch's existing policies and the instance's check catalogue. The catalogue is the only source of truth for what each check reports, which object kinds it inspects and the exact parameters it accepts.
|
|
49
|
-
2. Write one `policy KEY { ... }` document in `policies/KEY.xs`, from scratch or from a template (below). Customize its key, statement and rules. The file name is the key: Studio refuses to publish a policy file named otherwise (`This file declares policy KEY, and a policy file is named after its key: rename it to /policies/KEY.xs.`). Change a key only when the user asks, renaming the file to the new key with it; never move a policy to a file named anything else.
|
|
50
|
-
3. Validate and format through the native `POST /api:meta/workspace/{id}/policy/parse` endpoint with `{source}` (and `branch`, to be warned against that branch). The result contains `{policy, source, rule_warnings}` and writes nothing; `rule_warnings` lists each rule that would do nothing or allow too much there. Read them before saving. With the authenticated Xano MCP, use its policy parse tool. The developer MCP's `xano_validate_xanoscript` checks a policy file locally first: syntax and block-shape problems (comments, a named rule, a field set twice, a non-literal parameter) are errors, and what the check catalogue decides (an unknown check, field or parameter, a value outside its set, a removed field) is a warning, checked against the catalogue the language server ships with, which can be older than your instance. A local pass is a preview; the instance's parse decides.
|
|
51
|
-
4. Save canonical source using `POST /policy` (create) or `PUT /policy/{id}` (update) with `{branch, data: {source}}`. Do not combine source with structured fields. **To change an existing policy, update it by its id** — read the id from the policy list (`xano_list_policies`, `xano policy list -o json`), take the `source` a read returns, edit it, and send it to `PUT /policy/{id}` (the authenticated MCP's save tool with `policy_id`). This is also how an inactive policy becomes active: the same policy id, with `active = true` in the source. A `POST` whose key already exists is refused, naming the policy that holds it — `A policy with key "AUTH-001" already exists on this branch (policy id 12, "Authentication baseline"). To change it, update policy id 12 instead of creating a new one.` — and a `PUT` whose source carries another policy's key says which id is which. Both are HTTP 400 with `payload.code` `policy_key_taken`, `key` (the key sent), `existing_key` (the holder's, which differs only in case when the sent key does) and `existing_id` (null when a concurrent create took the key first); branch on the code, not the sentence. A create whose rules exactly match a live policy on the branch is refused too, with HTTP 400 `payload.code` `policy_duplicate`: `A policy with exactly these rules already exists: KEY. Change a parameter or scope to add another.`, and `existing_key`, `existing_id` and `policies` (each copy as `{key, existing_key, existing_id}`). The rules are compared as a set of checks with their normalized params (scope fields are params); the key, title, statement, severity, enforcement, `active`, tags and rule titles are ignored. Only a create is refused, never an update, and a push refuses its copies before anything is imported. The `source` a read returns is canonical, so it is safe to send back unchanged (a no-op) or edited. Add an optional `message` (and `description`) to label the Version History entry the save creates. The server owns versioning: see below.
|
|
52
|
-
5. Evaluate the same branch and read its verdict and findings. A run is evidence only for the definitions it checked: every policy a read serves carries `latest_run`, the platform's answer to whether the branch's newest run still describes it (`stale: true` once the policy changed after that run, `included: false` when the run did not evaluate it). A run snapshots the policies it checked: each policy's `statement` as written at run time and, per rule, its display `label` and the resolved `params` the check actually ran with (values that resolved to nothing are omitted, and an empty map serializes as `[]`). `xano policy status --run-detail` prints them. A run can hold tens of thousands of findings, so read a large one in parts: its summary (counts, each policy's verdict, each rule's finding count) and its findings a page at a time, filtered by blocking, policy, rule, severity, object kind, object, tag or text (`GET …/policy/run/{run_id}/summary` and `…/findings`; `xano policy runs <id>` with `--offset`, `--limit` and filter flags; the authenticated MCP's run tool). An evaluation can answer that summary with its first 50 findings (`answer: "summary"`, `xano policy evaluate --summary`, and the MCP evaluate tool, which always asks for it), and the `policy_check` a push answers lists the first 100 findings beside `counts`, `total` and `truncated`: the stored run (`run_id`) has them all. A pusher without `workspace:policy` read is evaluated the same way (the run is stored) but told only their own findings on the objects the push carried (see Permissions).
|
|
53
|
-
|
|
54
|
-
Policies also travel in the platform's workspace multidoc import/export. Use the official CLI's `workspace pull` and `workspace push` flow for a local workspace (the CLI `workspace` topic covers `push -m`). The authenticated MCP supports workspace exports and one-time upload URLs for large multidocs; upload processes the source on the instance. On a branch that is not live, a blocking finding reported after a push does not roll back that import; a push to the live branch is gated before it commits (see Gates).
|
|
55
|
-
|
|
56
|
-
Inside Xano's own agent, the instance serves a platform skill named `xano-policies`, generated from the live check catalogue: this file format, every check id and its parameters, and the authoring rules. A coding agent installs the terminal variant of the same skill with `xano skills pull` (see the CLI `skills` topic).
|
|
57
|
-
|
|
58
|
-
## Starting from a template
|
|
59
|
-
|
|
60
|
-
The check catalogue response (`GET /api:meta/workspace/{id}/policy/check`) also carries `templates`: the platform's list of starting points for a policy, such as "Endpoints require login". Each template holds what a policy needs to be created from it: `id`, `category` (the id of the group it is filed under; the response's `template_categories` lists the groups in the order to offer them, each as `{id, label}`: `access_control` Access control, `data_protection` Data protection, `secrets` Secrets, `integrations` Integrations, `reliability` Reliability, `testing` Testing, `conventions` Conventions; groups cut across object kinds and are not compliance frameworks), `title` (the new policy's `title`), `summary` (its `statement`), a suggested `key`, the policy `severity`, search `keywords`, a one-sentence `limits` note on what its rules cannot see, `examples` (a map from a `needs` path to an example value that fits this template, such as `{"names": ["audit_log"]}`; `{}` when the template gives none, and a path it leaves out uses the check's own `example`) and `rules[]` of `{title, check, params, needs, needs_any}`. `params` are sparse, and `needs` names the parameter paths the author must fill; a need is never seeded. Every `needs` path is required unless the rule says `needs_any: true`, when one filled path is enough (the vendor allowlist takes hosts, providers or both); `needs_any` is false on every other rule. An example is a hint, never a value: nothing fills a `needs` path from it, so fill each one with the workspace's own names. The response also carries `recipes`, for goals that take several templates, such as protecting payment card data. Each is `{id, title, summary, keywords, frameworks, prerequisites, templates, rules, limits}`: `title` is the goal, `prerequisites` are the tags, fields and functions to set up first (a rule that judges tagged tables judges nothing until a table carries the tag), `templates` are template ids to create in order, one policy each, `rules` are `{title, check, params, needs}` where no template fits, created together in one policy of your own, and `limits` are ids from `not_checkable` (`[{id, topic, why, keywords}]`), what no rule in the recipe can see. Nothing creates a recipe: create its templates and rules the ordinary way. Topic `policy-templates` lists the templates of the catalogue these docs were generated from, each with its key, the checks it uses, what it leaves to fill, with an example, and its framework tags, then the recipes and what no check can see; prefer a template's key and rules whenever one fits the request, and when a recipe covers the goal, follow it.
|
|
61
|
-
|
|
62
|
-
In the dashboard, **Create Policy** opens the templates (**Start from scratch** is in its ▾ menu), grouped by category, with a search over each template's title, summary, category and keywords and over its rules' titles and their checks' ids, labels, keywords and first description sentence. **Choose** on a template opens the create form with its title, statement, key, severity and rules filled in, leaving only the `needs` to fill; nothing is saved or run until the author saves, and that first save starts Run Checks, unless the policy is inactive, a run is already in flight or the author may not run checks. The same form edits a policy after creation (**Edit Policy**). In the form a rule is edited in place: a row click, **Clone** or **Add Rule** opens the rule view in the same panel ("← Back to <policy>", **Cancel** / **Apply**); **Apply** puts the rule into the form, and only the form's **Save** stores the policy. On the policy page, a Rules row click, **Edit Rule**, **Clone Rule** and **Add Rule** open the rule panel directly, and its **Save** stores the policy; **Delete Rule** confirms, then saves the policy directly. A clone is named with the lowest free number ("Require auth 2"), and a rule's name is a field in its form. Every save is the ordinary whole-policy save. A template can be used more than once: a key the branch already uses gets a `-2`, `-3`… suffix, and a copy whose rules exactly match a policy the branch has is refused (`policy_duplicate`, see Authoring workflow) until a parameter or scope changes. **Add Rule** searches the checks. To author from a template yourself, find the matching one, copy its rules into `policies/KEY.xs`, fill every `needs` path (at least one of them for a `needs_any` rule) from the check's catalogue schema, and parse; with the CLI, `xano policy create --template <id>` does the same. A policy created from a template is ordinary: active and advisory, with no record of the template.
|
|
63
|
-
|
|
64
|
-
Each template also carries `frameworks`: framework tag ids, possibly none, from the response's `template_frameworks` (`[{id, label}]`, in the order to offer them: `soc2` SOC 2, `hipaa` HIPAA, `gdpr` GDPR, `pci_dss` PCI DSS). A tag marks a template on a topic that framework also covers (access control, audit logging, sensitive or personal data, secrets, data in transit, vendors, change testing). It is a second way to find templates, not a mapping to a framework's criteria: a tag never means that the template, or a policy made from it, makes a workspace compliant, and Xano does not track changes to the frameworks. The response's `template_frameworks_note` is the platform's sentence saying so; show it wherever the tags appear. The dashboard's template search also matches each tag's id and label, and `xano policy catalogue` ends each template row with its tags in brackets. A policy created from a tagged template carries no framework tag. To label a policy with a framework, add the tag to its `tags` yourself (`tags = ["soc2"]`), and never say the policy satisfies the framework.
|
|
65
|
-
|
|
66
|
-
## Versioning
|
|
67
|
-
|
|
68
|
-
Policies version exactly like every other Xano object: one Version History entry per real change, with the author, the optional `message` and `description`, and the whole policy as it was.
|
|
69
|
-
|
|
70
|
-
- `version` on a policy is the index of its newest history entry. It moves only when the definition really changes, so it names an entry a reader can open rather than counting writes.
|
|
71
|
-
- A save whose definition matches the stored one **does nothing at all** — no new version, no `updated_at`, no history entry, no audit record — and the response carries `unchanged: true`. A real save carries `unchanged: false`. Re-sending identical source is therefore safe and cheap; do not "touch" a policy to force a version.
|
|
72
|
-
- Formatting is not content: sending the same definition as expanded source, or as sparse canonical source, is the same no-op.
|
|
73
|
-
- An existing policy gets a lazy `Baseline` entry at its current number the first time it is really edited, so numbers are never migrated or renumbered.
|
|
74
|
-
- An update or a delete can send the `updated_at` it last read; when the policy changed since, it is refused (`payload.code` `policy_stale`) with `A previous update was performed before your request. Please reload your data and try again.` and nothing changes. Read the policy again, then reapply the edit or delete again.
|
|
75
|
-
- Listing, diffing and restoring versions is a **dashboard** surface. The Metadata API has no version routes — for policies or for any other object type — so an API or MCP client can label a save but cannot read or restore history. A restore performed in the dashboard is an ordinary save: it moves `version` forward rather than rewinding it, and re-validates against today's check catalogue.
|
|
76
|
-
- A run's snapshot records the `version` it evaluated, and each policy's `latest_run.stale` says whether that is still the current version. Read `stale`; do not compare versions or timestamps yourself.
|
|
77
|
-
|
|
78
|
-
## Gates
|
|
79
|
-
|
|
80
|
-
Blocking policies gate changes, not saves. One rule decides every branch gate (the tenant deploy gate judges a release on its own; see Releases and tenants):
|
|
81
|
-
|
|
82
|
-
- **Which policies decide:** the active blocking policies the branch will have after the change: its policies with the change's own selected policy changes applied (a new policy added, an updated one replaced, a deleted one removed). A merge counts the policies it carries (`select.policy`), a push to the live branch its policy files, and a set-live the candidate branch's policies, which are what live will have (a branch that landed no policy, such as one an `import-schema` created, is judged by the live branch's policies instead). So a merge that relaxes a policy (an exemption, a narrowed scope) and adds an object relying on it passes, and a merge that adds a blocking policy and an object violating it is refused. The branch before the change is judged by the same policies, so a new policy's findings on objects the change leaves alone are existing debt. A change that leaves the branch with no active blocking policy is never evaluated by a gate; one that adds the branch's first is. An archive import with `mode=merge` counts none of the archive's policies: the branch's policies before the import decide, and policies the archive writes take effect once it has landed.
|
|
83
|
-
- **Permissions:** each policy change needs only its own `workspace:policy` level, on every path, an active blocking policy included: **update** to edit one (saved directly, carried in a merge, written by a push) and **delete** to delete one (directly, carried in a merge, or removed by an archive import with `mode=replace`, or `mode=merge` with `delete=true`). A set-live checks no policy permission. There is no separate check for a change that demotes, deactivates, deletes or relaxes a blocking policy. The audit log labels the update or restore row of a change to an active blocking policy `blocking_policy_changed`, and the deletion of one `blocking_policy_deleted`. Because a carried policy change counts, editing a policy is never part of a fix (see Fixing a finding).
|
|
84
|
-
- **What blocks:** blocking findings the change **introduces**, and blocking findings on objects whose definition it **changes**. Findings already on unchanged objects are existing debt: reported as `existing`, never blocking.
|
|
85
|
-
- **Refusal:** HTTP 403 with `payload.code` `policy_gate`, the message `<Gate> refused: N blocking policy finding(s) from KEY (X introduced by this change, Y on objects it changes).` (it names the policies the blocking findings come from, the first three, then `and M more`, to every caller, policy read or not), and `{gate, status, total, introduced, changed, existing, run_id, can_override, sources, findings, truncated}`; `findings` (the first 100) only for a caller with `workspace:policy` read. Every gate answer (a merge's and its dry run's `policy_gate`, the merge review, set-live, the tenant deploy gate, a refusal's payload) carries `sources`, the same list as the message (`from AUTH-010 and PII-001`), to every caller whenever its blocking findings name a policy. Nothing is written.
|
|
86
|
-
- **Override:** a caller holding `workspace:policy` **update** may proceed by giving a reason (`override_reason`), which writes a `policy_run:override` audit row. Never override on a user's behalf unless they gave you the reason.
|
|
87
|
-
- An engine fault fails open (`unavailable`); a permission failure is a refusal. A rule that cannot run on an active blocking policy makes the branch gates `unavailable`, and the change goes through ungated until every rule can run; a rule error on an advisory or inactive policy changes no branch gate.
|
|
88
|
-
|
|
89
|
-
| Gate | When | How to override |
|
|
90
|
-
| --- | --- | --- |
|
|
91
|
-
| Merge | Every branch merge (Studio). Its dry run shows the verdict first | `override_reason` |
|
|
92
|
-
| Set live | Making a branch live, judged by that branch's own policies (what live will have) and measured against the current live branch. A release deployed into its workspace with `set_live`, and a Metadata API `import-schema` with `setlive`, land a new branch first: a refusal keeps it and names it in `payload.branch` (`{id, label}`). A new branch that landed no policy (`import-schema` always leaves the archive's policies out; a release may carry none) is judged by the live branch's policies; a release deploy that lands the release's policies is judged by them | `override_reason`; `xano branch set_live` and `xano release deploy --set_live` take `--policy-override "<reason>"` |
|
|
93
|
-
| Archive import | `mode=merge` through the Metadata API | `override_reason` |
|
|
94
|
-
| Publish | A save of a draftable object (function, query, task, middleware, addon, tool, workflow test, trigger, realtime message), an agent, an MCP server or a realtime channel to the workspace's **live** branch only (Studio publish and saves, Metadata API creates and saves, beta publish). Other branches are not gated | Studio's override dialog; `override_reason` on the Metadata API create and save routes; `xano function create` and `xano function edit` take `--policy-override "<reason>"` |
|
|
95
|
-
| Push | A non-draft `workspace push` to the live branch; it needs its transaction (`policy_gate_transaction_required` otherwise) | `override_reason` on the multidoc and upload routes; `xano workspace push --policy-override "<reason>"` |
|
|
96
|
-
| Tenant deploy | Deploying a release to a standard or run tenant: any blocking finding in the release's own check refuses it, existing debt included (see Releases and tenants) | `override_policy` with the reason |
|
|
97
|
-
|
|
98
|
-
A push to a branch that is not live is not gated: it imports, then answers `policy_check`, and a blocking finding does not roll it back. Tables, API groups, environment variables, workspace and branch settings, realtime servers, and MCP prompts and resources are saved without the publish gate, although a check may read one (a realtime server's middleware): a blocking policy never refuses those saves, on the live branch too. The next run reports what they break, and a set-live or tenant deploy that carries it is gated. No check reads an MCP prompt or resource; adding one to an MCP server or removing it changes the server, so that save is gated.
|
|
99
|
-
|
|
100
|
-
## Plan limits
|
|
101
|
-
|
|
102
|
-
Lower plans cap the policies on each branch, active or not; Pro and above are unlimited. A create past the cap is refused with HTTP 403 `payload.code` `policy_plan_limit` (`plan`, `plan_name`, `limit`, `count`, `adding`, and `policies` on a push); the message names the plan and says to upgrade. A branch already over its cap keeps, edits, deactivates, demotes and deletes its policies. A push whose new policies do not fit is refused whole before any write; an archive import skips the new ones that do not fit and lists them in `policies_skipped`. Never work around a plan limit (for example by deleting or merging policies the user did not ask you to touch): tell the user.
|
|
103
|
-
|
|
104
|
-
## Releases and tenants
|
|
105
|
-
|
|
106
|
-
Policies travel where the code travels while the instance's `policies` feature is on:
|
|
107
|
-
|
|
108
|
-
- A **branch merge** carries policies like other objects: added, changed and deleted. A merge that changes a policy needs `workspace:policy` create, update or delete for what it changes and obeys the plan cap; the carried policies count toward the merge's own gate (see Gates), and the merge review lists each one with its diff. With the feature on, the merge review (Studio's dry run of the merge) gives a member without `workspace:policy` read the gate's verdict trimmed instead: the counts and `sources` for every blocking finding, their own blocking findings on objects they may read (trimmed, first 100, `access: "coverage"`; a trigger by its `obj_type` as the dry run left it, one that cannot be resolved needing every trigger scope; each with the check and fix hint of the policies the merge leaves) and a fixed `note`, never the policy plan, with a merge error about policies read as one fixed sentence (a key clash, or a target policy changed meanwhile, keeps its own sentence, which names only keys); the merge itself is gated for them as for anyone. Such a member may ask for 20 merge reviews a minute in a workspace; past that the review is refused with 429 `policy_merge_review_rate_limited` and `retry_after`, before anything is exported, and Studio says `Too many merge reviews in the last minute, so the policy check wasn’t previewed. Check again in a moment.` without holding Merge. A reader's review is not limited.
|
|
109
|
-
- A **release** carries its branch's policies (inactive ones included) and records a policy check when it is cut (`GET /workspace/{id}/release/{release_id}/policy_run`, `xano policy runs --release <name>`). A release built from files by `release push` carries its policy files only for a caller holding `workspace:policy` create and update; for anyone else it carries the workspace's live-branch policies instead (see Permissions). **Deploying** a release makes the tenant's policies exactly the release's, and is gated by the release alone: the blocking findings of the release's own policy check (the one stored when it was cut, or checked from its archive on demand) refuse the deploy unless overridden, existing debt included. A rule that could not run does not lift that refusal; a release with no blocking finding whose check has a rule that could not run (on any policy) is `unavailable`, and the deploy is not gated. The gate does not compare the release with what the tenant runs, so the same release gets the same verdict on every tenant. Its answer is `{gate, status, total, run_id, can_override, sources?, gated, release {id, name, run_id, status, counts, carried}, message, findings, truncated}` (`GET /workspace/{id}/tenant/{tenant_name}/policy_gate?release_name=`, `xano tenant deploy_release --check`); `findings` and `truncated` go only to a caller with `workspace:policy` read, while the `message` names the blocking policies to everyone (`Deploy blocked: this release has 1 blocking policy finding from AUTH-001.`). Both preview routes need `workspace:policy` read, so only a reader calls them. A blocked deploy's refusal (the deploy and approve routes) tells a caller without policy read the counts, `sources` and the sentence naming the policies, never the findings. An approval request's stored `deploy_error` is that refusal's own sentence, with the policies named (and the override-denied suffix when it applies); no finding is stored. Ephemeral and sandbox tenants get the verdict (`gated: false`) and are never refused, and a release cut before releases carried policies is `not_carried` and not gated. Deploying a release into a workspace as a new branch lands its policies there.
|
|
110
|
-
- A **tier1 tenant, ephemeral or sandbox push** and its dry run carry policy documents without authoring permission or plan cap. A remote tenant push, and a push to a tenant created before policies (it has no policy table until its next platform update), still leave them out and name them once in `policies_skipped` (`{message, keys}`), whose message says why.
|
|
111
|
-
- A backup restore, a workspace archive and a branch clone carry every policy on the branch (inactive policies included) with its `guid` and `version`; runs and Version History do not travel. Those copies keep the fields the receiving platform knows and drop the rest, and a policy that still cannot be read (for example a check an older platform does not have) is skipped with a `policy:import_skipped` warning in the audit log, naming the policy and the reason, while everything else imports. Authored writes (Metadata API, Studio, `workspace push`) stay strict.
|
|
112
|
-
|
|
113
|
-
While the feature is off nothing carries policies: exports, clones and Git sync leave them out, and an import (a push, an archive import, including replace and delete) leaves the incoming policies out with a note, never creates or updates a policy, and deletes only the policies of a branch a replace removes, as deleting that branch would.
|
|
114
|
-
|
|
115
|
-
## Check catalogue
|
|
116
|
-
|
|
117
|
-
A rule selects one built-in check and supplies literal parameters. Unknown check IDs and parameter names are rejected on parse and save; an unknown check id is refused with `payload.code` `policy_unknown_check` and the nearest ids. A check id that was renamed is refused the same way with the sentence `"query.auth_required" was renamed to "object.auth_required"; use the new id.` and the new id in `payload.renamed_to`; a renamed or removed parameter is refused with a sentence naming what replaced it (for example `"statement" was renamed to "statements" and takes a list`). Stored policies were rewritten to the current names once; nothing translates an old name on read. Read the instance catalogue (`GET /api:meta/workspace/{id}/policy/check` or `xano policy catalogue -o json`) for current types, defaults, allowed values, nested properties and examples.
|
|
118
|
-
|
|
119
|
-
Every entry carries a human `label` beside its id; that label is what names a rule whose author gave it no `title`. It also carries `uses`, one to three goals in a customer's words, each `{goal, params, note?}` with the params, scope params included, that achieve it: they follow the table, and they are the quickest way from a request to a check and its params. In the table, `name*` is required. `1 of (a, b)` requires at least one non-empty value or enabled boolean; each member is individually optional. Every check also accepts the shared scope parameters below.
|
|
120
|
-
|
|
121
|
-
<!-- BEGIN GENERATED: checks -->
|
|
122
|
-
| Check | Label | Behavior | Parameters |
|
|
123
|
-
| --- | --- | --- | --- |
|
|
124
|
-
| `db.output_fields_forbidden` | Statements do not fetch listed fields | Reports database reads and writes that fetch a listed field, or a field marked sensitive, from their table. It reads the output list of db.query, db.get, db.add, db.edit, db.patch and db.add_or_edit statements. Judges what each statement fetches into the object's stack, not the final response, so a field fetched but never returned is still reported. Sensitive means marked sensitive in the schema or password-typed; a password field is not reported when the record is used only through its other fields, a null check, or security.check_password, and returning or copying the whole record is reported. An absent or default output fetches every field, and an object or list field without narrowed children fetches every field inside it. Every nesting depth of the stack is inspected, and a dotted entry reaches inside a paged result (items.email). A field is only forbidden on a table that has it, and an output entry is attributed only through the statement's own declarations: a field of its own table, its own or a declared join alias as a prefix (user.email), or a literal eval alias; table.field restricts a name to that table. An entry whose provenance cannot be resolved (a runtime value, a computed eval, an undeclared prefix) is not reported, count, exists and aggregate queries fetch no record, and db.direct_query is not checked. Addons attached to the object's statements, and to statements in functions it calls, are always inspected against the addon's own table, narrowed by the attaching statement's selection. A function the object calls is followed, whatever the rule's scope, and what it fetches is reported on the caller; fixing the function clears every caller, and exempting a function with except_tags also exempts what callers reach through it. Middleware and tool mappings are not followed: each is judged as its own object. Exemption is per object: an exempted object is exempt for every listed field. | 1 of (`fields`, `include_sensitive`), `table_tags` |
|
|
125
|
-
| `db.where_constraint_required` | Reads and writes constrain a required field | Requires every read and write of the selected tables to filter on a chosen field, such as the owner, optionally against a value such as the logged-in user. The rule constrains field, against compare_to when set. Scope picks the objects inspected; table_selector picks which of their reads and writes are judged, empty meaning every table that has field. A db.query, db.get, db.bulk.delete or db.increment is judged by its where: a predicate counts only with =, in, contains or overlaps, on the statement's own table (a bare field or its own alias, not a joined one), and it must hold on every OR branch. An optional predicate (==?, in? …) is skipped at run time when its value is empty, so it never satisfies this rule. A selected table read as the primary table covers its joins; a selected table joined into an unselected one needs its own predicate, in the where or in its join condition. db.edit, db.patch, db.del and db.add_or_edit pass when they pick their row by field against compare_to, or by id = $o.id where $o is an earlier constrained read of the same table, or a foreach item over one, assigned nowhere else. The trace does not cross function calls, so a helper function writing by a passed-in id is reported (move the constrained read into it, or exempt it), and so is a write by $input.id after a precondition on the owner (write by $o.id instead). db.truncate on a selected table is always reported. Not checked: db.has (existence only), db.add (pin the owner with db.write_from_input_forbidden), db.bulk.patch, db.bulk.update and db.direct_query. To check only order's reads and writes, use table_selector: { names: ["order"] }; scope tables only picks which objects are inspected. | `table_selector`, `field*`, `compare_to` |
|
|
126
|
-
| `db.write_from_input_forbidden` | Writes don't take protected fields from input | Reports database writes that take a whole record, or a protected field such as a role, straight from request input. Input is traced through variables, loops and data transforms. A write whose data is taken whole from input ($input or any $input.x) is mass assignment: whitelist the keys with pick, or build the object field by field. A pick as the last filter, with a literal key list, assigns exactly the picked keys; unset, unpick and set do not narrow the data. A record held in a variable assigned once (var, never changed after) is judged as the value assigned, and a function writing an argument whole is judged on what each caller passes, so a pick or an object literal there narrows it. Results of database, API and function calls are not treated as input. Input means request input for endpoints and middleware, arguments for AI tools and toolset triggers, and client messages for realtime triggers and message handlers; database-trigger rows and task runs are not input. Functions are judged through their callers: a write in a function is reported on the object passing it input, whatever the rule's scope, and exempting a function with except_tags exempts what callers reach through it. Agents calling functions as tools, and api.request into the workspace, are not followed. | `statements`, `fields` |
|
|
127
|
-
| `literal.credential_shape` | Definitions avoid recognizable credential literals | Reports secrets, such as API keys, tokens and private keys, written as literal values instead of environment variables. It looks for credential-shaped literals and literal keys in the selected locations. Findings name locations and pattern ids, never values. The definition location scans everything authored in each object (stack, inputs and defaults, response, settings, tests, descriptions), disabled content included since it is still stored and exported; env and agent settings are separate locations. Documentation examples (AWS keys ending EXAMPLE, the jwt.io sample token) are skipped. aws and twilio match identifiers rather than secrets, and some Google browser keys are public by design, though a backend literal still belongs in env. literal_keys reports literal keys and IVs passed to security.encrypt/decrypt, jws/jwe encode/decode and hmac_* filters, and literal bearer tokens passed to ai.external.mcp statements; public keys (PEM PUBLIC KEY/CERTIFICATE, JWKs without private members) are allowed. Each finding names the SHA-256 fingerprint of every value it reports, and a value whose fingerprint allowed_secrets lists is skipped. | `patterns`, `locations`, `allowed_secrets` |
|
|
128
|
-
| `object.auth_required` | Endpoints require authentication | Requires each endpoint and realtime message handler in scope to require a login (an auth table); a handler naming none is reported like a public endpoint. Exclude deliberate public ones with except_tags. An endpoint also carries its API group's tags; api_groups and verbs narrow the rule to endpoints. Checks the saved authentication setting; authorization logic is not evaluated. | _scope only_ |
|
|
129
|
-
| `object.description_required` | Objects, inputs and fields have descriptions | Requires a description on each object in scope; in XanoScript the // comment lines directly above an object, an input or a field are its description. When require_on asks, it also requires one on the inputs of endpoints, functions and AI tools and on the fields of tables. A description counts when it has at least min_length characters, not counting spaces at either end, so a short placeholder such as TODO can be refused. For an AI tool, the text judged is what the model receives: its instructions, or its description when it has no instructions. Nested inputs and fields are checked too: by dotted path (address.zip), and by element path for a list of objects (items.zip). What is inside a json input or field is not checked. Each one needs its own description. An API group's description does not cover its endpoints, and a table's does not cover its fields. The separate docs text does not count. An endpoint's description is what its OpenAPI spec shows as the operation summary. Inactive and disabled objects are checked like any other. Only presence and length are judged, not accuracy. One finding is reported per object; it lists at most 10 inputs or fields, then how many more. Every object of a kind the chosen parts apply to counts as checked, even one with no inputs or fields. With object left out of require_on, those kinds are endpoints, functions and AI tools for input, and tables for table_field. A dblink input (a table's fields merged into the inputs) is skipped, as object.naming and object.unused_input_forbidden skip it. | `require_on`, `allowed_fields`, `min_length` |
|
|
130
|
-
| `object.input_rules` | Endpoint, tool and message inputs declare types, filters and bounds | Checks the inputs that endpoints, AI tools and message handlers declare: their types, filters, page-size limits, required inputs and values in the URL path. Enable at least one condition. Each condition can be its own rule; combine them only when they share severity and scope. Tools are included because a model chooses their arguments; functions are judged through their callers and are not inspected. path_params_forbidden applies to endpoints only. Nested object inputs are checked by dotted path (address.zip), a list of objects by element path (items.zip); json inputs have no declared shape. Without input_names, filter rules apply to every text input; input_names narrows them to exactly the named inputs, of any type. Filters are checked as declared on the input's type: min on an int bounds the value, on text its length. For paging, per_page is traced through variables, data transforms and called functions to each input reaching it; only a literal max filter on that input counts, bounding the value in code is not recognised, and the page (offset) input is not bounded by this condition. Middleware reads raw request params (as $input.vars.<name>) before the declared inputs are parsed, so a declaration does not validate what middleware reads. Called functions are read whatever the rule's scope. Unused inputs are reported by object.unused_input_forbidden. | 1 of (`type_by_name`, `filters_required`, `paging_max_required`, `path_params_forbidden`, `inputs_required`, `filter_min`), `input_names` |
|
|
131
|
-
| `object.middleware_required` | Objects attach required middleware | Requires each named middleware to be attached and active on every object in scope, before or after the object runs as selected. A tool must have it on every path it is served by. Middleware is resolved as the runtime does, one phase at a time: the object's own list when it customizes, else an endpoint's API group, or a message handler's channel and then its realtime server, when that customizes, else the branch or workspace default for the object's kind. A tool is served through each toolset or MCP server that maps it and customizes middleware, and without one through the branch default; a finding names the path lacking the middleware. Reads the middleware resolution chain whatever the rule's scope. Checks presence and phase, not order, and not what the middleware does. | `middleware*`, `phase` |
|
|
132
|
-
| `object.naming` | Names follow a naming convention | Reports names that break a team's naming convention: case style, length, prefixes or suffixes, the first word, forbidden words or a pattern. For table fields it can also require a field that links to another table to be named after that table. Each rule judges one kind of name, chosen with name_kind. object: the object's own name; object_kinds chooses whose names (functions, tables, tasks and the rest). Only the part after the last / is judged, so the folder in billing/get_invoice is ignored. API groups, agents, MCP servers and workflow tests are judged by their display name, which is free text such as Public API, so set object_kinds to the kinds the convention is about. endpoint_path: each segment of an endpoint's path on its own. A segment holding a {param} is skipped, and a required version segment is judged only as a version. table_field: each field name of each table, nested fields included, except the primary key id. input: each input name, nested inputs included, of endpoints, functions, addons, tools and message handlers; object_kinds chooses whose. Fields and inputs are judged by their own name, not their dotted path, and a json field's or json input's contents have no declared names. Every check the rule sets must pass. Case styles judge ASCII only: a name must start with an ASCII letter, so a leading _ (_links) or a doubled __ fails snake_case, and a letter outside ASCII fails every style but lowercase. camelCase and PascalCase accept capitals in a row (customerID). A name that is only its prefix has nothing to judge and fails. One finding is reported per object; it lists at most 10 failing names, then how many more fail, and its allow lists every one. allowed_names exempts single names. To exempt a whole object, tag it and list the tag in except_tags. Reads names, field types and table links only. Only objects with at least one judged name count as checked, and with version_required every endpoint in scope counts. | 1 of (`case_style`, `min_length`, `max_length`, `prefixes`, `suffixes`, `first_word_must_be`, `words_forbidden`, `pattern`, `version_required`, `foreign_key_name`, `foreign_key_list_name`), `name_kind*`, `allowed_names` |
|
|
133
|
-
| `object.settings_forbidden` | Objects avoid forbidden settings | Reports objects whose settings have a forbidden value, such as middleware that silently swallows exceptions. An object is reported when its settings match all configured predicates. Name settings from the kind's list. Raw storage paths are accepted, but a path found on no object makes the rule inert, with a warning; a workspace, agent or MCP server row holds secrets, so on those kinds only listed settings are matched. A listed setting compares its effective value: the stored value, else its default. present and absent test whether it is stored explicitly, and a raw path is always read as stored. Numeric predicates match only a numeric value, including a numeric string; in does not match a missing setting and not_in does, like not_equals. To bound a value use gt, e.g. cache.ttl gt 3600 reports a TTL above an hour; requiring a setting to exist needs a second rule with absent: true. A setting holding a secret (a key, token, password or credential) cannot be matched. | `object_kind*`, `when*` |
|
|
134
|
-
| `object.statement_required` | Objects call a required function or statement | Requires each object in scope to call a given function or statement, anywhere, on every path, or as its first statement. Called functions are followed; endpoints, AI tools, tasks and message handlers are inspected. A match is a listed statement that, when functions is set, calls one of them; any listed alternative satisfies the rule. Called functions are read whatever the rule's scope and except_tags: a match in one counts when the call is synchronous, no function on the way caches its result (a cached function skips its checks on cache hits), and, for unconditional, every call site on the way always runs too. A match in an attached pre-middleware counts when its exception policy is critical or rethrow, since a silent middleware swallows its failure; the middleware resolution chain is read whatever the rule's scope. In a called function or middleware, must_reference is met only by $auth and $env references. unconditional means at the top level of the stack or inside group, db.transaction, finally, or a try whose catch rethrows; not inside a conditional, switch, loop, catch or util.post_process. first means the object's own first statement, a comment skipped; a callee or middleware never counts as first. when selects objects by a statement in their own stack or in a function they call, and a read matches when.tables through the addons it attaches. | 1 of (`statements`, `functions`), `placement`, `must_reference`, `when` |
|
|
135
|
-
| `object.tag_required` | Objects carry a tag from a required set | Requires each object in scope to carry at least one tag from tag_set, such as an owner team or a data classification. An endpoint also counts its API group's tags, so tagging the group covers every endpoint in it. An API group in scope is judged on its own tags, so tagging only its endpoints does not satisfy it. No other tags are inherited: a function does not take its callers' tags, and a message handler does not take its channel's. Tags match exactly: case and spaces matter. Use one rule per set. With no object_kinds, every kind must carry one, workflow tests, addons, messages and API groups included; set object_kinds to the kinds the convention is about. To require the tag only on some objects, narrow the scope: object_kinds, tags (for example, objects tagged pii must also carry a reviewer tag) or endpoint_auth. api_groups, verbs and endpoint_auth select endpoints only, so the API group object itself is then not inspected; tables and reaching_table_tags select tables and objects whose stacks reach them, so API groups, channels and workflow tests are then not inspected. Studio saves tags in lowercase, so list tags in lowercase unless they are created through the API. Every object in scope counts as checked. For a tag required only on tables that hold listed fields, use table.tag_required. | `tag_set*` |
|
|
136
|
-
| `object.tag_vocabulary` | Tags follow the agreed vocabulary | Reports tags outside the workspace's tag vocabulary, such as PII beside pii. Set allowed_tags for a fixed list, case_style and prefixes for an open style, or both to accept a tag that is listed or follows the style. With no style set, only listed tags are accepted. Tags match exactly: case and spaces matter, and no style accepts a tag that starts or ends with whitespace. Each tag is judged on the object where it is written: an API group's tags are judged on the group, and only when api_group is among the kinds the rule inspects, so a rule narrowed to endpoints skips them. Scope tags and except_tags still read an endpoint's API group tags, so an API group carrying an excepted tag exempts every endpoint in it. api_groups, verbs and endpoint_auth select endpoints only, so the API group object itself is then not inspected; tables and reaching_table_tags select tables and objects whose stacks reach them, so API groups, channels and workflow tests are then not inspected. Every unaccepted tag on an object is reported in one finding, with a suggestion when it differs from a listed tag only in case, separators or surrounding spaces. A finding lists at most 10 tags, then how many more, and its allow lists every unaccepted tag that has no suggestion. Tags other rules rely on, such as exemption tags in their except_tags, must be listed too or follow the style. Studio saves tags in lowercase, so list tags in lowercase unless they are created through the API. Only objects that carry at least one tag count as checked. | 1 of (`allowed_tags`, `case_style`, `prefixes`) |
|
|
137
|
-
| `object.tagged_table_access` | Objects reaching tagged tables declare auth and an audit call | Requires every object that reaches a table carrying a sensitive-data tag to require a login and, when a function is named, to always call it, such as an audit function. The tags are table_tags. Access through called functions and addons counts. Endpoints, realtime message handlers, AI tools and tasks are inspected. Endpoints and message handlers must declare authentication, on one of auth_tables when set; a tool or task has no caller to authenticate, so only the call applies to it, and with function empty it is not examined. The call counts at the top level of the stack or inside group, db.transaction, finally, or a try whose catch rethrows; not inside a conditional, switch, loop, catch, a try whose catch swallows the failure, or util.post_process, and not when the function caches its result. Order is not required, and control flow is not followed: an early return before the call still skips it. Calls through another function do not count. Every unmet requirement is reported in one finding. Only objects reaching a tagged table count as checked. | `table_tags*`, `auth_tables`, `function` |
|
|
138
|
-
| `object.test_coverage` | Objects are covered by a test | Requires each selected endpoint, function, AI tool or task to be called by a test that then asserts something. Unit tests count for endpoints and functions. An endpoint counts when a workflow test runs api.call on it, a function function.call or function.run, an AI tool tool.call and a task task.call; middleware, added through object_kinds, counts by middleware.call or a unit test. A workflow test's workflow_test.call is followed, and so are the functions a test calls when looking for api.call. A call counts only when an expect statement follows it, in the same test or after the workflow_test.call that reached it, or when an expect.to_throw wraps it; what the assertion checks is not inspected. A unit test counts only with at least one expectation; it runs the real endpoint with its middleware but no HTTP layer, ignores token expiry, and a statement it mocks does not execute. An inactive workflow test covers nothing. Tests are read, not run, so a failing test still counts. AI tool and task unit tests cannot be run and do not count, and realtime message handlers cannot be test-covered. Reads every workflow test and unit test whatever the rule's scope. | _scope only_ |
|
|
139
|
-
| `object.unused_input_forbidden` | Declared inputs are read | Reports inputs that an endpoint, function, AI tool, realtime message handler or addon declares but never reads. An input counts as read when $input.<name>, or a path below it, appears anywhere in the object's enabled code: statements at any depth, filters, expressions, the response, or another input's declaration. Pre-middleware attached to the object also reads it, through $input.vars.<name>; attached middleware is read whatever the rule's scope. A statement also reads an input when the runtime fills one of its settings from the input of the same name, which happens when the statement neither sets nor ignores that setting. db.add, db.edit, db.add_or_edit and the bulk writes fill table fields this way, function.run fills the called function's inputs, and db.patch and stream.from_request fill their own settings. An object that can read any input is not judged and not counted. That covers a bare $input (for example, passed whole to function.run), util.get_all_input, util.get_raw_input, api.lambda, util.template_engine, a direct query using the template_engine parser, a JavaScript filter (lambda, map, filter, some, every, find, findIndex, reduce), to_expr, action.call, pre-middleware that reads $input.vars whole or can read any input itself, and a write or function call whose table or function cannot be found. Endpoint path parameters ({id}) and dblink inputs are excluded. With include_nested_inputs, fields inside object inputs are judged too. A read only inside disabled code does not count, and the finding names that code. One finding is reported per object; it lists at most 10 inputs, then how many more. | `allowed_inputs`, `include_nested_inputs` |
|
|
140
|
-
| `outbound.vendor_allowlist` | Outbound calls go only to approved vendors | Reports outbound requests, and cloud, email and AI model providers, that are not on the approved vendor lists. Empty allowlists report destinations as not yet reviewed. The http kind covers api.request, stream.from_request, the ai.external.mcp statements, api.microservice to a dotted host, and file statements given a literal http(s) URL; a dynamic file value is usually a file resource and is not reported. cloud and email check the provider, agent.llm an agent's model provider; cloud.job runs locally and is excluded. db.external reads the host of a literal connection string of db.external.*.direct_query, or approves one that is exactly $env.NAME through env_hosts; a connection string with a dynamic tail, or whose database name or options hold anything but letters, digits and _ . $ - (options also % + = & / :), is unresolved, because that text could name another host. lambda scans literal api.lambda code: its literal URLs are checked, and network calls without one, or whose literal URL holds a JavaScript escape or is joined to text that could change its host, are reported as unverifiable. A URL resolves from a literal scheme://host prefix followed by /, ? or #, and one led by an environment variable passes when env_hosts lists that variable and anything joined after it starts with /, ? or #; a filter or condition applied to the whole URL leaves it unresolved. Env var values are not read: they are per workspace and per tenant and change without a branch change. Approve the variable in env_hosts to trust whoever sets it. Other dynamic or missing destinations are reported as unresolved. With literal_urls_forbidden on, an http or db.external destination passes only when it comes from an environment variable listed in env_hosts. One written directly into the stack is reported even when hosts approves it: a full URL, a URL that starts with fixed text ("https://api.stripe.com/" ~ $input.path), an api.microservice host with a dot, a file statement's http(s) URL, or a connection string with a scheme://. A scheme-less connection string is the name of an environment variable, as the runtime reads it, and is judged by env_hosts. | `kinds`, `hosts`, `providers`, `env_hosts`, `literal_urls_forbidden` |
|
|
141
|
-
| `stack.disabled_statement_forbidden` | Stacks hold no disabled statements | Reports statements switched off with disabled anywhere in an object's stack. That includes statements inside conditionals, switches, loops, groups, try/catch, transactions and post-process blocks, and switched-off else-if branches and switch cases. Disabled code never runs, but it is still stored, exported and reviewed. A disabled block is reported once, with the number of statements inside it. A comment is a note, so a disabled comment passes. A statement listed in allowed_statements may stay disabled. Each object is judged on its own stack: disabled code in a function is reported on the function, not on the endpoints that call it, so a rule scoped to endpoints only (api_groups, verbs, endpoint_auth) leaves functions out. Workflow tests are judged too. Only the disabled switch on statements, else-if branches and switch cases is read; filters, response entries and middleware attachments keep their own. | `allowed_statements` |
|
|
142
|
-
| `stack.size_limit` | Stacks stay within statement and nesting limits | Reports an object whose own stack holds more than max_statements statements or nests blocks more than max_nesting levels deep. Set either limit or both. An object exactly at a limit passes. Every enabled statement counts, at any depth. A block counts as one statement plus the statements inside it, so a conditional holding two statements counts as 3. Comments are notes, not statements. Disabled statements are skipped, as they are at runtime. Nesting levels come from conditional, switch, foreach, for, while and group. A block at the top of the stack is at level 1, and a block inside it is at level 2. A block's branches (elseif, else, switch cases and default) share its level. try_catch, db.transaction and util.post_process are statements that add no level, so what they hold sits at their own level. Each region nested too deeply is reported once, at its first block past the limit. Called functions are not counted or read: a function call is one statement, and each function is judged on its own when the rule's scope includes it. Middleware is judged on its own in the same way. | 1 of (`max_statements`, `max_nesting`) |
|
|
143
|
-
| `stack.statement_forbidden` | Stacks exclude listed statements | Reports forbidden statements anywhere in an object's stack or in a function it calls. A name ending in .* forbids a namespace. Statements in functions the object calls count, including async calls, and are reported at the call; fixing the function, or exempting it with except_tags, clears every caller. return and loop controls in a called function are not attributed to the caller. Middleware, addons and agent tools are not followed: each is judged as its own object. Called functions are read whatever the rule's scope. A namespace covers statements added under it later. Recipes: raw SQL is ["db.direct_query", "db.external.*"], external MCP ["ai.external.mcp.*"], cloud file storage ["cloud.aws.s3.*", "cloud.azure.storage.*", "cloud.google.storage.*"], bulk writes ["db.bulk.*"]. db.* includes reads and cloud.* is not only storage; function.* and service.* both match every function call. | `statements*` |
|
|
144
|
-
| `stack.statement_order` | A statement comes before another | Requires one statement to always run before another, at any depth, such as a permission check before a database write. Every matching after statement must be preceded by a before that always runs ahead of it. Called functions and pre-middleware are followed. A before covers later statements of its own block, and reaches out of group, db.transaction, finally and a try whose catch rethrows; one inside a conditional branch, loop body, catch, a try that swallows failures or util.post_process covers only later statements in that same block. A guard in every branch of an if/else does not cover statements after the conditional (hoist it), and a guard written as conditional { throw } is not a before match (use precondition, or a guard function). An after in a function the object calls, not guarded inside that function, counts at the call site, async calls included; exempting the function with except_tags stops this. A synchronous call to a function holding an always-running before counts as a before at the call, unless a function on the way caches its result; an early return in a guard function before its check is not followed. An attached pre-middleware whose exception policy is critical or rethrow and that holds an always-running before covers the whole stack; a silent one does not. In a called function or middleware, must_reference is met only by $auth and $env references. A listed function counts only on a synchronous, uncached call; must_reference is checked on the call (its arguments), or through an $auth or $env reference inside the function. Objects with no after statement pass and are not counted. Called functions and the middleware chain are read whatever the rule's scope. | `before*`, `after*` |
|
|
145
|
-
| `stack.unused_variable_forbidden` | Assigned variables are read afterwards | Reports a value given to a variable that nothing reads afterwards. Two cases are reported: a variable that is never read, and a change made after the variable's last read. The changes are var.update, array.push, array.unshift, array.merge, math.add, math.sub, math.mul, math.div, math.mod, the math.bitwise statements, text.append, text.prepend and the text.trim statements. A read is $name, $var.name or a path below it in any enabled statement, filter, expression or the response. A statement that tests the variable, or takes from it (array.pop, text.contains), also reads it. A change made only to feed itself is not a read: a total that math.add updates but nothing else reads is reported. A read anywhere inside an enclosing loop (foreach, for, while) counts as afterwards, because the loop runs again. An assignment is reported only when no read comes after it, so a value overwritten and then read later passes. Loop item variables are never reported. include_results_of adds the results that listed statements store with as. allowed_variables exempts names. An object that can read any variable is not judged and not counted. That covers $var read whole, util.get_vars, api.lambda, util.template_engine, a direct query using the template_engine parser, a JavaScript filter (lambda, map, filter, some, every, find, findIndex, reduce) and to_expr. Variables belong to one stack, so a function's variables are judged on the function. A read only inside disabled code does not count, and the finding names that code; that includes statements allowed by stack.disabled_statement_forbidden. One finding is reported per object; it lists at most 10 variables, then how many more. | `include_results_of`, `allowed_variables` |
|
|
146
|
-
| `statement.containment` | Statements meet nesting requirements | Requires or forbids blocks around selected statements, such as a try/catch around external requests, or requires statements nested inside them. Called functions are judged per call path. A bare try_catch means its try branch; name a branch (try_catch.catch) to target another. Checks every nesting depth; the matching block need not execute on every path. Functions are judged through the objects that call them: a statement in a function counts as inside a block when every call path puts it there, and an async call drops the caller's try_catch but keeps its loops. A function no in-scope object calls is judged on its own, so scope changes how a function is judged, not only whether it is reported. Exempting a function with except_tags stops following it; called functions are read whatever the rule's scope. | 1 of (`must_be_inside`, `must_not_be_inside`, `must_contain`), `statements*`, `min_count` |
|
|
147
|
-
| `statement.expression_rule` | An expression follows reference and filter rules | Checks what selected statement settings may contain, such as debug logs never reading request input: required or forbidden references, operators, literals and filters. References are traced through variables and called functions. A variable carries what is assigned to it (var and its mutators, foreach items, data transforms), and util.get_env, util.get_all_input, util.get_raw_input and util.get_vars carry everything they read; results of database, API and function calls carry nothing. must_not_reference fails when a listed reference may reach the param; must_reference is met by a reference written in the param, or by a variable every assignment of which carries it. Operators, literals and filters are read as written. A statement in a called function is judged through each caller: its $input means the arguments that caller passes, while $auth and $env keep their meaning; exempting a function with except_tags stops following it. $input is request data in endpoints, middleware, AI tools, message handlers and realtime or toolset triggers. In a database, workspace or error trigger, a task, and a function no in-scope object calls (judged on its own), $input is not request data: a $input entry in must_not_reference is not traced there, and one in must_reference is matched as written. So scope changes how a function is judged. An omitted parameter fails only a rule with must_reference or filters_required. Called functions are read whatever the rule's scope. | `statements*`, `param_names*`, `must_reference`, `must_not_reference`, `operators_forbidden`, `literals_forbidden`, `filters_forbidden`, `filters_required` |
|
|
148
|
-
| `statement.param_bound` | A numeric parameter stays within bounds | Requires a numeric statement setting, such as a timeout or a token lifetime, to stay between a minimum and a maximum. The listed params must lie within the inclusive bounds. An omitted param is judged at its runtime default. A variable assigned only literals, and a literal argument passed to a function, are resolved; arithmetic is not evaluated, and a value that cannot be resolved is reported. A numeric param is read as the runtime casts it ("3600" is 3600), and a value the runtime refuses passes, since the statement then never runs. Bounds use the param's native units. A statement with none of the params set and no runtime default is reported. A statement in a called function is judged through each caller, an argument resolved from what that caller passes; exempting a function with except_tags stops following it. A function in scope is also judged on its own, where a value read from its input is unresolvable only when no in-scope object calls it, so scope changes how a function is judged. Called functions are read whatever the rule's scope. | 1 of (`min`, `max`), `statements*`, `param_names*`, `unit` |
|
|
149
|
-
| `statement.param_forbidden` | A parameter avoids forbidden values | Reports statement settings set to a forbidden value, such as TLS certificate checks turned off, or to a value that cannot be resolved. An omitted param is judged at its runtime default. A variable assigned only literals, and a literal argument passed to a function, are resolved; arithmetic is not evaluated. Where the param's runtime type is boolean or numeric, values are compared as the runtime casts them (0, "0", "no" and "off" are false; "3600" is 3600), and a value the runtime refuses passes, since the statement then never runs; other params compare strictly. A statement in a called function is judged through each caller, an argument resolved from what that caller passes; exempting a function with except_tags stops following it. A function in scope is also judged on its own, where a value read from its input is unresolvable only when no in-scope object calls it, so scope changes how a function is judged. Called functions are read whatever the rule's scope. | `statements*`, `param_names*`, `values*` |
|
|
150
|
-
| `statement.param_required` | Statements explicitly set a required parameter | Requires selected statement settings to be set explicitly, including in called functions and attached addons. For output, requires a customized field list, which db.query and db.get write as output = ["id", "name"]; a dotted entry reaches inside a paged result (items.book_name). To forbid particular fields, use db.output_fields_forbidden. A runtime default does not count, and neither does a value equal to the default XanoScript leaves out of the source (timeout = 10 or verify_peer = true on api.request), since a pull does not show it and the next push drops it; use statement.param_bound or param_forbidden when the value matters. Each listed param a statement declares must be set, so one rule can span statements with different params; a listed statement declaring none of them, or a param no listed statement declares, is a rule warning. Every addon the object's statements attach, and those attached in functions it calls, is inspected as the query it runs; an addon in scope is also judged on its own. A statement in a called function is reported on the caller, and the function is still judged on its own when in scope; exempting a function or an addon with except_tags stops following it. Called functions are read whatever the rule's scope. | `statements*`, `param_names*`, `table_tags` |
|
|
151
|
-
| `table.auth_table_rules` | Endpoints use the single auth table | Requires exactly one table to hold user logins on the branch, and every authenticated endpoint to use it, unless approved auth tables are listed. With auth_tables empty, exactly one auth-enabled table is required. With auth_tables set, only listed tables may be auth-enabled, and authenticated queries must use one. Without a list, any other count reports the workspace once, plus each query whose declared auth table is missing or not auth-enabled. With a list, each auth-enabled table not listed is reported on itself; a listed table need not exist, and a branch with no auth table passes (to require one, use workspace.object_required). This check is not for backends without sign-in. The auth-table count always covers the whole branch; scope narrows the queries reported, and the tables reported when auth_tables is set. Without auth_tables the workspace counts as checked; with it, only the scoped queries and auth-enabled tables do, so a rule whose scope selects nothing checks nothing. A listed table that is not auth-enabled is a rule warning. | `auth_tables` |
|
|
152
|
-
| `table.coverage_required` | Tables are referenced by a required object | Requires each selected table to be reached by an object that can run, such as a scheduled task that cleans it up. Scope selects the tables; referenced_by selects the covering objects. An object reaches a table directly or through called functions, attached addons and enabled agent or MCP tool mappings; disabled statements do not count. With referenced_by.statements set, only those statements aimed at the table as their primary table count, in the object or a function it calls; db.direct_query counts only with static SQL naming the table physically (mvpw<workspace>_<table id>) beside DELETE, TRUNCATE or DROP, and an addon never qualifies. A task can run only when active with a repeating schedule that has not ended, and a trigger unless inactive; a covering object that cannot run is named instead. Whether a schedule has ended is judged at the evaluation date, so a rule can start failing, and a merge gate start blocking, without a definition change once an end date passes. Only tables count as checked; covering objects are read whatever the rule's scope. | `table_selector`, `referenced_by` |
|
|
153
|
-
| `table.field_attribute_required` | Schema fields have required attributes | Checks selected table fields for a required attribute or type, such as being marked sensitive, or forbids them. When names and types are both set, a field must match both. Fields are selected at every depth: a bare name matches that name anywhere, a dotted name (profile.ssn) that exact path, and a list of objects by element path; a json field's contents are not inspected. Reads schema definitions only. Attributes are sensitive, visibility (public, private or internal), required and nullable (what the ? marker sets), default, values, list, list.min, list.max and filter.<name> (an enabled filter of that name is declared); a raw path into the stored field is also accepted, and one that no selected field on the branch has makes the rule inert, with a warning. To require field descriptions, use object.description_required with require_on table_field. | 1 of (`field_names`, `field_types`), `attribute`, `value`, `type`, `must_exist`, `forbidden` |
|
|
154
|
-
| `table.tag_required` | Tables with matching fields carry a tag | Requires a tag, such as confidential, on tables that hold a selected field or, when asked, any field marked sensitive. With include_sensitive set, any sensitive field counts. Reads schema definitions only. A selected field matches a listed name and, when field_types is set, one of those types. Fields match at every depth: a bare name anywhere, a dotted name (profile.notes) that exact path; a json field's contents are not inspected. Sensitive means marked sensitive in the schema or password-typed. Only tables with a matching field count as checked. To require a tag from a set on objects of any kind, use object.tag_required. | 1 of (`field_names`, `include_sensitive`), `field_types`, `tag*` |
|
|
155
|
-
| `table.view_hide_required` | Saved views hide sensitive fields | Requires every saved view of the selected tables to hide fields marked sensitive, password fields and any listed fields. A share link redacts rows by its view's hidden columns. Sensitive and password fields are always required; fields adds to them. Saved views belong to the table, not to a user, and any of them can be attached to a share link, whose redaction reads the view live on each request, so editing a view changes what existing share links expose. A share link created with Studio's Default view, or whose view was deleted, shares every field except @meta, sensitive fields included; share links are outside the branch, so this check cannot see them and only guarantees that saved views hide these fields. CSV exports use the columns chosen at export time, not a saved view, so this check does not govern them. A nested field counts as hidden when its path or an ancestor is hidden. Select tables with tags. | `fields` |
|
|
156
|
-
| `table.write_location_restricted` | Table writes use approved functions or tags | Restricts writes to selected tables to approved functions and tagged objects; with no approved function or tag, every write is reported. Writes in called functions count on the caller, and approval does not pass down to what an approved function calls. A write counts when it targets a restricted table and, when fields is set, touches a listed field that table has; fields names apply only to listed tables that have them, and table.field narrows a name to one table. Deletes, truncation and whole-record replacements affect every field, and dynamic record values are treated as possibly touching them, except that a last pick with a literal key list touches only the picked keys. db.direct_query is scanned: dynamic SQL (the template engine, ?:raw or ?:alias) may write any restricted table, and static SQL writes one it names physically (mvpw<workspace>_<table id>) beside a write keyword. Writes through stored procedures, SQL functions, views or database triggers, a table named other than physically, and db.external.*.direct_query are not seen; for certainty forbid db.direct_query with stack.statement_forbidden. allowed_tags reads each object's own tags; an API group's tags do not approve its endpoints (tag each approved object), while scope except_tags does include API group tags, so a group carrying an excepted tag exempts all its endpoints. Called functions are read whatever the rule's scope. Middleware, api.call to other endpoints and database triggers fired by a write are not followed: each is judged as its own object when in scope, which an api_groups-only scope drops. | `restricted_tables*`, `fields`, `statements`, `allowed_functions`, `allowed_tags` |
|
|
157
|
-
| `test.assertion_required` | Tests assert anonymous calls are rejected | Requires, for each endpoint that requires a login, a test that calls it without one and asserts that it is rejected. A tokenless endpoint unit test counts too. Anonymous means no token (or a literal null, empty or false one) and no Authorization header in literal headers; a computed token or headers may authenticate. The rejection is asserted by expect.to_throw wrapping the call with the text Unauthorized, Authentication Required or Unauthorized - Authentication Required (whole, any case; an empty text would accept any failure), or by a later expect.to_equal or expect.to_contain on the call result's code or message with ERROR_CODE_UNAUTHORIZED or one of those texts; an endpoint unit test with no token counts with such a to_throw expectation. A workflow test's api.call does not yet enforce the endpoint's auth when called without a token, so such a test fails at run time until the platform does; an endpoint unit test observes the rejection today. Endpoints that do not require authentication are skipped: they cannot reject an anonymous call. Tests are read, not run; every workflow test and the endpoints' unit tests are read whatever the rule's scope, and an inactive workflow test counts for nothing. | _scope only_ |
|
|
158
|
-
| `trigger.write_trigger_effects` | Trigger writes account for the triggers they skip or re-fire | Reports writes made inside a table trigger that skip another table's own triggers, or that re-fire the same trigger. Writes made synchronously inside a trigger fire no database triggers on any table; writes in async functions do. A synchronous write to the table a database trigger fires on is safe and passes. Every trigger kind is inspected for skipped triggers; only database triggers can re-fire themselves. Writes in called functions are followed and other tables' database triggers are read, whatever the rule's scope; a write is asynchronous once its call chain passes through an async function call, and writes made by an AI agent's tools are not followed. db.direct_query counts when its static SQL names a table physically; dynamic SQL is not attributed. A skipped trigger with a when-filter might not have matched anyway, and the finding says so. | _scope only_ |
|
|
159
|
-
| `workspace.object_required` | Required objects exist | Requires objects of a selected kind to exist and be able to run: each listed name, or at least a minimum number in scope. Checks object presence, not behavior. A task counts when active with a repeating schedule that has not ended, a trigger when active, an MCP server or AI tool when enabled; one that cannot run is named. Whether a schedule has ended is judged at the evaluation date, so a rule can start failing without a definition change once an end date passes. names matches the stored name: for an endpoint its path, met by any verb in any API group (narrow with api_groups and verbs). Scope tags narrow the objects counted, an endpoint also carrying its API group's tags. object_kind workspace always counts one. | `object_kind*`, `names`, `min_count` |
|
|
160
|
-
|
|
161
|
-
Uses: what each check is for, as goals in a customer's words with the params that achieve them, scope params included. Each is a complete rule its check accepts as written; `{}` takes the check's defaults.
|
|
162
|
-
|
|
163
|
-
- `db.output_fields_forbidden`: Endpoints never return password hashes or social security numbers. → `{"fields":["user.password_hash","ssn"],"object_kinds":["query"]}`
|
|
164
|
-
- `db.output_fields_forbidden`: Endpoints never return fields marked sensitive from tables tagged pii. → `{"table_tags":["pii"],"object_kinds":["query"]}`
|
|
165
|
-
- `db.where_constraint_required`: Users only read and change their own orders. → `{"field":"user_id","compare_to":"$auth.id","table_selector":{"names":["orders"]}}` — table_selector picks which reads and writes are judged; the tables scope picks which objects are inspected.
|
|
166
|
-
- `db.where_constraint_required`: Every read of a table with tenant_id filters on the caller's tenant. → `{"field":"tenant_id","compare_to":"$auth.tenant_id","table_selector":{"has_field":"tenant_id"}}`
|
|
167
|
-
- `db.write_from_input_forbidden`: Users can't set their own role or plan. → `{"fields":["role","plan"]}`
|
|
168
|
-
- `db.write_from_input_forbidden`: No write copies a whole request body into a record. → `{}`
|
|
169
|
-
- `literal.credential_shape`: No API key, token or private key is written into code. → `{}`
|
|
170
|
-
- `literal.credential_shape`: Environment values are scanned too, before an export is shared. → `{"locations":["definition","env","agent_settings"]}`
|
|
171
|
-
- `object.auth_required`: Endpoints that touch invoices require login. → `{"tables":["invoices"]}` — tables judges the endpoints reaching the tables the user names; no tag is needed.
|
|
172
|
-
- `object.auth_required`: Every endpoint requires login except the ones tagged public. → `{"except_tags":["public"]}`
|
|
173
|
-
- `object.auth_required`: Realtime message handlers require login. → `{"object_kinds":["message"]}`
|
|
174
|
-
- `object.description_required`: Every function says what it does in a sentence. → `{"object_kinds":["function"],"min_length":20}`
|
|
175
|
-
- `object.description_required`: Every table field has a description. → `{"object_kinds":["table"],"require_on":["table_field"]}`
|
|
176
|
-
- `object.input_rules`: Passwords are at least 12 characters. → `{"input_names":["password"],"filter_min":{"min":12}}`
|
|
177
|
-
- `object.input_rules`: List endpoints cap their page size. → `{"paging_max_required":true}`
|
|
178
|
-
- `object.input_rules`: Email inputs are typed as email. → `{"type_by_name":{"email":"email"}}`
|
|
179
|
-
- `object.middleware_required`: Every logged-in endpoint runs the rate limiter before its stack. → `{"middleware":["rate_limit"],"phase":"pre","endpoint_auth":"required","object_kinds":["query"]}`
|
|
180
|
-
- `object.naming`: Table names are plural. → `{"name_kind":"object","object_kinds":["table"],"suffixes":["s"]}` — A suffix is literal text: a plural such as people needs an allowed_names entry.
|
|
181
|
-
- `object.naming`: Endpoint paths are snake_case. → `{"name_kind":"endpoint_path","case_style":"snake_case"}` — With CONV-012 in place, change its case_style rather than adding a second naming policy.
|
|
182
|
-
- `object.naming`: Function names start with a verb. → `{"name_kind":"object","object_kinds":["function"],"first_word_must_be":["get","list","create","update","delete"]}`
|
|
183
|
-
- `object.settings_forbidden`: No endpoint caches its response for more than an hour. → `{"object_kind":"query","when":{"cache.active":{"equals":true},"cache.ttl":{"gt":3600}}}`
|
|
184
|
-
- `object.settings_forbidden`: API documentation requires a token. → `{"object_kind":"api_group","when":{"swagger":{"equals":true},"swagger.require_token":{"equals":false}}}`
|
|
185
|
-
- `object.settings_forbidden`: AI agents use only approved model providers. → `{"object_kind":"agent","when":{"model_provider":{"not_in":["openai","anthropic"]}}}`
|
|
186
|
-
- `object.statement_required`: Every scheduled task records an audit event. → `{"functions":["record_audit_event"],"placement":"unconditional","object_kinds":["task"]}`
|
|
187
|
-
- `object.statement_required`: Endpoints that edit employees call the HR role check. → `{"functions":["require_hr_role"],"when":{"statement":"db.edit","tables":["employee"]}}`
|
|
188
|
-
- `object.tag_required`: Every function names its owning team. → `{"tag_set":["team-billing","team-growth"],"object_kinds":["function"]}`
|
|
189
|
-
- `object.tag_vocabulary`: Tags come from the agreed list. → `{"allowed_tags":["pii","phi","public","internal"]}`
|
|
190
|
-
- `object.tag_vocabulary`: Team tags start with team-. → `{"prefixes":["team-"],"allowed_tags":["pii","public"]}`
|
|
191
|
-
- `object.tagged_table_access`: Anything reaching tables tagged phi requires login and calls the access log. → `{"table_tags":["phi"],"function":"log_phi_access"}` — It judges only tables carrying the tag: tag them first. For tables the user names, use object.auth_required with tables.
|
|
192
|
-
- `object.tagged_table_access`: Only clinician logins reach patient tables. → `{"table_tags":["phi"],"auth_tables":["clinician"]}`
|
|
193
|
-
- `object.test_coverage`: Every function has a test. → `{"object_kinds":["function"]}`
|
|
194
|
-
- `object.test_coverage`: Endpoints that touch payments are tested. → `{"tables":["payments"],"object_kinds":["query"]}`
|
|
195
|
-
- `object.unused_input_forbidden`: Endpoints declare only the inputs they use. → `{"object_kinds":["query"]}`
|
|
196
|
-
- `object.unused_input_forbidden`: Unused inputs are reported, except api_version. → `{"allowed_inputs":["api_version"]}`
|
|
197
|
-
- `outbound.vendor_allowlist`: Requests only go to Stripe and our own domain. → `{"kinds":["http"],"hosts":["api.stripe.com",".example.com"]}`
|
|
198
|
-
- `outbound.vendor_allowlist`: AI agents only use OpenAI or Anthropic models. → `{"kinds":["agent.llm"],"providers":["openai","anthropic"]}`
|
|
199
|
-
- `outbound.vendor_allowlist`: Vendor URLs come from environment variables, never literals. → `{"kinds":["http"],"env_hosts":["PAYMENTS_BASE"],"literal_urls_forbidden":true}`
|
|
200
|
-
- `stack.disabled_statement_forbidden`: No switched-off code is left in a stack. → `{}`
|
|
201
|
-
- `stack.disabled_statement_forbidden`: Only disabled debug logs may stay. → `{"allowed_statements":["debug.log"]}`
|
|
202
|
-
- `stack.size_limit`: Endpoints hold at most 30 statements. → `{"max_statements":30,"object_kinds":["query"]}`
|
|
203
|
-
- `stack.size_limit`: Functions hold at most 80 statements. → `{"max_statements":80,"object_kinds":["function"]}` — One rule per kind gives each kind its own limit.
|
|
204
|
-
- `stack.size_limit`: Nothing nests more than 3 levels deep. → `{"max_nesting":3}`
|
|
205
|
-
- `stack.statement_forbidden`: AI tools can't delete records. → `{"statements":["db.del","db.bulk.delete","db.truncate"],"object_kinds":["tool"]}`
|
|
206
|
-
- `stack.statement_forbidden`: Nothing calls an external MCP server. → `{"statements":["ai.external.mcp.*"]}`
|
|
207
|
-
- `stack.statement_forbidden`: Public endpoints don't send email. → `{"statements":["util.send_email"],"endpoint_auth":"none","object_kinds":["query"]}`
|
|
208
|
-
- `stack.statement_order`: Records are deleted and emails sent only after an approval check. → `{"before":{"functions":["require_approval"]},"after":["db.del","db.bulk.delete","util.send_email"]}` — It confirms the call comes first, not what the function decides.
|
|
209
|
-
- `stack.statement_order`: Charges run only after the order is validated. → `{"before":{"functions":["validate_order"]},"after":["api.request"],"tables":["orders"]}`
|
|
210
|
-
- `stack.unused_variable_forbidden`: Every variable is read after it is set. → `{}`
|
|
211
|
-
- `stack.unused_variable_forbidden`: Query results are used. → `{"include_results_of":["db.query","db.get"]}`
|
|
212
|
-
- `statement.containment`: AI calls are never made inside a loop. → `{"statements":["ai.agent.run","ai.external.mcp.tool.run"],"must_not_be_inside":["foreach","for","while"]}`
|
|
213
|
-
- `statement.containment`: Database reads are never made inside a loop. → `{"statements":["db.query","db.get"],"must_not_be_inside":["foreach","for","while"]}`
|
|
214
|
-
- `statement.containment`: Payment writes happen inside a transaction. → `{"statements":["db.add","db.edit","db.patch"],"must_be_inside":["db.transaction"],"tables":["payments"]}`
|
|
215
|
-
- `statement.expression_rule`: Error messages never include request input. → `{"statements":["throw"],"param_names":["value"],"must_not_reference":["$input"]}`
|
|
216
|
-
- `statement.expression_rule`: Raw SQL never joins text into the query. → `{"statements":["db.direct_query"],"param_names":["sql"],"operators_forbidden":["~"]}`
|
|
217
|
-
- `statement.expression_rule`: Datadog logs never include the logged-in user. → `{"statements":["datadog.log"],"param_names":["message","attributes"],"must_not_reference":["$auth"]}`
|
|
218
|
-
- `statement.param_bound`: Endpoints never return a whole table. → `{"statements":["db.query"],"param_names":["per_page"],"max":1000,"unit":"rows","object_kinds":["query","tool"]}` — A list read with paging off is reported as unbounded; count and single reads are not judged.
|
|
219
|
-
- `statement.param_bound`: Pages hold at most 100 rows. → `{"statements":["db.query"],"param_names":["per_page"],"min":1,"max":100,"unit":"rows"}`
|
|
220
|
-
- `statement.param_bound`: Login sessions last at most a day. → `{"statements":["security.create_auth_token"],"param_names":["expiration"],"max":86400,"unit":"seconds"}`
|
|
221
|
-
- `statement.param_forbidden`: External requests never switch off certificate checks. → `{"statements":["api.request","stream.from_request"],"param_names":["verify_peer","verify_host"],"values":[false]}`
|
|
222
|
-
- `statement.param_forbidden`: External requests don't follow redirects. → `{"statements":["api.request"],"param_names":["follow_location"],"values":[true]}`
|
|
223
|
-
- `statement.param_required`: Reads name the fields they return. → `{"statements":["db.query","db.get"],"param_names":["output"]}`
|
|
224
|
-
- `statement.param_required`: Reads of tables tagged phi name the fields they return. → `{"statements":["db.query","db.get"],"param_names":["output"],"table_tags":["phi"]}`
|
|
225
|
-
- `table.auth_table_rules`: Users sign in through one table. → `{}`
|
|
226
|
-
- `table.auth_table_rules`: Only the customer and staff tables hold logins. → `{"auth_tables":["customer","staff"]}`
|
|
227
|
-
- `table.coverage_required`: Tables tagged retained have a cleanup task. → `{"tags":["retained"],"referenced_by":{"object_kinds":["task"],"statements":["db.del","db.bulk.delete"]}}`
|
|
228
|
-
- `table.coverage_required`: The erasure function deletes from every table tagged personal. → `{"tags":["personal"],"referenced_by":{"object_kinds":["function"],"tags":["erasure"],"statements":["db.del","db.bulk.delete"]}}` — Tag the erasure function erasure; add db.edit or db.patch where a table is anonymised instead.
|
|
229
|
-
- `table.field_attribute_required`: Card numbers and security codes are never stored. → `{"field_names":["card_number","cvv"],"forbidden":true}` — forbidden reports every table that declares a listed field.
|
|
230
|
-
- `table.field_attribute_required`: Email fields are typed as email. → `{"field_names":["email"],"type":"email"}`
|
|
231
|
-
- `table.tag_required`: Tables holding a diagnosis or clinical notes are tagged phi. → `{"field_names":["diagnosis","clinical_notes"],"tag":"phi"}`
|
|
232
|
-
- `table.tag_required`: Tables with a sensitive field are tagged confidential. → `{"include_sensitive":true,"tag":"confidential"}`
|
|
233
|
-
- `table.view_hide_required`: Saved views hide salary as well as sensitive fields. → `{"fields":["salary"]}`
|
|
234
|
-
- `table.write_location_restricted`: Only the ledger function changes account balances. → `{"restricted_tables":["accounts"],"fields":["balance"],"allowed_functions":["post_ledger_entry"]}`
|
|
235
|
-
- `table.write_location_restricted`: Audit entries are never edited or deleted. → `{"restricted_tables":["audit_log"],"statements":["db.edit","db.patch","db.add_or_edit","db.del","db.truncate","db.bulk.update","db.bulk.patch","db.bulk.delete"]}` — With no allowed function or tag, every listed write is reported.
|
|
236
|
-
- `test.assertion_required`: Every protected endpoint has a test that an anonymous call is rejected. → `{}`
|
|
237
|
-
- `trigger.write_trigger_effects`: Trigger writes don't skip other triggers or re-fire themselves. → `{}`
|
|
238
|
-
- `workspace.object_required`: The audit_log table exists. → `{"object_kind":"table","names":["audit_log"]}`
|
|
239
|
-
- `workspace.object_required`: A scheduled cleanup task exists and runs. → `{"object_kind":"task","names":["purge_expired"]}`
|
|
240
|
-
|
|
241
|
-
Closed value sets worth knowing without a catalogue round-trip:
|
|
242
|
-
|
|
243
|
-
- `literal.credential_shape.patterns`: `stripe`, `aws`, `github`, `pem`, `openai`, `anthropic`, `google_api`, `slack`, `sendgrid`, `twilio`, `jwt`, `url_credentials`, `literal_keys`
|
|
244
|
-
- `literal.credential_shape.locations`: `definition`, `env`, `agent_settings`
|
|
245
|
-
- `object.description_required.require_on`: `object`, `input`, `table_field`
|
|
246
|
-
- `object.middleware_required.phase`: `any`, `pre`, `post`
|
|
247
|
-
- `object.naming.name_kind`: `object`, `endpoint_path`, `table_field`, `input`
|
|
248
|
-
- `object.naming.case_style`: `""`, `snake_case`, `kebab-case`, `camelCase`, `PascalCase`, `lowercase`
|
|
249
|
-
- `object.settings_forbidden.object_kind`: `table`, `query`, `function`, `workflow_test`, `api_group`, `task`, `trigger`, `middleware`, `addon`, `channel`, `message`, `tool`, `agent`, `mcp_server`, `workspace`
|
|
250
|
-
- `object.statement_required.placement`: `any`, `unconditional`, `first`
|
|
251
|
-
- `object.tag_vocabulary.case_style`: `""`, `snake_case`, `kebab-case`, `lowercase`
|
|
252
|
-
- `outbound.vendor_allowlist.kinds`: `http`, `cloud`, `email`, `agent.llm`, `db.external`, `lambda`
|
|
253
|
-
- `statement.expression_rule.operators_forbidden`: `===`, `!==`, `==`, `!=`, `>=`, `<=`, `&&`, `||`, `~`, `+`, `-`, `*`, `/`, `%`, `<`, `>`
|
|
254
|
-
- `workspace.object_required.object_kind`: `table`, `query`, `function`, `workflow_test`, `api_group`, `task`, `trigger`, `middleware`, `addon`, `channel`, `message`, `tool`, `agent`, `mcp_server`, `workspace`
|
|
255
|
-
|
|
256
|
-
Nested object parameters and their keys:
|
|
257
|
-
|
|
258
|
-
- `db.where_constraint_required.table_selector` — keys `names`, `tag`, `has_field`, `has_fk_to`. Example: `{"names":["order"]}`
|
|
259
|
-
- `object.input_rules.type_by_name` — keys `<input name>`. Example: `{"email":"email"}`
|
|
260
|
-
- `object.input_rules.filter_min` — keys `<filter name>`. Example: `{"min":8}`
|
|
261
|
-
- `object.settings_forbidden.when` — keys `<setting>`. Example: `{"exception_policy":{"equals":"silent"}}`
|
|
262
|
-
- `object.statement_required.when` — keys `statement`, `tables`, `fields`, `hosts`. Example: `{"statement":"db.edit","tables":["employee"]}`
|
|
263
|
-
- `stack.statement_order.before` — keys `statements`, `functions`, `must_reference`. Example: `{"statements":["precondition"],"must_reference":["$auth"]}`
|
|
264
|
-
- `table.coverage_required.table_selector` — keys `has_field`, `has_fk_to`. Example: `{"has_field":"created_at"}`
|
|
265
|
-
- `table.coverage_required.referenced_by` — keys `object_kinds`, `tags`, `statements`, `same_table`. Example: `{"object_kinds":["task"],"tags":["retention"],"statements":["db.del","db.bulk.delete"]}`
|
|
266
|
-
|
|
267
|
-
`object.settings_forbidden`'s `when` names a setting by its key below, per `object_kind` (a dotted storage path also works). A secret setting holds a value that is never matched.
|
|
268
|
-
|
|
269
|
-
- `query`: `external_access` (bool; default `true`), `cache.active` (bool; default `false`), `cache.ttl` (number; default `3600`), `response_type` (`standard`, `stream`; default `standard`)
|
|
270
|
-
- `middleware`: `exception_policy` (`silent`, `rethrow`, `critical`; default `silent`), `response_strategy` (`merge`, `replace`; default `merge`)
|
|
271
|
-
- `api_group`: `active` (bool; default `true`), `swagger` (bool; default `true`), `swagger.require_token` (bool; default `false`), `swagger.token` (string, secret)
|
|
272
|
-
- `task`: `active` (bool; default `true`), `datasource` (string)
|
|
273
|
-
- `trigger`: `active` (bool; default `true`)
|
|
274
|
-
- `agent`: `model_provider` (`amazon-bedrock`, `anthropic`, `azure-openai`, `google-genai`, `google-vertexai`, `grok`, `litellm`, `openai`, `openrouter`, `xano-free`)
|
|
275
|
-
- `mcp_server`: `active` (bool; default `true`)
|
|
276
|
-
- `table`: `auth` (bool; default `false`)
|
|
277
|
-
- `workspace`: `swagger` (bool; default `false`), `swagger.require_token` (bool; default `false`)
|
|
278
|
-
<!-- END GENERATED: checks -->
|
|
279
|
-
|
|
280
|
-
## Scoping a rule
|
|
281
|
-
|
|
282
|
-
Scope selects the objects a check reports on. Every scope field is a top-level rule parameter with one spelling; there is no nested `scope` object, and a `scope = {...}` parameter is refused with `"scope" was removed; use the top-level ...`. All set fields must match; omitted or empty fields add no restriction. A check may still read objects outside its scope (auth tables across the branch, called functions, tests, the middleware chain); each check's description says what it reads beyond scope.
|
|
283
|
-
|
|
284
|
-
<!-- BEGIN GENERATED: scope -->
|
|
285
|
-
Scope limits what is reported, not what is read.
|
|
286
|
-
|
|
287
|
-
- `tags` (string[]) — Include only objects carrying any listed exact tag. Uses the object's own tags, not the tags of tables it reads; endpoints also carry their API group's tags.
|
|
288
|
-
- `api_groups` (string[]) — Endpoints in these API groups, matched by exact display or canonical name. Selects endpoints only: every other object kind is excluded.
|
|
289
|
-
- `tables` (string[]) — Tables by exact name, or objects reaching a named table directly or through called functions, attached addons and enabled agent or MCP tool mappings. db.direct_query reaches a table its static SQL names physically (mvpw<workspace>_<table id>).
|
|
290
|
-
- `verbs` (string[]) — Endpoints with these HTTP verbs, matched case-insensitively. Selects endpoints only: every other object kind is excluded.
|
|
291
|
-
- `endpoint_auth` (string) — Endpoints only, from the endpoint's own authentication setting: required selects endpoints that require authentication, none selects public endpoints. Any other object kind is excluded; empty adds no restriction. One of `""`, `none`, `required`.
|
|
292
|
-
- `except_tags` (string[]) — Exclude objects with any listed exact tag; this wins over every other scope field. Endpoints also carry their API group's tags. Empty adds no exclusions.
|
|
293
|
-
- `object_kinds` (string[]) — Include only these object kinds, from those the check inspects. Empty keeps every kind the check supports. One of `table`, `query`, `function`, `workflow_test`, `api_group`, `task`, `trigger`, `middleware`, `addon`, `channel`, `message`, `tool`, `agent`, `mcp_server`, `workspace`.
|
|
294
|
-
- `reaching_table_tags` (string[]) — Include only objects reaching a table carrying any listed exact tag, directly or through called functions, attached addons and enabled agent or MCP tool mappings; db.direct_query reaches a table its static SQL names physically. The table's own tags.
|
|
295
|
-
<!-- END GENERATED: scope -->
|
|
296
|
-
|
|
297
|
-
`api_groups`, `verbs` and `endpoint_auth` select endpoints only and exclude every other object kind. On a check that also inspects other kinds, setting one of them without `object_kinds: ["query"]` draws a rule warning (`api_groups only matches endpoints, so this rule inspects endpoints only; set object_kinds: ["query"] to say so.`); say so explicitly. A scope field that cannot change what a check selects (for example `verbs` on a table check) is refused on save; the catalogue's per-check `scope_fields` lists the fields that apply, with `applies_when` where that depends on another parameter's value. On a check whose kind is a parameter, `object_kinds` applies only when that parameter's value reaches several kinds: `object.naming`'s `name_kind` `object` (twelve kinds, so `object_kinds: ["function"]` judges function names) and `input` (endpoints, functions, addons, tools and message handlers); the parameter's `kinds_by_value` lists the kinds each value reaches. A check parameter can carry `applies_when` too (`object.naming`'s `version_required` applies to `name_kind` `endpoint_path` only, `foreign_key_name` to `table_field`): a rule that sets it for another value is refused on save, and a stored one draws a rule warning and is ignored.
|
|
298
|
-
|
|
299
|
-
Xano already records whether an endpoint is public (its authentication setting), so never add a tag just to restate that. Use `endpoint_auth: "required"` to keep a rule to endpoints that require authentication (test coverage, required middleware), and `endpoint_auth: "none"` to state what public endpoints may not do, e.g. `stack.statement_forbidden` with `statements: ["db.edit", "db.del"]`. `object.auth_required` has no parameters of its own: a deliberately public endpoint is an ordinary exception, `except_tags: ["public"]`, on the endpoint or on its API group.
|
|
300
|
-
|
|
301
|
-
Prefer tags to names. A rule scoped with `tags` or `except_tags` keeps working when an API group or table is renamed, and a new object opts in by carrying the tag; a rule scoped with `api_groups` or `tables` must be edited whenever those names change. A name the branch does not have selects nothing: the run reports it as a warning on the rule's result (`warnings`) without changing the result's status.
|
|
302
|
-
|
|
303
|
-
Example, in the canonical spelling the parser returns:
|
|
304
|
-
|
|
305
|
-
```xs
|
|
306
|
-
params = {
|
|
307
|
-
statements : ["db.add", "db.edit"]
|
|
308
|
-
verbs : ["GET"]
|
|
309
|
-
except_tags : ["generated"]
|
|
310
|
-
object_kinds: ["query"]
|
|
311
|
-
}
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
## Writing parameter values
|
|
315
|
-
|
|
316
|
-
- **Types:** `string[]` is a list of strings; `bool` requires true or false. `number` accepts finite numeric literals, not numeric strings. Every `integer` parameter (`min_count`, `min_length`, `max_length`, `max_statements` and `max_nesting`) takes a whole number of at least 1 and at most 9007199254740991 (2^53 - 1). Bounds are inclusive and use the checked parameter's native units; `unit` only labels findings.
|
|
317
|
-
- **Object values:** use objects such as `{}` for selectors and maps. The catalogue publishes object defaults as `{}`. `value` in `table.field_attribute_required` accepts any literal, including null.
|
|
318
|
-
- **Statement names:** use an exact XanoScript name such as `db.add` or `api.request`; stored aliases such as `mvp:dbo_add` also work. A misspelled name is accepted on save and matches nothing, so the rule inspects no statements and passes (or, for a required-statement check, fails everywhere). Take the name from Statement names below, then evaluate and read the rule result's `warnings`: a name that is not a XanoScript statement is reported there as `Statement "db.edt" is not a XanoScript statement name, so it matches nothing. Did you mean db.edit?` A stored alias containing `:` is compared as written and is never warned about.
|
|
319
|
-
- **Parameter paths:** use a name or dotted path such as `data.role`. Aliases include `per_page` for paging size, `where` for search conditions and `error` for the error message.
|
|
320
|
-
- **References:** match a reference or its child paths. `$auth` matches `$auth.id`; `$input.id` does not match `$input.id2`. Supported roots are `$input`, `$auth`, `$env`, `$var`, `$error` and `$output`. Quoted text is literal. An index is never followed, because it can name any element: a read is matched by the part before its first `[`, so `$input.rows[0].sku` in code is a read of `$input.rows`. A rule's own reference entry (`must_reference`, `must_not_reference`, `before.must_reference` and `compare_to`) is read the same way: `$input.rows[0]` is read as `$input.rows`, and the rule saves with a rule warning, `must_not_reference "$input.rows[0]" is read as $input.rows: a reference is matched by the part before the first [.` (an entry with nothing before the `[` matches no reference, and is warned about too). Write the entry without the index. A quoted key in an entry is read as its dotted segment: `$input["secret"]` is `$input.secret`.
|
|
321
|
-
- **Literal comparison:** false differs from "false", and 0 differs from "0". Equal numbers match, including 1 and 1.0. Empty objects and lists share a stored representation and compare equally. This applies to forbidden literals, field attributes and setting equality.
|
|
322
|
-
- **Names:** table, function, middleware, tag, field and provider names match exactly. Hosts and HTTP verbs ignore case; a host written with a leading dot (`.example.com`) approves that domain and its subdomains. Regex is not supported, and neither are wildcards, except that `stack.statement_forbidden` accepts a trailing `.*` to forbid a statement namespace (`db.external.*`); every other check refuses one in a statement list on save. `stack.unused_variable_forbidden`'s `allowed_variables` also takes a variable-name prefix ending in `*` (`_*`); a bare `*`, or a `*` anywhere else, is refused. `outbound.vendor_allowlist`'s `env_hosts` lists each environment variable by name: an entry holding `*`, `/`, `:`, `[` or `]` is not a variable name and draws a rule warning. The one regular expression is `object.naming`'s `pattern`: an I-Regexp (RFC 9485), the portable subset that every engine reads the same way, always matched against the whole name (so no `^` or `$`); `\d`, `\w`, `\s`, `(?...)` groups, lazy quantifiers, backreferences and `\p{C}`/`\p{Cn}` are refused on save with what to write instead. Credential `patterns` selects built-in shapes.
|
|
323
|
-
- **Combined conditions:** field names and field types must match the same field; table selectors combine all conditions. Allowed write functions and tags are alternatives. `object.input_rules` needs an enabled condition and `statement.containment` needs a structural constraint. `statement.expression_rule` fails an omitted parameter only when the rule sets `must_reference` or `filters_required`.
|
|
324
|
-
- **Tags:** `tags` and `except_tags` match the inspected object's own tags; an endpoint also carries the tags of its API group. `reaching_table_tags`, `table_tags` (`object.tagged_table_access`, `db.output_fields_forbidden`, `statement.param_required`) and `db.where_constraint_required`'s `table_selector.tag` match table tags, and check parameters such as `allowed_tags` read only the object's own tags. The one exception is `object.tag_required`'s `tag_set`, which reads tags as scope does: an endpoint meets it through its own tags or its API group's.
|
|
325
|
-
- **Lists, not single values:** checks that name statements, params, functions or tables take lists (`statements`, `param_names`, `functions`, `restricted_tables`, `names`, `field_types`); any listed entry matches. A list whose default is the built-in set (`literal.credential_shape.patterns`, `outbound.vendor_allowlist.kinds`, `table.write_location_restricted.statements`, `db.write_from_input_forbidden.statements`) stores `[]` for "every built-in, including ones added later"; a listed subset stays that subset.
|
|
326
|
-
|
|
327
|
-
## Statement names
|
|
328
|
-
|
|
329
|
-
The catalogue's `statement_groups` are the statement names a rule is written with, by what the statements do, each with the params checks read on it. Write these XanoScript names in `statements`, `after`, `must_be_inside` and the other statement parameters.
|
|
330
|
-
|
|
331
|
-
<!-- BEGIN GENERATED: statements -->
|
|
332
|
-
| Does | Statements, with the params checks read on each | Note |
|
|
333
|
-
| --- | --- | --- |
|
|
334
|
-
| External calls | `api.request` (url, params, headers, timeout, verify_peer, verify_host, follow_location), `stream.from_request` (url, timeout, verify_peer, verify_host), `webflow.request` (timeout), `api.microservice` (host, timeout), `api.lambda` (code, timeout), `cloud.algolia.request` (url), `cloud.elasticsearch.request` (url), `cloud.aws.opensearch.request` (url), `db.external.postgres.direct_query` (connection_string, sql), `db.external.mysql.direct_query` (connection_string, sql), `db.external.mssql.direct_query` (connection_string, sql), `db.external.oracle.direct_query` (connection_string, sql), `db.external.snowflake.direct_query` (connection_string, sql) | A model called over HTTP is an api.request: judge it by host. outbound.vendor_allowlist reads every destination by kind. |
|
|
335
|
-
| AI and LLM calls | `ai.agent.run` (args, allow_tool_execution), `ai.external.mcp.tool.run` (url, tool, args), `ai.external.mcp.tool.list` (url), `ai.external.mcp.server_details` (url) | There is no prompt statement: code calls a model through an agent or over HTTP. An agent's model provider is its model_provider setting. |
|
|
336
|
-
| Email and messaging | `util.send_email` (service_provider, to, subject, message), `realtime.publish` (channel, message, data), `api.realtime_event` (channel, data) | util.send_email's service_provider defaults to xano; realtime statements reach your own clients. |
|
|
337
|
-
| Database writes | `db.add` (data), `db.add_or_edit` (data), `db.edit` (data), `db.patch`, `db.del`, `db.truncate`, `db.bulk.add`, `db.bulk.update`, `db.bulk.patch`, `db.bulk.delete`, `db.increment`, `db.direct_query` (sql) | The deletes are db.del, db.bulk.delete and db.truncate. |
|
|
338
|
-
| Database reads | `db.query` (output, per_page, where), `db.get` (output), `db.has`, `db.direct_query` (sql) | per_page is the page size a paged db.query applies; output is a read's field list. |
|
|
339
|
-
| Logging | `debug.log` (value), `datadog.log` (message, attributes), `datadog.log_bulk` (entries) | |
|
|
340
|
-
| Auth and security | `security.create_auth_token` (expiration), `security.jws_encode` (ttl), `security.jwe_encode` (ttl), `security.check_password`, `security.create_password`, `security.encrypt`, `security.decrypt`, `precondition` (error, payload) | expiration and ttl are in seconds. |
|
|
341
|
-
| Loops and blocks | `foreach`, `for`, `while`, `conditional`, `switch`, `group`, `try_catch`, `db.transaction` | The blocks statement.containment names; loops are foreach, for and while. |
|
|
342
|
-
<!-- END GENERATED: statements -->
|
|
343
|
-
|
|
344
|
-
## Findings
|
|
345
|
-
|
|
346
|
-
A finding carries `policy_key`, `policy_title`, `rule_id`, `rule_title`, `severity`, an `object` reference and a `message` saying what was found and where in the stack. Three checks also set `allow`, the values a rule parameter could list to clear the finding: `literal.credential_shape` (`{allowed_secrets: ["sha256:<64 hex>", ...]}`, the full fingerprints of the secrets it reports; its message names them short), `object.naming` (`{allowed_names: [...]}`, every failing name, even when the message stops at 10) and `object.tag_vocabulary` (`{allowed_tags: [...]}`, the unaccepted tags with no suggested spelling). Listing an `allow` value is the policy owner's decision, never a fix. Findings arrive in one order: blocking first, then by severity, policy key, rule position (R2 before R10) and object. `rule_title` is the rule's own title, else its check's label, else its id; `severity` is the owning policy's, so every finding of one policy shares it. A finding `id` is prefixed with the policy key when the rule id does not already name it, so two policies whose rules share an id still produce distinct findings. Guidance that applies to the whole policy, such as how to request an exemption, belongs in the policy `statement`. Some catalogue entries carry an optional static `fix_hint` string describing the usual fix for that check; it is the same for every rule that uses the check.
|
|
347
|
-
|
|
348
|
-
<!-- BEGIN GENERATED: fix-hints -->
|
|
349
|
-
- `db.output_fields_forbidden`: Remove the field from the statement's output list, or list the output explicitly without it, and say what callers stop receiving. When the object must read it (to verify a password, say), the rule does not fit that object: exempting it is the policy owner's decision, not a fix.
|
|
350
|
-
- `literal.credential_shape`: Use a workspace environment variable ($env) instead of the literal; the user sets its value and rotates the exposed one, never you in a file. Never quote any part of the value, even a prefix. A value already in an environment variable is in place: change nothing, and leave narrowing the rule's locations to the owner. Allowing a value by its fingerprint (allowed_secrets) is the owner's call; never add one.
|
|
351
|
-
- `object.auth_required`: Enabling auth changes who can call the endpoint or handler: ask first, naming the auth table you would use. If it is deliberately public (login, signup, webhook, health), exempting it (the policy's except_tags) is the policy owner's decision: propose it, never apply it.
|
|
352
|
-
- `object.description_required`: Write a description that says what the object, input or field is for, in words its callers need, at least as long as min_length; never pad it to reach that length. For an AI tool, the text judged is its instructions (its description only when it has none), so write those. When the purpose is unclear, ask. In XanoScript, the description is the // comment lines directly above the object, input or field, not a code comment: write or edit those lines, and never add a description = line as well, which doubles it. An AI tool's own instructions are set by its instructions = line.
|
|
353
|
-
- `object.input_rules`: Without input_names, filter rules reach every text input; set input_names to target inputs, one rule per group.
|
|
354
|
-
- `object.middleware_required`: Attaching per object replaces inherited middleware; prefer the API group, channel or branch default, and ask.
|
|
355
|
-
- `object.naming`: Renaming changes every reference to the name: endpoint URLs that callers use, function.run calls, table and field names in queries. Ask before renaming. To keep an existing name, list it in allowed_names or tag the object and list the tag in except_tags.
|
|
356
|
-
- `object.unused_input_forbidden`: Removing an input changes the API contract that clients, agents and callers see. Check who sends it before deleting it, and list it in allowed_inputs if it is kept on purpose. A read that sits only in disabled code means that code was meant to use it: decide whether to restore or delete the code first.
|
|
357
|
-
- `outbound.vendor_allowlist`: Approving a vendor is the policy owner's decision: report the host and ask, or ask the owner to approve the env var in env_hosts. Never add it to the allowlist yourself, and never replace a dynamic URL with a literal. A literal URL reported because literal_urls_forbidden is on moves into an environment variable: ask the owner which variable holds it, to set it in each environment, and to list it in env_hosts; never list it yourself.
|
|
358
|
-
- `stack.disabled_statement_forbidden`: Delete the disabled statement once nobody needs it. Do not enable it just to clear the finding: it was switched off on purpose, and enabling it changes what the object does, so ask its owner. A statement the team switches on while debugging goes in allowed_statements.
|
|
359
|
-
- `stack.size_limit`: Move a coherent part of the stack into a function and call it. To flatten nesting, stop early instead of wrapping the rest of the stack in another conditional: use a return, a continue inside a loop, or a precondition when the case is an error. Never disable, delete or comment out statements to get under the limit. Raising the limit or exempting the object is the policy owner's call.
|
|
360
|
-
- `stack.unused_variable_forbidden`: Remove the variable, not the work. For a statement result, delete as $name and keep the statement: db.add, api.request and function.run still have to run. For a var or a change statement that nothing reads, delete that statement. A read that sits only in disabled code means that code was meant to use it: decide whether to restore or delete the code first.
|
|
361
|
-
- `statement.param_bound`: A runtime value cannot be verified statically: bound its source or ask; do not hardcode a literal.
|
|
362
|
-
- `statement.param_forbidden`: A runtime value cannot be verified statically: bound its source or ask; do not hardcode a literal.
|
|
363
|
-
- `table.auth_table_rules`: Which table is the auth table is the owner's decision: ask before changing table or endpoint auth to clear this. Several intentional auth tables belong in auth_tables.
|
|
364
|
-
- `table.coverage_required`: A placeholder object satisfies the check, not the policy; ask what it must do. Never rename an existing object to match a name the rule lists.
|
|
365
|
-
- `table.field_attribute_required`: Removing or retyping a field loses data; ask first.
|
|
366
|
-
- `test.assertion_required`: Add an endpoint unit test with no token expecting to_throw "Unauthorized", or a workflow test calling it with no token inside expect.to_throw "Unauthorized".
|
|
367
|
-
- `workspace.object_required`: A placeholder object satisfies the check, not the policy; ask what it must do. Never rename an existing object to match a name the rule lists.
|
|
368
|
-
<!-- END GENERATED: fix-hints -->
|
|
369
|
-
|
|
370
|
-
A rule with `checked: 0` and no findings has status **`no_objects`** and message `no objects checked`. Older stored runs keep `pass` with `checked: 0`; readers accept both as no objects checked. The run and `policy_check` stay `pass` when nothing failed, and `policy_check.message` names the unchecked rules. The CLI and Studio show no objects checked, which proves nothing about coverage: it says the rule's scope matched no objects, not that anything satisfied the rule. Treat it as a question about the scope: widen it until it reaches the objects the `statement` is about, or confirm that matching nothing on this branch is intended. Merge, publish and deploy gates still read findings, so `no_objects` does not block them.
|
|
371
|
-
|
|
372
|
-
### Fixing a finding
|
|
373
|
-
|
|
374
|
-
Read the policy before editing anything: its `statement`, and the failed rule's check, params and scope. A finding is one line about one object; whether the rule was meant to reach that object is only answerable from the rule. A fix changes the object the finding names, and every change it could make is in one of three classes. A check's `fix_hint` adds detail to this rule and never overrides it.
|
|
375
|
-
|
|
376
|
-
- **Do it** once the user has asked for a fix: the change the failed rule asks for, on the object the finding names, that leaves who may call it and every table and its data as they are. Add the required statement or call, constrain a read or write by a field that exists, make a flag or parameter explicit, drop the forbidden field from what a statement returns, replace a literal secret with an `$env` reference, add the unit test the rule asks for (the only extra object a fix may create). Then say what changed, object by object, and what a caller now sees differently.
|
|
377
|
-
- **Ask first**, showing the exact change: enabling or changing an endpoint's auth or auth table (it changes who can call it; a login, signup or webhook is often public on purpose), adding, renaming, retyping or deleting a table or field, writing or deleting data, activating, deactivating or rescheduling a task or trigger, creating an object other than the required unit test, adding or removing a tag (tags decide which policies apply), removing behaviour, or touching an object the findings do not name. Ask too when the rule names a field, table or tag the object does not have, or tests something the `statement` never asks for: the policy is then probably scoped too wide (an empty selector or scope means everything) or lacks an exemption.
|
|
378
|
-
- **Never, in a fix:** edit the policy; add a tag that exempts the object (one a policy's `except_tags` or `table.write_location_restricted`'s `allowed_tags` lists), an allowlist entry or an `allowed_secrets` fingerprint; rename, delete or retype a table or field to match a rule (tables are shared by every branch); invent a GUID, schema or value; work around a plan limit. When only one of these would clear a finding, leave it: that is the policy owner's decision. Offer it last among the options, labelled so.
|
|
379
|
-
|
|
380
|
-
Fix at most three objects before checking back with the user, blocking findings first. Never quote any part of a secret in a reply, not even a prefix. Never relax a rule silently, and never infer an intent the `statement` does not state. In a non-interactive run, make only the first class of change and report the rest.
|
|
381
|
-
|
|
382
|
-
### An object's coverage and draft checks
|
|
383
|
-
|
|
384
|
-
In the dashboard, an object's page shows a **Policies** chip and panel: the active policies that apply to it and why, and its findings in the branch's newest run (`Policies ✓ 6 pass`, `Policies 2 blocking · 1 advisory`, `3 apply · not checked yet`, `Last check failed`, `None apply`). A member without `workspace:policy` read who may read the object sees it too, trimmed: each applying policy's key, title, Blocking or Advisory and why it applies, the passing ones included, and each finding's policy key, rule name, message and the check's fix hint (opened: the check's label and the first sentence of its description). It leaves out statements, rule settings and warnings, links to the policy and its reports, and other objects' findings, and ends with a muted note that full details need `workspace:policy` read. The same trimmed answer is served on the Metadata API (`GET /workspace/{id}/policy/object/coverage?type=&id=&branch=`), by `xano policy coverage <type>:<id>` and by the authenticated MCP's `xano_get_policy_coverage` (the workspace object's id is the workspace's own id: `workspace:17`); it needs only the object kind's own read permission (see Permissions). The answer is the same for every caller and is cached for 60 seconds by object, the branch's latest run and the workspace's checksum with the policies' fingerprint, so a write, a policy change or a new run is never answered from the cache. Without policy read the rule and its statement cannot be read, so fix from the message and fix hint, and ask the policy's owner when the rule's intent matters.
|
|
385
|
-
|
|
386
|
-
While an object has a draft, Studio checks that draft alone, laid over the published branch, when the XanoScript editor saves it or when **Check draft** in the chip or panel is pressed; it does not check on page open (`Draft not checked`). The draft's result replaces the published one, labelled Draft, with New and Fixed markers, a count of the findings it introduces on other objects (linked for policy readers, a count only for anyone else) and, on the live branch, whether publishing it would be refused. Only a member who may edit the object (its kind's update permission, as Save asks) has its draft checked. A draft check stores nothing (no run, report or audit row), runs in its own small pool and answers busy when every slot is taken (check again in a moment); a slot's lease is renewed between rules while its check runs, so a check of a large branch keeps its slot, and a worker that dies frees it within a minute. Each member may ask for 20 draft checks a minute in a workspace (past that, 429 `policy_draft_check_rate_limited` with `retry_after`, which Studio also shows as busy), and a draft is at most 1 MiB as JSON (400 `policy_draft_too_large`; Studio says `This draft is too large to check.` without sending it). It is Studio-only: the Metadata API, the CLI and the MCP have no draft check, so outside Studio evaluate after the change is saved or pushed.
|
|
387
|
-
|
|
388
|
-
## Following policies while you change code
|
|
389
|
-
|
|
390
|
-
Policies are not only for policy work. When the branch has **active** policies (files under `policies/`, or a non-empty `xano_list_policies` / `xano policy list`), every code change should keep to the active **blocking** ones — their findings refuse a merge, a publish or push to the live branch, and a tenant deploy — and ideally to the advisory ones too:
|
|
391
|
-
|
|
392
|
-
1. Before writing code, read the active policies that apply to what you are changing (their `statement` and rules).
|
|
393
|
-
2. Write code that meets them. A rule you cannot meet is a question for the user, not something to route around (see above: never exempt the object yourself).
|
|
394
|
-
3. After changing code, evaluate the branch and read what the change introduced: `xano policy evaluate` (exit 2 means a blocking finding), the `policy_check` that `xano workspace push` returns, or the authenticated MCP's `xano_evaluate_policies`. Report only what the evaluation printed.
|
|
395
|
-
|
|
396
|
-
The generated `xano-policies` skill carries the same instructions for the surface it is pulled for.
|
|
397
|
-
|
|
398
|
-
## Permissions
|
|
399
|
-
|
|
400
|
-
Every policy request passes the same gates. A refusal is an HTTP 403, and its `payload.code` names the gate, so a client keys on the code rather than on the wording:
|
|
401
|
-
|
|
402
|
-
| Gate | Passes when | `payload.code` | Refusal message |
|
|
403
|
-
| --- | --- | --- | --- |
|
|
404
|
-
| Feature | The instance has the `policies` feature enabled | `policy_feature_disabled` | `Policies are not enabled on this instance.` |
|
|
405
|
-
| Role permission | The caller's role (or its override on this workspace) grants `workspace:policy` at the level the operation needs | `policy_permission_required` | `The workspace:policy <level> permission is required on this workspace.` |
|
|
406
|
-
| Token scope | A Metadata API access token was created with that `workspace:policy` level | `policy_scope_required` | `This API token was not granted the workspace:policy <level> scope.` |
|
|
407
|
-
| Writable session | A write (create, update, restore, delete) comes from a session that may write: not a read-only Studio session or a read-only impersonation | none | `This is a read-only session. Enable editing to modify this resource.` |
|
|
408
|
-
| OAuth ceiling | An OAuth token carries `workspace:read` (reads) or `workspace:write` (writes) | none | `insufficient_scope: workspace:read` or `workspace:write` |
|
|
409
|
-
|
|
410
|
-
One route family is the exception: an object's coverage (`policy/object/coverage`, both APIs) and Studio's draft check need the object kind's own permission instead of `workspace:policy`, **read** for coverage and **update** for the draft check, since someone who may not edit an object has no draft of it (`workspace:api` for an endpoint or API group, `workspace:function`, `workspace:database` for a table, `workspace:task`, `workspace:middleware`, `workspace:addon`, `workspace:workflow_test`, `workspace:tool` for tools, agents and MCP servers, `workspace:realtime` for channels and messages, `workspace:settings` for the workspace; a trigger's by what it is attached to, its `obj_type`: `workspace:database` for a table trigger, `workspace:tool` for an agent or MCP server trigger, `workspace:realtime` for a realtime trigger, `instance:workspace` for a workspace or error trigger and for a trigger the branch does not hold, and all four for one whose `obj_type` cannot be resolved; a trigger the caller may not use is answered exactly as one the branch does not hold, refused naming `instance:workspace` or a 404 to a caller who holds it, so its existence never shows), behind the same feature gate and OAuth `workspace:read` ceiling, which is checked first. Its refusal is `policy_object_permission_required` (403, with `permission`, `level` (`read` or `update`) and `type`): `Reading this function needs the workspace:function read permission.`, or for a draft check `Checking a draft of this function needs the workspace:function update permission.`
|
|
411
|
-
|
|
412
|
-
Both coded permission refusals also carry `permission` (`workspace:policy`) and `level`. A refused push lists the policy files it would have written in `payload.policies`, and its message ends `; nothing was imported: KEY, KEY`. The remedy follows the code: `policy_permission_required` needs an instance admin to grant the role's Workspace Policies permission (a new token does not help); `policy_scope_required` needs a token created with the level.
|
|
413
|
-
|
|
414
|
-
The `workspace:policy` permission level each operation needs:
|
|
415
|
-
|
|
416
|
-
| Operation | `workspace:policy` level | OAuth ceiling |
|
|
417
|
-
| --- | --- | --- |
|
|
418
|
-
| List, get, check catalogue, policies for an object, runs, one run (whole, its summary or its findings pages), parse | `read` | `workspace:read` |
|
|
419
|
-
| Evaluate (run checks) | `read` | `workspace:read` |
|
|
420
|
-
| One object's coverage (`policy/object/coverage`) | none: the object kind's own read permission | `workspace:read` |
|
|
421
|
-
| Studio's draft check | none: the object kind's own update permission | `workspace:read` |
|
|
422
|
-
| Create a policy | `create` | `workspace:write` |
|
|
423
|
-
| Update a policy, restore a version | `update` | `workspace:write` |
|
|
424
|
-
| Delete a policy | `delete`, an active blocking policy included | `workspace:write` |
|
|
425
|
-
| `workspace pull` / export with policies included | `read` (without it the export still succeeds and omits policies) | `workspace:read` |
|
|
426
|
-
| `workspace push` / import of a policy file that differs from the stored policy | `create` or `update` | `workspace:write` |
|
|
427
|
-
| Archive import carrying policies | `create` and `update` (without them the archive imports and its policies are skipped, each skip written to the audit log); an import that would delete existing policies needs `delete` | - |
|
|
428
|
-
| Branch merge that adds, changes or deletes a policy | `create`, `update` or `delete` for what it changes | - |
|
|
429
|
-
| Override a blocking gate | `update` (with a reason) | `workspace:write` |
|
|
430
|
-
| Release cut from a branch or tenant, tier1 tenant, ephemeral or sandbox push, release deploy | none: this is deployment, not authoring | - |
|
|
431
|
-
| `release push` (a release built from files), or a release archive upload that carries policies | `create` and `update` to carry its policy files; without them `release push` carries the workspace's live-branch policies instead (naming the files in `policies_skipped` when they differ) and an archive upload is refused | - |
|
|
432
|
-
| Any export or import while the `policies` feature is off | none: exports omit policies; a push leaves its policy files out and names them in `policies_skipped`, and an archive import leaves its policies out (each audited as `policy:import_skipped`); the workspace's own policies are never changed, and a replace deletes only those of the branches it removes | - |
|
|
433
|
-
|
|
434
|
-
`workspace:policy` is a level set on a Metadata API access token and on a role's "Workspace Policies" permission; a per-workspace override on a member wins over the role. Both must allow the operation. A token created before policies existed carries no `workspace:policy` level, so it reads nothing until it is reissued. An OAuth token has no per-permission levels: `workspace:read` or `workspace:write` is its ceiling, and the role's permission decides the rest.
|
|
435
|
-
|
|
436
|
-
Who can author: whoever holds the `workspace:policy` permission at create, update or delete level. A role grants it like any other permission, custom roles included; a role that grants only `read` can read policies and run checks but cannot change them, and reissuing a token does not change that.
|
|
437
|
-
|
|
438
|
-
Evaluate needs only `read`, so a reviewer or a CI credential can run checks. Storing the run is a write: from a read-only session, or an OAuth token without `workspace:write`, the evaluation returns its findings with `stored: false` and run id `0`, and the retained runs are untouched.
|
|
439
|
-
|
|
440
|
-
A policy file that is identical to the stored policy needs no write permission in a push: it is reported `unchanged` and skipped. A policy file that differs, pushed by a caller whose `workspace:policy` permission does not allow that change, refuses the whole push before anything is imported, naming the policy keys (`policy_permission_required` or `policy_scope_required`, with `payload.policies`). Exclude the policy files (`xano workspace push -e "policies/*"`) or pull again to push the rest.
|
|
441
|
-
|
|
442
|
-
What a policy reader can see: a finding names the object it is about - its type, name and id - and says where in the stack the problem is, for any object on the branch. `workspace:policy` read therefore shows object names and ids across the branch even to a role with no access to, say, the database or that API group. The credential check never prints the literal it matched; it names the SHA-256 fingerprint instead. A rule's `allowed_secrets` lists the fingerprints (`sha256:` and 64 lowercase hex digits, e.g. from `printf %s "$VALUE" | shasum -a 256`, or copied from the finding) of values the owner reviewed, and the check skips them wherever it looks. A policy never holds the value itself: any other entry is refused, naming only its position, and an entry that allows nothing is a rule warning. Allowing a secret relaxes the policy, so an agent adds one only when the user asks. A gate refusal lists its blocking findings only to a caller who holds `workspace:policy` read; anyone else gets the counts, the run id and, in its message, the keys of the policies they come from.
|
|
443
|
-
|
|
444
|
-
A `workspace push` (or upload-URL import) by a caller without `workspace:policy` read is evaluated as anyone's is, and the run is stored, but its `policy_check` tells that caller only their own findings on the objects the push carried that they may read (a push that carries the workspace document carries the workspace object too, listed to a caller with `workspace:settings` read), trimmed as an object's coverage is: `{status, message, blocking, run_id: 0, access: "coverage", scope: "pushed_objects", findings, blocking_findings, elsewhere {total, blocking, basis}, results: [], counts {findings, blocking, errors}, total, truncated, note}`. Each finding is `{id, policy_key, policy_title, rule_title, message, blocking, deleted, object, check {label, description, fix_hint} or null}`. The counts are about those findings, except `counts.errors`, the branch's rules that could not run. `elsewhere` counts, never names, the findings on the objects it does not list: with `basis: "introduced"`, those the push introduced (on the live branch, not in the push gate's own evaluation of the branch just before the push; on any other branch, not in the branch's newest run just before the push, while that run still described the branch); with `basis: "all"`, when no such baseline was known, every finding there, existing ones included. Which objects are theirs follows the coverage rule (see Permissions), a trigger by its `obj_type`. `blocking` is what a reader's push of the same change says (the branch holds a blocking finding after it), so the CLI exits 2 for the same push whoever made it, even with nothing of theirs listed; `status` is `fail` when anything is listed, `elsewhere.total` is above 0 or `blocking` is true, else `error` when a rule errored, else `pass`. An older platform answers such a caller `forbidden` and evaluates nothing.
|
|
445
|
-
|
|
446
|
-
Policy text stays behind this permission. Git sync carries no policies: it leaves the policy files out of the repository, and its commit message says how many. The workspace audit log names each policy change by the policy's identity (id, key, title, version, active, enforcement, actor and action), never its document or source, which live in Version History behind policy read. Request history follows the same line: for a viewer without `workspace:policy` read (or while the policies feature is off), a Metadata API call that carries policy details (a policy route, the object coverage route included, a policy refusal, a push's `policy_check`, a policy document) shows `Hidden: this call carries policy details, which need workspace:policy read.` as its whole input and output. An endpoint's own request history is never masked.
|
|
447
|
-
|
|
448
|
-
Policies are saved directly, not drafted. `active = false` makes a policy inactive; it does not create a draft. New authored source and structured saves refuse `lifecycle` with `policy: "lifecycle" was replaced by "active"; write active = true or active = false.` Source refusals include the line and column. Stored/imported legacy policies are migrated (`draft` becomes `active: false`); explicit boolean `active` takes precedence. An active policy needs at least one rule; set `active = false` instead to save one without rules.
|