@xano/developer-mcp 2.3.0-beta.3 → 2.3.0-beta.4

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 CHANGED
@@ -416,6 +416,7 @@ Retrieves XanoScript programming language documentation with context-aware suppo
416
416
  | `branch` | Branch-level settings: middleware, history retention, visual styling |
417
417
  | `workspace` | Workspace-level settings: environment variables, preferences, realtime |
418
418
  | `policies` | Workspace policy documents: syntax, the check catalogue, templates and authoring rules |
419
+ | `policy-templates` | The platform's policy templates, recipes for goals that take several, and what no check can see |
419
420
 
420
421
  **Examples:**
421
422
  ```
@@ -610,6 +611,7 @@ The server also exposes XanoScript documentation as MCP resources for direct acc
610
611
  | `xanoscript://docs/branch` | Branch-level settings |
611
612
  | `xanoscript://docs/workspace` | Workspace-level settings |
612
613
  | `xanoscript://docs/policies` | Workspace policy documents |
614
+ | `xanoscript://docs/policy-templates` | Policy templates and recipes |
613
615
 
614
616
  ## npm Scripts
615
617
 
@@ -621,7 +623,7 @@ The server also exposes XanoScript documentation as MCP resources for direct acc
621
623
  | `test` | `vitest run` | Run unit tests |
622
624
  | `test:watch` | `vitest` | Run tests in watch mode |
623
625
  | `test:coverage` | `vitest run --coverage` | Run tests with coverage report |
624
- | `gen:policy-docs` | `node scripts/gen-policy-check-docs.mjs` | Regenerate the check catalogue regions of `policies.md` from `scripts/policy-catalogue.json` |
626
+ | `gen:policy-docs` | `node scripts/gen-policy-check-docs.mjs` | Regenerate the check catalogue regions of `policies.md`, and `policy-templates.md`, from `scripts/policy-catalogue.json` |
625
627
 
626
628
  ## Project Structure
627
629
 
@@ -739,7 +741,7 @@ Compiles TypeScript to JavaScript in the `dist/` directory.
739
741
  - **aliases**: Alternative names for topic lookup
740
742
  - **priority**: Ordering weight for file_path matching
741
743
  - **exclusive**: The topic alone documents the files its `applyTo` matches, so file_path mode returns only that topic
742
- - The check catalogue in `policies.md` is generated between its `BEGIN GENERATED` and `END GENERATED` markers. To refresh it, save the catalogue the platform serves (`xano policy catalogue -o json`, from an instance running the matching platform version) to `scripts/policy-catalogue.json`, then run `npm run gen:policy-docs`; a test fails when the two disagree
744
+ - The check catalogue in `policies.md` (the checks and their uses, the scope fields, the statement names and the fix hints) is generated between its `BEGIN GENERATED` and `END GENERATED` markers, and `policy-templates.md` (the templates, the recipes and what no check can see) is generated whole. To refresh them, save the catalogue the platform serves (`xano policy catalogue -o json`, from an instance running the matching platform version) to `scripts/policy-catalogue.json`, then run `npm run gen:policy-docs`; a test fails when the two disagree
743
745
 
744
746
  **Meta API Documentation** (`src/meta_api_docs/`):
745
747
  - TypeScript modules with structured documentation
@@ -24,7 +24,7 @@ Policy source uses active = true or active = false before enforcement. The retir
24
24
 
25
25
  A parse or validation error in summary output is located at line N, col M, with line 1 the first line, followed by the offending text; -o json keeps the platform payload untouched, whose line and col count from 1 too. Every policy command run with -o json reports its own failure as one object on stdout rather than as prose on stderr: {"error": {"message": "...", "exit": 1}}, and exits 1. Exit 2 is never an error object: it is reserved for blocking findings, which are ordinary results.
26
26
 
27
- policy evaluate and workspace push print the platform's policy_check verdict (see the Metadata API policy topic for the statuses). Their exit code follows the import and the blocking policies only: 1 when the import or the request fails, 2 whenever policy_check.blocking is true (an active blocking policy has findings; an inactive policy never blocks), and 0 otherwise. A pass, a fail and not_applicable (no active policy on the branch) print a headline with the platform's message; disabled, unavailable, error, any other status (an older instance's forbidden) or no feedback at all print one warning line on stderr with the platform's status and message, and leave the exit code alone. A workspace push by a credential without workspace:policy read gets a policy_check with access: "coverage" and scope: "pushed_objects": only its own findings on the objects the push carried that it may read (the workspace too, for a push carrying workspace.xs and a credential with workspace:settings read), each printed with its policy key and title, rule name, message and Fix: hint under Blocking or Advisory, then a count of the findings on objects the push did not list (On objects this push did not list: N new findings (B blocking), counted, not named.; N findings instead of N new findings when elsewhere.basis is all, no baseline being known, or missing, from an older platform) and the platform's note; it names no run (run_id 0), so the CLI prints no xano policy runs hint. blocking is what a policy reader's push of the same change says, so exit 2 follows it whoever pushes, even with nothing of the credential's own listed. For CI, key on policy_check.blocking in -o json rather than on status: advisory findings arrive as status fail with blocking false. A policy finding never rolls back imported code on a branch that is not live. A push to the live branch is gated before it commits: a 403 policy_gate refusal exits 2, prints the platform's sentence (it names the policies the blocking findings come from, to every caller) and says nothing was imported, lists the blocking findings for a credential with workspace:policy read (anyone else gets the counts and the keys), and under -o json prints {imported: false, refused: <payload>}; --policy-override "<reason>" sends an audited override (workspace:policy update), and --no-transaction to live is refused (exit 1). A create past the plan's per-branch cap is refused with policy_plan_limit, naming the plan. Releases carry policies: release create, push and import print the release's stored policy check; tenant deploy_release --check prints the deploy gate's verdict and --override-reason overrides it; tenant_deploy_request set_status and bypass take --override-policy; a refused deploy exits 2. release deploy --set_live and branch set_live exit 2 when the set-live gate refuses (a refused release deploy keeps the new branch and names it), and function create and function edit exit 2 when the live-branch publish gate refuses the save (nothing is saved); each takes --policy-override "<reason>" (workspace:policy update; only with the user's own reason), a blank one is refused before any request, and any other failure exits 1. A workspace push (its --dry-run too), branch set_live, release deploy --set_live or policy delete (of an active blocking policy) that weakens a blocking policy without workspace:policy update is refused with policy_weakening_permission_required and exits 1, a permission refusal rather than a blocking finding: the CLI prints the platform's sentence and how to go on (leave the policy files out with -e "policies/*"; a deployed release's branch stays and is named), and --policy-override does not lift it. policy parse and policy publish print rule warnings on stderr.
27
+ policy evaluate and workspace push print the platform's policy_check verdict (see the Metadata API policy topic for the statuses). Their exit code follows the import and the blocking policies only: 1 when the import or the request fails, 2 whenever policy_check.blocking is true (an active blocking policy has findings; an inactive policy never blocks), and 0 otherwise. A pass, a fail and not_applicable (no active policy on the branch) print a headline with the platform's message; disabled, unavailable, error, any other status (an older instance's forbidden) or no feedback at all print one warning line on stderr with the platform's status and message, and leave the exit code alone. A workspace push by a credential without workspace:policy read gets a policy_check with access: "coverage" and scope: "pushed_objects": only its own findings on the objects the push carried that it may read (the workspace too, for a push carrying workspace.xs and a credential with workspace:settings read), each printed with its policy key and title, rule name, message and Fix: hint under Blocking or Advisory, then a count of the findings on objects the push did not list (On objects this push did not list: N new findings (B blocking), counted, not named.; N findings instead of N new findings when elsewhere.basis is all, no baseline being known, or missing, from an older platform) and the platform's note; it names no run (run_id 0), so the CLI prints no xano policy runs hint. blocking is what a policy reader's push of the same change says, so exit 2 follows it whoever pushes, even with nothing of the credential's own listed. For CI, key on policy_check.blocking in -o json rather than on status: advisory findings arrive as status fail with blocking false. A policy finding never rolls back imported code on a branch that is not live. A push to the live branch is gated before it commits: a 403 policy_gate refusal exits 2, prints the platform's sentence (it names the policies the blocking findings come from, to every caller) and says nothing was imported, lists the blocking findings for a credential with workspace:policy read (anyone else gets the counts and the keys), and under -o json prints {imported: false, refused: <payload>}; --policy-override "<reason>" sends an audited override (workspace:policy update), and --no-transaction to live is refused (exit 1). A create past the plan's per-branch cap is refused with policy_plan_limit, naming the plan. Releases carry policies: release create, push and import print the release's stored policy check; tenant deploy_release --check prints the deploy gate's verdict and --override-reason overrides it; tenant_deploy_request set_status and bypass take --override-policy; a refused deploy exits 2. release deploy --set_live and branch set_live exit 2 when the set-live gate refuses (a refused release deploy keeps the new branch and names it), and function create and function edit exit 2 when the live-branch publish gate refuses the save (nothing is saved); each takes --policy-override "<reason>" (workspace:policy update; only with the user's own reason), a blank one is refused before any request, and any other failure exits 1. Each policy change needs only its own workspace:policy level: update to edit a policy, delete to delete one (an active blocking policy included); branch set_live and release deploy --set_live need no policy permission. policy parse and policy publish print rule warnings on stderr.
28
28
 
29
29
  A rule with zero objects checked and no findings has status no_objects and message no objects checked. Older stored runs keep pass with checked: 0; readers accept both. The run and policy_check stay pass when nothing failed, and policy_check.message names the unchecked rules. Merge, publish and deploy gates read findings and are unaffected. The CLI summary renders both as no objects checked, never as an error; policy status keeps its no_objects_checked row status.
30
30
 
@@ -35,11 +35,11 @@ Publishing an identical definition writes nothing and prints No changes; JSON ou
35
35
  workspace pull writes policies to policies/<KEY>.xs when the credential can read them (without workspace:policy read the pull succeeds and omits them) and prints one hint after a pull that included them: Run \`xano skills pull\` to install the policies skill for your coding agent (see the skills topic). workspace push includes policies in the normal multidoc import and reports policy_check afterward; the workspace topic covers its -m/--message. sandbox push and ephemeral push (and their --dry-run) and release push carry policy files while the instance's Policies feature is on: a sandbox or ephemeral push lands them without evaluating them (no policy_check), and release push sends policies/*.xs with the rest and prints the release's stored policy check. A release built by release push carries those files only for a caller holding workspace:policy create and update; for anyone else it carries the workspace's live-branch policies instead, and the push prints the platform's policies_skipped message naming the files when they differ from the live ones. release import of an archive that carries policies needs the same workspace:policy create and update: without them the platform refuses it, nothing is stored, and the CLI prints the platform's message and the remedy for the role or the token. A push to a remote tenant, a push to a tenant created before policies (it has no policy table until its next platform update), or any push while the feature is off leaves them out, and the push prints the platform's policies_skipped message once, as a warning naming the files and why. While the instance's Policies feature is off, workspace pull carries no policies (and prints no skills hint) and workspace push leaves its policy files out, printing the platform's one line instead of a policy count. Existing workspace push deletion/sync behavior remains governed by its normal flags.`,
36
36
  related_topics: ["workspace", "profile", "branch", "skills"],
37
37
  commands: [
38
- { name: "policy catalogue", description: "List built-in checks, their schemas and analysis limitations from the instance, then the templates a policy can start from, grouped under the catalogue's category labels in its order. The full catalogue is long; --check narrows it to one check id in either output mode, and an unknown id names the closest matches. -o json carries the templates with their rules and settings.", usage: "xano policy catalogue [options]", flags: [...flags, { name: "check", type: "string", description: "Show only this check id" }], examples: ["xano policy catalogue -o json", "xano policy catalogue --check object.auth_required"] },
38
+ { name: "policy catalogue", description: "List built-in checks, their schemas and analysis limitations from the instance, each followed by its uses (a goal in a customer's words, the params that achieve it as one line of JSON, scope params included, and a note when it has one), then the templates a policy can start from, grouped under the catalogue's category labels in its order. The recipes follow: goals that span several templates, each with what to set up first, its templates in the order to create them, the rules no template covers (created together in a policy of your own) and what no rule in it can see. The catalogue ends with what no check can see, each topic with why. The full catalogue is long; --check narrows it to one check id and --recipe to one recipe id (the summary adds the topics that recipe cannot see), in either output mode, and an unknown id names the closest matches; the two flags cannot be combined. -o json without them is the whole catalogue as served.", usage: "xano policy catalogue [options]", flags: [...flags, { name: "check", type: "string", description: "Show only this check id; not with --recipe" }, { name: "recipe", type: "string", description: "Show only this recipe id and what it cannot see; not with --check" }], examples: ["xano policy catalogue -o json", "xano policy catalogue --check object.auth_required", "xano policy catalogue --recipe protect_card_data"] },
39
39
  { name: "policy list", description: "List policies on the selected branch, each with its active state, id and current version.", usage: "xano policy list [options]", flags, examples: ["xano policy list -b dev -o json"] },
40
40
  {
41
41
  name: "policy create",
42
- description: "Create an independent Active, Advisory policy from a platform template (the templates policy catalogue lists). Copies the template's sparse settings; every needs path must be filled with --param. Parsed natively before saving. A taken template key gets a free numeric suffix (case-insensitive); a taken explicit --key is refused. Never updates an existing policy and stores no link to the template. Rule warnings go to stderr; -o json prints the saved policy.",
42
+ description: "Create an independent Active, Advisory policy from a platform template (the templates policy catalogue lists). Copies the template's sparse settings; every needs path must be filled with --param. Parsed natively before saving. A taken template key gets a free numeric suffix (case-insensitive); a taken explicit --key is refused. Never updates an existing policy and stores no link to the template. A recipe has no create action: a recipe id given to --template is refused with the recipe's templates to create in order with --template, one policy each, a pointer to a policy of your own (xano policy publish) for the rules no template covers, and xano policy catalogue --recipe <id> for what to set up first. Rule warnings go to stderr; -o json prints the saved policy.",
43
43
  usage: "xano policy create --template <id> [--key KEY] [--param N.path=JSON ...] [options]",
44
44
  flags: [...flags, messageFlag, { name: "template", type: "string", required: true, description: "Template id from the catalogue's templates" }, { name: "key", type: "string", description: "Policy key; defaults to the template's suggested key" }, { name: "param", type: "string", description: "Repeatable N.path=JSON override; rule numbers start at 1, and the N. prefix is optional for a single-rule template" }],
45
45
  examples: ["xano policy create --template endpoints_need_login -b dev", "xano policy create --template no_pii_in_responses --key DATA-020 --param 'fields=[\"email\",\"ssn\"]'"],
@@ -79,7 +79,7 @@ workspace pull writes policies to policies/<KEY>.xs when the credential can read
79
79
  ],
80
80
  examples: ["xano policy runs", "xano policy runs --limit 5", "xano policy runs 1674 --run-detail -o json", "xano policy runs 1674 --offset 100 --limit 100", "xano policy runs 1674 --all -o json", "xano policy runs 1674 --blocking --policy AUTH-001 --severity critical", "xano policy runs --release v1.2", "xano policy runs --release-id 12 --recheck"],
81
81
  },
82
- { name: "policy coverage", description: "Show one object as Studio's object panel does, from the branch's latest run: the chip (Policies 1 blocking · 1 advisory, Policies ✓ 6 pass, Policies · 3 apply · not checked yet, Policies · Last check failed, Policies · None apply), the object's findings, Blocking then Advisory, each with its policy key and title, rule name, message and Fix: hint, then the policies that apply, each Blocking or Advisory, failing, passing or not checked yet, and why it applies, and the platform's note. Needs only the object kind's own read permission, not workspace:policy, so every credential gets the same trimmed answer (no statements, rule settings, run ids or other objects' findings). The object is written type:id, as findings name it; the workspace object's id is the workspace's own id (workspace:17). -o json is the platform's answer. Exits 0 when it answers, and 1 on a refusal or a malformed type:id. Drafts are checked in Studio (on Save or with Check draft); the CLI reads stored definitions only.", usage: "xano policy coverage <type>:<id> [options]", args: [{ name: "object", required: true, description: "The object, written type:id (query:42, function:12, table:7); for workspace, the workspace's own id (workspace:17)" }], flags, examples: ["xano policy coverage query:42", "xano policy coverage function:12 -b dev -o json"] },
82
+ { name: "policy coverage", description: "Show one object as Studio's object panel does, from the branch's latest run: the chip (Policies 1 blocking · 1 advisory, Policies ✓ 6 pass, Policies · 3 apply · not checked yet, Policies · Last check failed when a policy that applies here could not be checked, Policies · None apply), the object's findings, Blocking then Advisory, each with its policy key and title, rule name, message and Fix: hint, then the policies that apply, counted as the panel counts those with no finding here (6 passing · 1 couldn't check · 1 not checked yet), each Blocking or Advisory, failing, passing, couldn't check or not checked yet, and why it applies, and the platform's note. A policy the run passed still reads passing when the run errored on another policy. Needs only the object kind's own read permission, not workspace:policy, so every credential gets the same trimmed answer (no statements, rule settings, run ids or other objects' findings). The object is written type:id, as findings name it; the workspace object's id is the workspace's own id (workspace:17). -o json is the platform's answer. Exits 0 when it answers, and 1 on a refusal or a malformed type:id. Drafts are checked in Studio (on Save or with Check draft); the CLI reads stored definitions only.", usage: "xano policy coverage <type>:<id> [options]", args: [{ name: "object", required: true, description: "The object, written type:id (query:42, function:12, table:7); for workspace, the workspace's own id (workspace:17)" }], flags, examples: ["xano policy coverage query:42", "xano policy coverage function:12 -b dev -o json"] },
83
83
  { name: "policy delete", description: "Delete a policy from the selected branch, by policy key or by id; its Version History is kept. An unresolved name is refused naming the policies the branch does have. Prompts before deleting; --force skips the prompt. The delete sends the updated_at it listed, so a policy changed after that (for example while the prompt waited) is refused with policy_stale and nothing is deleted: run the command again. This is the only way to remove a policy from the CLI: workspace push is additive, so deleting policies/KEY.xs and pushing leaves the policy in place. Needs the workspace:policy permission at delete level.", usage: "xano policy delete <key-or-id> [options]", flags: [...flags, { name: "force", short: "f", type: "boolean", default: "false", description: "Skip the confirmation prompt; only with the user's explicit confirmation" }], examples: ["xano policy delete TMP-DX-001", "xano policy delete 922 --force -o json"] },
84
84
  {
85
85
  name: "policy status",
@@ -42,7 +42,7 @@ A rule with zero objects checked and no findings has status no_objects and messa
42
42
 
43
43
  A policy_check block reports an evaluation. status is one of: pass ("No policy findings."), fail ("Policies reported findings."), error ("A policy check could not run; its result is marked error."), not_applicable ("No active policies on this branch; nothing was evaluated."), disabled ("Policies are not enabled on this instance; nothing was evaluated.") or unavailable ("Policy evaluation is unavailable; the import itself completed."), and message carries that sentence. blocking is true when an active blocking policy has findings, and status is then fail even if a check errored. not_applicable and disabled load, store and audit nothing. Evaluate answers pass, fail, error or not_applicable; the feature gate and the permission refuse it with a 403 instead. A not_applicable evaluate is no run: id 0, stored: false, the run's own status not_applicable too, and empty policies, results and findings. The workspace multidoc import answers all six. Its findings and blocking_findings list the first 100 each, in the platform's order, beside counts {findings, blocking, errors}, total (every finding) and truncated (whether either list was cut); the stored run (run_id) has them all, and its results are whole; a draft import answers no policy_check. A caller without workspace:policy read is evaluated the same way (the run is stored) but told only their own findings on the objects the import carried that they may read (an import carrying the workspace document carries the workspace object too, listed to a caller with workspace:settings read): {status, message, blocking, run_id: 0, access: "coverage", scope: "pushed_objects", findings, blocking_findings, elsewhere {total, blocking, basis}, results: [], counts, total, truncated, note}, each finding trimmed as an object's coverage trims it (below). counts are about the listed 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 import introduced (on the live branch, not in the push gate's own evaluation of the branch just before the import; on any other branch, not in the branch's newest run just before the import 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 the caller's follows the coverage route's permissions, a trigger by its obj_type. blocking is what a reader's import of the same change says (the branch holds a blocking finding after it), so it can be true with nothing 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 ("This credential cannot read this workspace's policies (workspace:policy read); nothing was evaluated.") and evaluates nothing. A tier1 tenant, ephemeral or sandbox push and its dry run, and a release built from a multidoc (release push), carry policy files while the feature is on; a tenant or sandbox push carries them without evaluating them and answers no policy_check, and a release built from a multidoc carries its files only for a caller holding workspace:policy create and update (for anyone else it carries the workspace's live-branch policies instead, and names the files in policies_skipped when they differ from the live ones). A remote tenant push, a push to a tenant without a policy table (one created before policies, until its next platform update), or any push while the feature is off leaves them out and names them once in policies_skipped {message, keys}, whose message says why ("N policy files were left out (KEY, KEY): <reason>."). With the policies feature off a workspace push and its dry run leave them out too (policy_check disabled), exports omit policies, and an archive import leaves its policies out and keeps the workspace's own, except that a replace deletes the policies of the branches it removes.
44
44
 
45
- Gates: a merge, a set-live, an archive import with mode=merge, and a save or a non-draft push to the workspace's live branch are refused with HTTP 403 and payload.code policy_gate when they introduce a blocking finding or leave one on an object they change; existing findings elsewhere never block. The message names the policies the blocking findings come from to every caller, e.g. Push refused: 2 blocking policy findings from AUTH-010 and PII-001 (1 introduced by this change, 1 on objects it changes). The payload is {gate, status, total, introduced, changed, existing, run_id, can_override, sources, findings (first 100, policy readers only), truncated (policy readers only)}. sources is the message's list ("from AUTH-010 and PII-001"), to every caller whenever the blocking findings name a policy; every gate answer carries it (a merge's and its dry run's policy_gate, a set-live's, the tenant deploy gate's and a refusal's payload). A tenant release deploy is refused the same way when the release's own policy check has any blocking finding, existing debt included: it judges the release alone, never against the tenant's current release, so a release gets the same verdict on every tenant (ephemeral and sandbox tenants get it with gated false and are never refused). 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 tenant deploy still refuses a release with blocking findings, and a release without one whose check has a rule that could not run is unavailable and not gated. Its payload is {gate, status, total, run_id, can_override, gated, release {id, name, run_id, status, counts, carried}, message, sources, findings, truncated}, findings and truncated for policy readers only, its message naming the blocking policies to everyone. A caller with workspace:policy update may proceed by resending with override_reason (the create and save routes of the gated objects, the multidoc, upload, import and branch live routes, a release deploy with set_live and import-schema with setlive; override_policy with the reason on tenant deploys), which is audited. A release deploy with set_live and an import-schema with setlive land the new branch first and then run the set-live gate, so a refusal keeps that branch and names it in payload.branch {id, label}. Gates are decided by the policies the branch will have after the change (a merge's carried policies, a push's policy files, the set-live candidate's own policies), so a merge, a push to the live branch or a set-live that weakens a policy active and blocking on the branch (demotes, deactivates or deletes it, or loosens a rule) needs workspace:policy update: otherwise it is refused before anything is written with 403 policy_weakening_permission_required and {gate, permission, level, policies}, which override_reason does not lift, and the push dry run is refused the same way. A set-live of a branch that landed no policy (an import-schema with setlive always leaves the archive's policies out; a release may carry none) is judged by the live branch's policies, with no weakening check. A set-live check that cannot read the policies fails closed (only update proceeds; the refusal carries unavailable: true). Deleting an active blocking policy needs workspace:policy update as well as delete (the same 403, gate delete), and so does an archive import with mode=replace or delete=true that would remove one from the branch it writes (gate archive_import). The publish gate covers the draftable kinds (function, query, task, middleware, addon, tool, workflow test, trigger and realtime message), agents, MCP servers and realtime channels: tables, API groups, environment variables, workspace and branch settings, realtime servers, and MCP prompts and resources are saved without it, even on the live branch, and the next run reports what they break while a set-live or tenant deploy that carries it is gated. Adding a prompt or resource to an MCP server, or removing one, changes the server, so that save is gated. A push to the live branch needs its transaction (400 policy_gate_transaction_required). Pushes to other branches are not gated: they answer policy_check after the import. A create past the plan's per-branch policy cap (lower plans cap the policies on each branch; Pro and above are unlimited) is refused with 403 policy_plan_limit; a save whose key another live policy on the branch holds (compared case-insensitively) with 400 policy_key_taken (with key, existing_key and existing_id, null when a concurrent create took the key first); a create whose rules exactly match a live policy on the branch with 400 policy_duplicate (with existing_key, existing_id and policies); a draft import carrying a changed policy with 400 policy_draft_import (Policies are saved directly, not drafted.).
45
+ Gates: a merge, a set-live, an archive import with mode=merge, and a save or a non-draft push to the workspace's live branch are refused with HTTP 403 and payload.code policy_gate when they introduce a blocking finding or leave one on an object they change; existing findings elsewhere never block. The message names the policies the blocking findings come from to every caller, e.g. Push refused: 2 blocking policy findings from AUTH-010 and PII-001 (1 introduced by this change, 1 on objects it changes). The payload is {gate, status, total, introduced, changed, existing, run_id, can_override, sources, findings (first 100, policy readers only), truncated (policy readers only)}. sources is the message's list ("from AUTH-010 and PII-001"), to every caller whenever the blocking findings name a policy; every gate answer carries it (a merge's and its dry run's policy_gate, a set-live's, the tenant deploy gate's and a refusal's payload). A tenant release deploy is refused the same way when the release's own policy check has any blocking finding, existing debt included: it judges the release alone, never against the tenant's current release, so a release gets the same verdict on every tenant (ephemeral and sandbox tenants get it with gated false and are never refused). 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 tenant deploy still refuses a release with blocking findings, and a release without one whose check has a rule that could not run is unavailable and not gated. Its payload is {gate, status, total, run_id, can_override, gated, release {id, name, run_id, status, counts, carried}, message, sources, findings, truncated}, findings and truncated for policy readers only, its message naming the blocking policies to everyone. A caller with workspace:policy update may proceed by resending with override_reason (the create and save routes of the gated objects, the multidoc, upload, import and branch live routes, a release deploy with set_live and import-schema with setlive; override_policy with the reason on tenant deploys), which is audited. A release deploy with set_live and an import-schema with setlive land the new branch first and then run the set-live gate, so a refusal keeps that branch and names it in payload.branch {id, label}. Gates are decided by the policies the branch will have after the change (a merge's carried policies, a push's policy files, the set-live candidate's own policies). Each policy change needs only its own workspace:policy level, an active blocking policy included: update to edit one, delete to delete one; a set-live needs no policy permission. The audit log labels a change to an active blocking policy blocking_policy_changed and its deletion blocking_policy_deleted. A set-live of a branch that landed no policy (an import-schema with setlive always leaves the archive's policies out; a release may carry none) is judged by the live branch's policies. An archive import with mode=replace or delete=true that would remove a policy from the branch it writes needs workspace:policy delete. The publish gate covers the draftable kinds (function, query, task, middleware, addon, tool, workflow test, trigger and realtime message), agents, MCP servers and realtime channels: tables, API groups, environment variables, workspace and branch settings, realtime servers, and MCP prompts and resources are saved without it, even on the live branch, and the next run reports what they break while a set-live or tenant deploy that carries it is gated. Adding a prompt or resource to an MCP server, or removing one, changes the server, so that save is gated. A push to the live branch needs its transaction (400 policy_gate_transaction_required). Pushes to other branches are not gated: they answer policy_check after the import. A create past the plan's per-branch policy cap (lower plans cap the policies on each branch; Pro and above are unlimited) is refused with 403 policy_plan_limit; a save whose key another live policy on the branch holds (compared case-insensitively) with 400 policy_key_taken (with key, existing_key and existing_id, null when a concurrent create took the key first); a create whose rules exactly match a live policy on the branch with 400 policy_duplicate (with existing_key, existing_id and policies); a draft import carrying a changed policy with 400 policy_draft_import (Policies are saved directly, not drafted.).
46
46
 
47
47
  Releases carry their branch's policies and store a policy check when cut. An uploaded release archive (release/import) that says it carries policies needs workspace:policy create and update, or is refused with 403 policy_permission_required and nothing is stored. Routes: GET /workspace/{workspace_id}/release/{release_id}/policy_run (POST re-checks it), .../policy_run/findings, and GET /workspace/{workspace_id}/release/policy_check?release_id[]= for several (at most 200 ids). GET /workspace/{workspace_id}/tenant/{tenant_name}/policy_gate?release_name= previews a tenant deploy's gate, and GET /workspace/{workspace_id}/tenant/{tenant_name}/policy lists a tenant's policies; both need tenant_center read besides workspace:policy read.
48
48
 
@@ -52,7 +52,7 @@ An evaluation stores a run and its findings; it does not modify the policy. Eval
52
52
  ai_hints: `Use the authenticated Xano MCP policy tools when available. Their workspace and instance come from the authenticated request, not tool arguments. The standalone developer MCP offers documentation and local language-server validation; it does not carry a workspace credential. Validate policy source with the native policy/parse endpoint before saving; the developer MCP's local validation is a preview against its bundled catalogue. Key refusals on payload.code, never on the message wording. Read latest_run.stale to know whether a run still describes a policy. Evaluate with answer: "summary" and page a run's findings with GET run/{run_id}/findings rather than reading a large run whole. Re-sending an identical definition is safe: the platform answers unchanged: true and writes nothing, so do not add a cosmetic edit to force a new version.`,
53
53
  related_topics: ["workspace", "branch", "authentication"],
54
54
  endpoints: [
55
- { method: "GET", path: prefix + "/check", description: "The check catalogue: items (each check's id, label, description, keywords, supported object kinds and full parameter schema), templates (the starting points a new policy can be created from, each with its category id, framework tag ids, title, summary, key, severity and the rules it seeds, the needs the author fills (every one, or at least one when the rule's needs_any is true) and a limits note on what its rules cannot see; see the policies topic) template_categories (the category ids with their labels, in the order to offer them), template_frameworks (the framework tag ids with their labels, in order: a tag marks a related topic and never means a policy or workspace is compliant) and template_frameworks_note (the sentence to show wherever the tags appear).", parameters: [workspace] },
55
+ { method: "GET", path: prefix + "/check", description: "The check catalogue: items (each check's id, label, description, keywords, uses (goals in a customer's words, each {goal, params, note?} with the params that achieve it), supported object kinds and full parameter schema), templates (the starting points a new policy can be created from, each with its category id, framework tag ids, title, summary, key, severity and the rules it seeds, the needs the author fills (every one, or at least one when the rule's needs_any is true), examples (a map from a needs path to an example value that fits the template, {} when it gives none; a hint, never a value to save) and a limits note on what its rules cannot see; see the policies topic) template_categories (the category ids with their labels, in the order to offer them), template_frameworks (the framework tag ids with their labels, in order: a tag marks a related topic and never means a policy or workspace is compliant) template_frameworks_note (the sentence to show wherever the tags appear), recipes (goals that take several templates, each {id, title, summary, keywords, frameworks, prerequisites, templates, rules, limits}: what to set up first, the template ids to create in order, one policy each, the {title, check, params, needs} rules no template covers, created together in one policy, and the not_checkable ids no rule there can see; nothing creates a recipe), not_checkable ({id, topic, why, keywords}: what no check can see) and statement_groups (the statement names a rule is written with, by what they do, each {id, label, note, statements: [{name, params}]} with the params checks read on it).", parameters: [workspace] },
56
56
  { method: "GET", path: prefix, description: "List policies on a branch, 1000 a page (nextPage says whether there are more). Each item is served as GET serves one policy, with latest_run.", parameters: [workspace, branch, { name: "page", type: "integer", in: "query", default: 1, description: "Page number" }] },
57
57
  { method: "GET", path: prefix + "/{policy_id}", description: "Read one policy on the selected branch, with latest_run. source is canonical, so it can be sent back to PUT unchanged (a no-op) or edited. A policy that is not live on the branch answers 404 Policy not found on this branch of the workspace., as PUT and DELETE do.", parameters: [workspace, policyId, branch] },
58
58
  {
@@ -63,7 +63,7 @@ An evaluation stores a run and its findings; it does not modify the policy. Eval
63
63
  {
64
64
  method: "GET", path: prefix + "/object/coverage", description: "One object's coverage for anyone who may read the object: the active policies that apply to it and why, and its findings in the branch's newest run, trimmed. Needs the object kind's own read permission, never workspace:policy (403 policy_object_permission_required {permission, level, type}: Reading this function needs the workspace:function read permission.), and answers every caller, policy readers included, the same trimmed shape (a reader wanting more reads GET /policy/object). An unknown type is a 400 naming the known types; an object the branch does not have is a 404 No <type> with id <id> on this branch. The answer is the same for every caller and is cached for 60 s by object, the branch's latest run and the workspace checksum with the policies' fingerprint, so a write, a policy change or a new run misses the cache. Request history shows its rows Hidden to viewers without workspace:policy read, as for every policy route.",
65
65
  parameters: [workspace, branch, { name: "type", type: "string", required: true, in: "query", description: "Object kind as findings name it: query, api_group, function, table, task, trigger, middleware, addon, workflow_test, tool, agent, mcp_server, channel, message or workspace" }, { name: "id", type: "integer", required: true, in: "query", description: "Object ID on the selected branch; for workspace, the workspace's own id (type=workspace&id=17 on workspace 17)" }],
66
- response: { type: "object", description: "{access: \"coverage\", object {type, id, name, app_id?}, summary {state, applies, blocking, advisory, passing, not_checked}, policies: [{key, title, enforcement, blocking, status, reasons}], findings, run: {started_at, status} | null, note}. state is the panel chip: none_apply, findings (Policies <blocking> blocking · <advisory> advisory), not_checked (<applies> apply · not checked yet), check_failed (Last check failed) or pass (Policies ✓ <passing> pass). policies are computed now (a policy saved after the run is not_checked); status is failing, passing (the newest run evaluated its current version without an error and found nothing here) or not_checked; reasons say in plain words why each applies. findings are the newest run's on this object, each {id, policy_key, policy_title, rule_title, message, blocking, deleted (the run evaluated a policy the branch no longer holds), object, check: {label, description (first sentence), fix_hint} | null}. Never sent: statements, rationale, narrative, tags, severity, rule ids, check ids, params, settings, warnings, allow fingerprints, policy or run ids, other objects' findings. note is the fixed sentence Full policy details need the workspace:policy read permission." },
66
+ response: { type: "object", description: "{access: \"coverage\", object {type, id, name, app_id?}, summary {state, applies, blocking, advisory, passing, not_checked, could_not_check}, policies: [{key, title, enforcement, blocking, status, reasons}], findings, run: {started_at, status} | null, note}. state is the panel chip: none_apply, findings (Policies <blocking> blocking · <advisory> advisory), not_checked (<applies> apply · not checked yet), check_failed (Last check failed: only when a policy that applies here could not be checked) or pass (Policies ✓ <passing> pass). policies are computed now; status is failing (a finding of it here), not_checked (no run, or the newest run did not evaluate it as it now stands, such as a policy saved after the run), could_not_check (the newest run could not check it: a rule of it could not run, or the run stopped on an error before it) or passing (the newest run checked its current version and found nothing here, even when the run errored on another policy); passing, not_checked and could_not_check count those statuses; reasons say in plain words why each applies. findings are the newest run's on this object, each {id, policy_key, policy_title, rule_title, message, blocking, deleted (the run evaluated a policy the branch no longer holds), object, check: {label, description (first sentence), fix_hint} | null}. Never sent: statements, rationale, narrative, tags, severity, rule ids, check ids, params, settings, warnings, allow fingerprints, policy or run ids, other objects' findings. note is the fixed sentence Full policy details need the workspace:policy read permission." },
67
67
  },
68
68
  {
69
69
  method: "POST", path: prefix + "/parse", description: "Parse and format one policy with the native platform parser, without saving it. Send exactly one of source or data.", parameters: [workspace],
@@ -112,12 +112,13 @@ const SYNTAX_SUGGESTIONS = [
112
112
  /**
113
113
  * Enhance error message with helpful suggestions
114
114
  */
115
- function enhanceErrorMessage(message, code, lineNumber) {
115
+ function enhanceErrorMessage(message, code, lineNumber, scheme) {
116
116
  let enhanced = message;
117
117
  const lines = code.split("\n");
118
118
  const errorLine = lines[lineNumber] || "";
119
- // Check for type aliases
120
- for (const [alias, correct] of Object.entries(TYPE_ALIASES)) {
119
+ // Check for type aliases, never in a policy: it declares no types, and a value such as
120
+ // object.naming's name_kind: "object" is not one.
121
+ for (const [alias, correct] of scheme === "policy" ? [] : Object.entries(TYPE_ALIASES)) {
121
122
  const regex = new RegExp(`\\b${alias}\\b`, "i");
122
123
  if (regex.test(errorLine)) {
123
124
  enhanced += `\n\n💡 Suggestion: Use "${correct}" instead of "${alias}"`;
@@ -213,7 +214,7 @@ function validateCode(code, filePath) {
213
214
  const endLines = text.substring(0, endOffset + 1).split("\n");
214
215
  const endLine = endLines.length - 1;
215
216
  const endCharacter = endLines[endLines.length - 1].length;
216
- const enhancedMessage = enhanceErrorMessage(item.message, text, line);
217
+ const enhancedMessage = enhanceErrorMessage(item.message, text, line, scheme);
217
218
  return {
218
219
  severity,
219
220
  range: {
@@ -270,6 +270,7 @@ Use `xano_xanoscript_docs({ tier: "survival" })` or `xano_xanoscript_docs({ tier
270
270
  | `branch` | Branch-level settings: middleware, history retention, visual styling | Middleware Config, History |
271
271
  | `middleware` | Request/response interceptors for functions, queries, tasks, and tools | Pre/Post Hooks |
272
272
  | `policies` | Workspace policy documents: syntax, check catalogue, templates, authoring rules | Quick Reference, Permissions |
273
+ | `policy-templates` | The platform's policy templates: key, title, checks, framework tags and what each leaves to fill, with an example; recipes for goals that take several; what no check can see | Using a template, Recipes, What no check can see |
273
274
 
274
275
  ### Development
275
276
 
@@ -310,6 +310,12 @@
310
310
  "exclusive": true,
311
311
  "priority": 3,
312
312
  "aliases": ["policy", "governance"]
313
+ },
314
+ "policy-templates": {
315
+ "file": "policy-templates.md",
316
+ "description": "The platform's policy templates by category: key, title, checks, framework tags and the settings each leaves to fill, with an example; recipes for goals that take several templates; what no check can see",
317
+ "applyTo": [],
318
+ "aliases": ["policy-template"]
313
319
  }
314
320
  },
315
321
 
@@ -57,11 +57,11 @@ Inside Xano's own agent, the instance serves a platform skill named `xano-polici
57
57
 
58
58
  ## Starting from a template
59
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; 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, 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.
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
61
 
62
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
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). 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.
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
65
 
66
66
  ## Versioning
67
67
 
@@ -80,8 +80,7 @@ Policies version exactly like every other Xano object: one Version History entry
80
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
81
 
82
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
- - **Weakening a blocking policy:** a merge, push or set-live that weakens a policy that is active and blocking on the branch before the change (demotes, deactivates or deletes it, removes a rule, narrows a scope, adds an exemption or loosens a parameter) needs `workspace:policy` **update**, from a session that may write, as an override does. For a set-live, a live blocking policy the candidate branch lacks counts as deleted, unless the candidate landed no policy at all, which is not checked for weakening. If the set-live check cannot read the policies it fails closed: only a caller with update proceeds, and anyone else is refused with the same code, `unavailable: true`, no policies named and `Set live refused: whether it weakens a blocking policy could not be checked, and weakening one needs the workspace:policy update permission. The live branch was not changed.` Otherwise the change is refused before anything is written: HTTP 403 with `payload.code` `policy_weakening_permission_required`, `gate`, `permission` (`workspace:policy`), `level` (`update`) and `policies` (the keys), and the message `<Gate> refused: it weakens blocking policy KEY, which needs the workspace:policy update permission. <outcome>`, for example `Push refused: it weakens blocking policy GATE-001, which needs the workspace:policy update permission. Nothing was imported.` (a merge ends `Leave the policies out of the merge to merge the rest.`, a set-live `The live branch was not changed.`). A caller who holds update in a session that may not write reads `… permission from a session that may write.` A release deploy with set live adds what landed first (`The release was deployed as branch "<label>". `) and names it in `payload.branch`. `override_reason` does not lift it. The merge dry run and its policy plan report it without refusing, as `weakening {policies, permission, level, allowed}`; the push dry run refuses the same way. A set-live that goes through with such a weakening writes a `policy_run:set_live_weakened` audit row naming the policies and how each was weakened.
84
- - **Deleting a blocking policy** needs `workspace:policy` **update** as well as delete, on every branch: `Delete refused: it weakens blocking policy GATE-001, which needs the workspace:policy update permission.` (`payload.gate` `delete`). Deleting an advisory or inactive policy needs only delete. An archive import that deletes existing policies (`mode=replace`, or `mode=merge` with `delete=true`) is refused the same way when it would remove an active blocking policy of the branch it writes that the archive does not bring back: `Archive import refused: it weakens blocking policy GATE-001, which needs the workspace:policy update permission. Nothing was imported.` Because a carried policy change counts, editing a policy is never part of a fix (see Fixing a finding).
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).
85
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.
86
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.
87
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.
@@ -106,7 +105,7 @@ Lower plans cap the policies on each branch, active or not; Pro and above are un
106
105
 
107
106
  Policies travel where the code travels while the instance's `policies` feature is on:
108
107
 
109
- - 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 and calls out weakening. 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.
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.
110
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.
111
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.
112
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.
@@ -117,7 +116,7 @@ While the feature is off nothing carries policies: exports, clones and Git sync
117
116
 
118
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.
119
118
 
120
- Every entry carries a human `label` beside its id; that label is what names a rule whose author gave it no `title`. 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.
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.
121
120
 
122
121
  <!-- BEGIN GENERATED: checks -->
123
122
  | Check | Label | Behavior | Parameters |
@@ -127,15 +126,23 @@ Every entry carries a human `label` beside its id; that label is what names a ru
127
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` |
128
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` |
129
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_ |
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, page-size limits, values in the URL path and unused inputs. 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 and unused_forbidden to every top-level 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, and an input read only by middleware is reported as unused. Called functions and the middleware resolution chain are read whatever the rule's scope. | 1 of (`type_by_name`, `filters_required`, `paging_max_required`, `path_params_forbidden`, `unused_forbidden`, `inputs_required`, `filter_min`), `input_names` |
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
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` |
132
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*` |
133
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`) |
134
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` |
135
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_ |
136
- | `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. | `kinds`, `hosts`, `providers`, `env_hosts` |
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`) |
137
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*` |
138
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` |
139
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` |
140
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` |
141
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` |
@@ -143,21 +150,105 @@ Every entry carries a human `label` beside its id; that label is what names a ru
143
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` |
144
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` |
145
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` |
146
- | `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, description, 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. | 1 of (`field_names`, `field_types`), `attribute`, `value`, `type`, `must_exist`, `forbidden` |
147
- | `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. | 1 of (`field_names`, `include_sensitive`), `field_types`, `tag*` |
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*` |
148
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` |
149
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` |
150
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_ |
151
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_ |
152
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` |
153
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
+
154
241
  Closed value sets worth knowing without a catalogue round-trip:
155
242
 
156
243
  - `literal.credential_shape.patterns`: `stripe`, `aws`, `github`, `pem`, `openai`, `anthropic`, `google_api`, `slack`, `sendgrid`, `twilio`, `jwt`, `url_credentials`, `literal_keys`
157
244
  - `literal.credential_shape.locations`: `definition`, `env`, `agent_settings`
245
+ - `object.description_required.require_on`: `object`, `input`, `table_field`
158
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`
159
249
  - `object.settings_forbidden.object_kind`: `table`, `query`, `function`, `workflow_test`, `api_group`, `task`, `trigger`, `middleware`, `addon`, `channel`, `message`, `tool`, `agent`, `mcp_server`, `workspace`
160
250
  - `object.statement_required.placement`: `any`, `unconditional`, `first`
251
+ - `object.tag_vocabulary.case_style`: `""`, `snake_case`, `kebab-case`, `lowercase`
161
252
  - `outbound.vendor_allowlist.kinds`: `http`, `cloud`, `email`, `agent.llm`, `db.external`, `lambda`
162
253
  - `statement.expression_rule.operators_forbidden`: `===`, `!==`, `==`, `!=`, `>=`, `<=`, `&&`, `||`, `~`, `+`, `-`, `*`, `/`, `%`, `<`, `>`
163
254
  - `workspace.object_required.object_kind`: `table`, `query`, `function`, `workflow_test`, `api_group`, `task`, `trigger`, `middleware`, `addon`, `channel`, `message`, `tool`, `agent`, `mcp_server`, `workspace`
@@ -172,6 +263,18 @@ Nested object parameters and their keys:
172
263
  - `stack.statement_order.before` — keys `statements`, `functions`, `must_reference`. Example: `{"statements":["precondition"],"must_reference":["$auth"]}`
173
264
  - `table.coverage_required.table_selector` — keys `has_field`, `has_fk_to`. Example: `{"has_field":"created_at"}`
174
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`)
175
278
  <!-- END GENERATED: checks -->
176
279
 
177
280
  ## Scoping a rule
@@ -191,7 +294,7 @@ Scope limits what is reported, not what is read.
191
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.
192
295
  <!-- END GENERATED: scope -->
193
296
 
194
- `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.
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.
195
298
 
196
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.
197
300
 
@@ -210,28 +313,51 @@ Example, in the canonical spelling the parser returns:
210
313
 
211
314
  ## Writing parameter values
212
315
 
213
- - **Types:** `string[]` is a list of strings; `bool` requires true or false. `number` accepts finite numeric literals, not numeric strings. Both `min_count` parameters are `integer` with minimum 1. Bounds are inclusive and use the checked parameter's native units; `unit` only labels findings.
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.
214
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.
215
- - **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). Verify the name against statement documentation, 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.
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.
216
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.
217
- - **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.
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`.
218
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.
219
- - **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 on save. Credential `patterns` selects built-in shapes.
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.
220
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`.
221
- - **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.
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.
222
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.
223
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
+
224
344
  ## Findings
225
345
 
226
- 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. A `literal.credential_shape` finding also carries `allow: {allowed_secrets: ["sha256:<64 hex>", ...]}`, the full fingerprints of the secrets it reports (its message names them short); no other check sets `allow`. 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.
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.
227
347
 
228
348
  <!-- BEGIN GENERATED: fix-hints -->
229
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.
230
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.
231
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.
232
- - `object.input_rules`: An input read only through whole $input is still used; do not delete it. Without input_names, filter rules reach every text input and the unused rule every input; set input_names to target inputs, one rule per group. Keep an input declared only for API docs by exempting the object or leaving unused_forbidden off.
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.
233
354
  - `object.middleware_required`: Attaching per object replaces inherited middleware; prefer the API group, channel or branch default, and ask.
234
- - `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.
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.
235
361
  - `statement.param_bound`: A runtime value cannot be verified statically: bound its source or ask; do not hardcode a literal.
236
362
  - `statement.param_forbidden`: A runtime value cannot be verified statically: bound its source or ask; do not hardcode a literal.
237
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.
@@ -249,9 +375,9 @@ Read the policy before editing anything: its `statement`, and the failed rule's
249
375
 
250
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.
251
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.
252
- - **Never, in a fix:** edit the policy; add a tag that a policy's `except_tags` or `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.
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.
253
379
 
254
- 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 weaken 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.
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.
255
381
 
256
382
  ### An object's coverage and draft checks
257
383
 
@@ -295,11 +421,11 @@ The `workspace:policy` permission level each operation needs:
295
421
  | Studio's draft check | none: the object kind's own update permission | `workspace:read` |
296
422
  | Create a policy | `create` | `workspace:write` |
297
423
  | Update a policy, restore a version | `update` | `workspace:write` |
298
- | Delete a policy | `delete`, and `update` as well for an active blocking policy | `workspace:write` |
424
+ | Delete a policy | `delete`, an active blocking policy included | `workspace:write` |
299
425
  | `workspace pull` / export with policies included | `read` (without it the export still succeeds and omits policies) | `workspace:read` |
300
- | `workspace push` / import of a policy file that differs from the stored policy | `create` or `update`, and `update` for a push to the live branch that weakens a blocking policy (see Gates) | `workspace:write` |
301
- | 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`, and `update` as well to remove an active blocking policy of the branch it writes | - |
302
- | Branch merge that adds, changes or deletes a policy | `create`, `update` or `delete` for what it changes, and `update` for a weakening of a blocking policy (see Gates) | - |
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 | - |
303
429
  | Override a blocking gate | `update` (with a reason) | `workspace:write` |
304
430
  | Release cut from a branch or tenant, tier1 tenant, ephemeral or sandbox push, release deploy | none: this is deployment, not authoring | - |
305
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 | - |
@@ -313,7 +439,7 @@ Evaluate needs only `read`, so a reviewer or a CI credential can run checks. Sto
313
439
 
314
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.
315
441
 
316
- 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 weakens 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.
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.
317
443
 
318
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.
319
445
 
@@ -0,0 +1,267 @@
1
+ # Policy templates
2
+
3
+ The platform's starting points for a new policy, and its recipes for goals that take several, from the check catalogue this documentation was generated from. The instance's own catalogue is authoritative and can differ by platform version: `GET /api:meta/workspace/{id}/policy/check` serves it as `templates`, `recipes` and `not_checkable`, `xano policy catalogue` prints it, and the Xano MCP's `xano_list_policy_checks` returns it with `detail: "full"`. The `policies` topic describes each template field.
4
+
5
+ ## Using a template
6
+
7
+ - **Prefer a template.** Before writing a new policy, look for a template that covers the request, and when one fits, start from it rather than inventing a key and rules: use its key (with a free `-2`, `-3`… suffix when the branch already has that key), its title, its summary as the `statement`, its severity and its rules, and keep `active = true` with `enforcement = "advisory"`. Then change only what the request asks for. When a recipe covers the goal, follow it (see Recipes): it names the templates to create, in order, and the rules to add.
8
+ - **Fill every need.** "Fill" names the parameter paths each rule leaves empty (one of them is enough where they are joined by "or"). The example shows a value that fits: the template's own, else the check's catalogue example. It is a hint, never a value to copy, so fill each need with the workspace's own names.
9
+ - **Checks** names the checks the template's rules use; read a check's parameters, and the goals each one serves, in the `policies` topic's check catalogue.
10
+ - **Frameworks** names the framework tags a template carries, a second way to find it. Framework tags point to templates on related topics. They don't make a workspace compliant, and Xano doesn't track changes to these frameworks.
11
+ - With the CLI, `xano policy create --template <id>` creates the policy from the instance's template.
12
+
13
+ ## Access control
14
+
15
+ | Template | Key | Severity | Title | Checks | Fill | Frameworks |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | `endpoints_need_login` | `AUTH-010` | critical | Endpoints require login | `object.auth_required` | _nothing_ | SOC 2, HIPAA |
18
+ | `own_records_only` | `AUTH-020` | critical | Users only reach their own records | `db.where_constraint_required`, `db.write_from_input_forbidden` | R1: `field` (e.g. `"user_id"`); R2: `fields` (e.g. `["user_id"]`) | SOC 2, HIPAA |
19
+ | `no_self_promotion` | `AUTH-030` | critical | Users can't make themselves admin | `db.write_from_input_forbidden` | _nothing_ | SOC 2, HIPAA |
20
+ | `public_endpoints_harmless` | `AUTH-003` | high | Public endpoints can't change data | `stack.statement_forbidden` | _nothing_ | |
21
+ | `admin_endpoints_check_role` | `AUTH-002` | critical | Admin endpoints check the caller's role | `object.statement_required` | `functions` (e.g. `["require_admin"]`) | SOC 2, HIPAA |
22
+ | `tokens_expire` | `SEC-014` | high | Login tokens expire within an hour | `statement.param_bound` | R2: `max` (e.g. `3600`) | SOC 2, HIPAA |
23
+ | `writes_check_first` | `BIZ-001` | high | Endpoints check the caller before writing | `stack.statement_order` | _nothing_ | |
24
+ | `protected_endpoints_run_middleware` | `AUTH-040` | high | Protected endpoints run your auth middleware | `object.middleware_required` | `middleware` (e.g. `["access_context"]`) | |
25
+ | `one_auth_table` | `AUTH-050` | medium | Users sign in through one auth table | `table.auth_table_rules` | _nothing_ | |
26
+
27
+ ## Data protection
28
+
29
+ | Template | Key | Severity | Title | Checks | Fill | Frameworks |
30
+ | --- | --- | --- | --- | --- | --- | --- |
31
+ | `no_pii_in_responses` | `DATA-010` | high | Endpoints don't return personal data | `db.output_fields_forbidden` | `fields` (e.g. `["ssn","user.password_hash"]`) | SOC 2, HIPAA, GDPR, PCI DSS |
32
+ | `sensitive_tables_need_login` | `CONF-010` | critical | Sensitive tables are only reached by logged-in endpoints | `object.tagged_table_access` | `table_tags` (e.g. `["phi"]`) | SOC 2, HIPAA, GDPR |
33
+ | `sensitive_fields_marked` | `CONF-011` | high | Sensitive fields are marked sensitive | `table.field_attribute_required` | `field_names` (e.g. `["ssn","dob"]`) | SOC 2, HIPAA, GDPR, PCI DSS |
34
+ | `confidential_tables_tagged` | `CONF-012` | medium | Tables holding confidential data are tagged | `table.tag_required` | `field_names` (e.g. `["notes","diagnosis"]`) | |
35
+ | `views_hide_sensitive` | `CONF-013` | medium | Saved views hide sensitive fields | `table.view_hide_required` | _nothing_ | SOC 2, HIPAA |
36
+ | `no_sensitive_data_in_logs` | `LOG-001` | high | Logs don't contain request, user or secret data | `statement.expression_rule` | _nothing_ | SOC 2, HIPAA, GDPR, PCI DSS |
37
+ | `audit_log_protected` | `RET-001` | high | Only the audit function writes the audit log | `workspace.object_required`, `table.write_location_restricted` | R1: `names` (e.g. `["audit_log"]`); R2: `restricted_tables` (e.g. `["audit_log"]`), `allowed_functions` (e.g. `["record_audit_event"]`) | SOC 2, HIPAA |
38
+ | `retained_data_cleaned_up` | `RET-002` | medium | Retained data has a cleanup task | `table.coverage_required` | `tags` (e.g. `["retained"]`) | SOC 2, GDPR |
39
+
40
+ ## Secrets
41
+
42
+ | Template | Key | Severity | Title | Checks | Fill | Frameworks |
43
+ | --- | --- | --- | --- | --- | --- | --- |
44
+ | `no_secrets_in_code` | `SEC-012` | critical | No secrets are hardcoded | `literal.credential_shape` | _nothing_ | SOC 2, PCI DSS |
45
+
46
+ ## Integrations
47
+
48
+ | Template | Key | Severity | Title | Checks | Fill | Frameworks |
49
+ | --- | --- | --- | --- | --- | --- | --- |
50
+ | `approved_vendors_only` | `VND-001` | high | Data only goes to approved vendors | `outbound.vendor_allowlist` | `hosts` (e.g. `["api.stripe.com",".example.com"]`) or `providers` (e.g. `["aws","openai"]`) | SOC 2, HIPAA, GDPR, PCI DSS |
51
+ | `tls_verification_on` | `SEC-011` | high | External requests verify TLS certificates | `statement.param_forbidden` | _nothing_ | SOC 2, HIPAA, PCI DSS |
52
+ | `external_calls_handle_errors` | `LOG-010` | medium | External calls handle their own failures | `statement.containment` | _nothing_ | |
53
+ | `requests_have_timeout` | `SEC-013` | medium | External requests time out quickly | `statement.param_bound` | _nothing_ | |
54
+
55
+ ## Reliability
56
+
57
+ | Template | Key | Severity | Title | Checks | Fill | Frameworks |
58
+ | --- | --- | --- | --- | --- | --- | --- |
59
+ | `no_destructive_sql` | `SEC-010` | high | No table truncation or raw SQL | `stack.statement_forbidden` | _nothing_ | |
60
+ | `middleware_surfaces_errors` | `LOG-011` | medium | Middleware doesn't swallow errors | `object.settings_forbidden` | _nothing_ | |
61
+ | `reads_are_paged` | `PERF-001` | medium | Endpoints never return every row | `statement.param_bound` | _nothing_ | |
62
+ | `get_endpoints_only_read` | `API-010` | medium | GET endpoints only read | `stack.statement_forbidden` | _nothing_ | |
63
+ | `inputs_validated` | `VAL-001` | medium | Endpoint inputs are typed and bounded | `object.input_rules`, `object.unused_input_forbidden` | _nothing_ | |
64
+ | `triggers_write_elsewhere` | `RET-010` | medium | Trigger writes don't silently skip other triggers or re-fire themselves | `trigger.write_trigger_effects` | _nothing_ | |
65
+
66
+ ## Testing
67
+
68
+ | Template | Key | Severity | Title | Checks | Fill | Frameworks |
69
+ | --- | --- | --- | --- | --- | --- | --- |
70
+ | `endpoints_have_tests` | `CHG-001` | low | Endpoints are tested | `object.test_coverage`, `test.assertion_required` | _nothing_ | SOC 2 |
71
+
72
+ ## Conventions
73
+
74
+ | Template | Key | Severity | Title | Checks | Fill | Frameworks |
75
+ | --- | --- | --- | --- | --- | --- | --- |
76
+ | `functions_snake_case` | `CONV-010` | low | Functions are snake_case | `object.naming` | _nothing_ | |
77
+ | `fields_snake_case` | `CONV-011` | low | Fields are snake_case with <table>_id links | `object.naming` | _nothing_ | |
78
+ | `endpoint_paths_versioned` | `CONV-012` | low | Endpoint paths are versioned kebab-case | `object.naming` | _nothing_ | |
79
+ | `function_arguments_snake_case` | `CONV-013` | low | Function arguments are snake_case | `object.naming` | _nothing_ | |
80
+ | `agreed_tag_vocabulary` | `CONV-020` | low | Tags come from the agreed vocabulary | `object.tag_vocabulary` | `allowed_tags` (e.g. `["pii","phi","pci","public"]`) | |
81
+ | `tags_kebab_case` | `CONV-021` | low | Tags are kebab-case | `object.tag_vocabulary` | _nothing_ | |
82
+ | `owner_team_tagged` | `CONV-022` | low | APIs, functions and tasks name an owner team | `object.tag_required` | `tag_set` (e.g. `["team-billing","team-growth","team-platform"]`) | |
83
+ | `tables_classified` | `CONV-023` | low | Every table is classified | `object.tag_required` | `tag_set` (e.g. `["public","internal","confidential","restricted"]`) | |
84
+ | `ai_tools_described` | `CONV-030` | low | AI tools and their inputs are described | `object.description_required` | _nothing_ | |
85
+ | `endpoints_stay_short` | `CONV-040` | low | Endpoints and functions stay short | `stack.size_limit` | _nothing_ | |
86
+ | `shallow_nesting` | `CONV-041` | low | Stacks nest at most 3 levels deep | `stack.size_limit` | _nothing_ | |
87
+ | `no_leftover_code` | `CONV-050` | low | No leftover code | `stack.disabled_statement_forbidden`, `object.unused_input_forbidden`, `stack.unused_variable_forbidden` | _nothing_ | |
88
+ | `tables_have_listed_fields` | `CONV-060` | low | Every table has the listed fields | `table.field_attribute_required` | `field_names` (e.g. `["updated_at","tenant_id"]`) | |
89
+
90
+ ## Recipes
91
+
92
+ A recipe covers a goal that takes several templates, such as protecting payment card data. Nothing creates a recipe: do what it asks first, create each of its templates as its own policy in the order given, then put its own rules together in one policy of your own, filling what each needs. It ends with what no rule in it can see; say so when the request reaches that far. The catalogue serves them as `recipes`.
93
+
94
+ Framework tags point to templates on related topics. They don't make a workspace compliant, and Xano doesn't track changes to these frameworks.
95
+
96
+ ### Protect health data
97
+
98
+ `protect_health_data` · HIPAA. Tables holding health data are tagged and marked, reached only by logged-in callers who record each access, kept out of responses, logs and saved views, and sent only to approved vendors over verified TLS.
99
+
100
+ Keywords: health, phi, ephi, patient, medical, clinical, diagnosis, hipaa, healthcare.
101
+
102
+ First:
103
+
104
+ - Choose one tag for tables holding health data (such as phi) and add it to them: CONF-010 and the access-record rule judge nothing until a table carries it. Use the same tag as CONF-012's tag, so a new table with those fields is caught.
105
+ - List the fields that hold health data by exact name (diagnosis, dob, ssn) for CONF-011, CONF-012 and DATA-010.
106
+ - Write one function that records each access, passing the logged-in user (such as log_phi_access), and name it in the access-record rule.
107
+ - Approve the vendors that may receive health data (hosts, providers) for VND-001.
108
+
109
+ Templates, in order, one policy each:
110
+
111
+ 1. `confidential_tables_tagged` (`CONF-012`): Tables holding confidential data are tagged
112
+ 2. `sensitive_fields_marked` (`CONF-011`): Sensitive fields are marked sensitive
113
+ 3. `sensitive_tables_need_login` (`CONF-010`): Sensitive tables are only reached by logged-in endpoints
114
+ 4. `no_pii_in_responses` (`DATA-010`): Endpoints don't return personal data
115
+ 5. `no_sensitive_data_in_logs` (`LOG-001`): Logs don't contain request, user or secret data
116
+ 6. `views_hide_sensitive` (`CONF-013`): Saved views hide sensitive fields
117
+ 7. `approved_vendors_only` (`VND-001`): Data only goes to approved vendors
118
+ 8. `tls_verification_on` (`SEC-011`): External requests verify TLS certificates
119
+ 9. `audit_log_protected` (`RET-001`): Only the audit function writes the audit log
120
+
121
+ Rules no template covers, together in one policy of your own:
122
+
123
+ - Objects reaching health tables always record the access: `object.statement_required` with `{"placement":"unconditional"}`. Fill `functions`, `reaching_table_tags`.
124
+
125
+ No rule here can see: People and training; Access reviews and change approvals; Runtime data and copies between environments; Infrastructure and network (see What no check can see).
126
+
127
+ ### Protect payment card data
128
+
129
+ `protect_card_data` · PCI DSS. No table stores a card number or security code, card details go only to your payment processor over verified TLS, and its keys, your logs and your responses keep card data out of sight.
130
+
131
+ Keywords: card, credit card, payment, pan, cvv, cardholder, pci, checkout, stripe, tokenization.
132
+
133
+ First:
134
+
135
+ - Send card details straight to your payment processor and keep only its token, so no table needs a card field: the card-field rule reports any table that declares one.
136
+ - Approve your processor's hosts (such as api.stripe.com) for VND-001.
137
+ - Keep the processor's keys in environment variables: SEC-012 reports one written in code.
138
+ - List the card-adjacent fields you do store (card_last4, billing_address) for CONF-011 and DATA-010.
139
+
140
+ Templates, in order, one policy each:
141
+
142
+ 1. `no_secrets_in_code` (`SEC-012`): No secrets are hardcoded
143
+ 2. `approved_vendors_only` (`VND-001`): Data only goes to approved vendors
144
+ 3. `tls_verification_on` (`SEC-011`): External requests verify TLS certificates
145
+ 4. `sensitive_fields_marked` (`CONF-011`): Sensitive fields are marked sensitive
146
+ 5. `no_pii_in_responses` (`DATA-010`): Endpoints don't return personal data
147
+ 6. `no_sensitive_data_in_logs` (`LOG-001`): Logs don't contain request, user or secret data
148
+
149
+ Rules no template covers, together in one policy of your own:
150
+
151
+ - Card numbers and security codes are never stored: `table.field_attribute_required` with `{"field_names":["card_number","cvv","cvc","pan"],"forbidden":true}`.
152
+
153
+ No rule here can see: People and training; Access reviews and change approvals; Runtime data and copies between environments; Infrastructure and network (see What no check can see).
154
+
155
+ ### Erase and expire personal data
156
+
157
+ `personal_data_erasure` · GDPR. Tables holding personal data are cleaned up on a schedule and reached by one function that erases a person's records, and personal fields stay marked and out of responses and logs.
158
+
159
+ Keywords: erasure, right to be forgotten, delete my data, retention, personal data, purge, dsar, privacy, gdpr, anonymise.
160
+
161
+ First:
162
+
163
+ - Tag the tables to clean up on a schedule (such as retained) for RET-002, and the tables holding personal data (such as personal) for the erasure rule: both judge only tagged tables.
164
+ - Write one function that erases a person's records and tag it (such as erasure); name that tag in the erasure rule. Add db.edit or db.patch to its statements where a table is anonymised rather than deleted.
165
+ - Choose each table's retention period inside its cleanup task: no rule reads the age it deletes at.
166
+ - List the personal fields by exact name for CONF-011 and DATA-010.
167
+
168
+ Templates, in order, one policy each:
169
+
170
+ 1. `retained_data_cleaned_up` (`RET-002`): Retained data has a cleanup task
171
+ 2. `sensitive_fields_marked` (`CONF-011`): Sensitive fields are marked sensitive
172
+ 3. `no_pii_in_responses` (`DATA-010`): Endpoints don't return personal data
173
+ 4. `no_sensitive_data_in_logs` (`LOG-001`): Logs don't contain request, user or secret data
174
+
175
+ Rules no template covers, together in one policy of your own:
176
+
177
+ - The erasure function reaches every personal-data table: `table.coverage_required` with `{"referenced_by":{"object_kinds":["function"],"statements":["db.del","db.bulk.delete"]}}`. Fill `tags`, `referenced_by.tags`.
178
+
179
+ No rule here can see: Retention age; Runtime data and copies between environments; People and training (see What no check can see).
180
+
181
+ ### Keep code easy to review
182
+
183
+ `code_review_basics`. External calls handle their failures, endpoints are tested, endpoints and functions stay short and page their reads, no leftover code remains, and functions say what they do. Naming conventions are a separate choice: see the Conventions templates.
184
+
185
+ Keywords: code review, review, quality, clean code, maintainable, lint, best practice, tests, readable, error handling, breaking prod, juniors.
186
+
187
+ First:
188
+
189
+ - Tag large legacy endpoints and functions (such as legacy) and list the tag in CONV-040's except_tags until they are split.
190
+
191
+ Templates, in order, one policy each:
192
+
193
+ 1. `external_calls_handle_errors` (`LOG-010`): External calls handle their own failures
194
+ 2. `endpoints_have_tests` (`CHG-001`): Endpoints are tested
195
+ 3. `endpoints_stay_short` (`CONV-040`): Endpoints and functions stay short
196
+ 4. `no_leftover_code` (`CONV-050`): No leftover code
197
+ 5. `reads_are_paged` (`PERF-001`): Endpoints never return every row
198
+
199
+ Rules no template covers, together in one policy of your own:
200
+
201
+ - Functions say what they do: `object.description_required` with `{"object_kinds":["function"],"min_length":20}`.
202
+
203
+ No rule here can see: Access reviews and change approvals; People and training (see What no check can see).
204
+
205
+ ### Record who changed what
206
+
207
+ `audit_changes` · SOC 2, HIPAA. Every edit and delete of the tables you name calls one audit function, only that function writes the audit log, and nothing edits or deletes an audit entry.
208
+
209
+ Keywords: audit, audit trail, who changed, change history, history, tamper, accountability, activity log, log changes.
210
+
211
+ First:
212
+
213
+ - Create the audit log table (such as audit_log) and one function that writes an entry, passing the logged-in user (such as record_audit_event), for RET-001 and the audit rules.
214
+ - Name the tables whose changes are audited, by exact name, in each audit rule.
215
+
216
+ Templates, in order, one policy each:
217
+
218
+ 1. `audit_log_protected` (`RET-001`): Only the audit function writes the audit log
219
+
220
+ Rules no template covers, together in one policy of your own:
221
+
222
+ - Edits of audited tables call the audit function: `object.statement_required` with `{"placement":"unconditional","when":{"statement":"db.edit"}}`. Fill `functions`, `when.tables`.
223
+ - Patches of audited tables call the audit function: `object.statement_required` with `{"placement":"unconditional","when":{"statement":"db.patch"}}`. Fill `functions`, `when.tables`.
224
+ - Deletes from audited tables call the audit function: `object.statement_required` with `{"placement":"unconditional","when":{"statement":"db.del"}}`. Fill `functions`, `when.tables`.
225
+ - Audit entries are never edited or deleted: `table.write_location_restricted` with `{"statements":["db.edit","db.patch","db.add_or_edit","db.del","db.truncate","db.bulk.update","db.bulk.patch","db.bulk.delete"]}`. Fill `restricted_tables`.
226
+
227
+ No rule here can see: Access reviews and change approvals; Runtime data and copies between environments; Retention age (see What no check can see).
228
+
229
+ ### Keep AI calls affordable and agents safe
230
+
231
+ `ai_cost_and_agent_safety`. AI calls stay out of loops, reads are paged, agents use approved model providers, AI tools are described and cannot delete records, and deletes and emails wait for an approval check.
232
+
233
+ Keywords: ai, llm, agent, cost, spend, tokens, mcp, tool, openai, anthropic, runaway, approval, human in the loop.
234
+
235
+ First:
236
+
237
+ - Approve the model providers your agents may use (openai, anthropic) and the hosts AI calls may reach, for VND-001.
238
+ - Write one function that checks a person approved the action (such as require_approval), call it before each delete and email, and name it in the approval rule.
239
+
240
+ Templates, in order, one policy each:
241
+
242
+ 1. `approved_vendors_only` (`VND-001`): Data only goes to approved vendors
243
+ 2. `reads_are_paged` (`PERF-001`): Endpoints never return every row
244
+ 3. `requests_have_timeout` (`SEC-013`): External requests time out quickly
245
+ 4. `ai_tools_described` (`CONV-030`): AI tools and their inputs are described
246
+
247
+ Rules no template covers, together in one policy of your own:
248
+
249
+ - AI calls are not made inside loops: `statement.containment` with `{"statements":["ai.agent.run","ai.external.mcp.tool.run"],"must_not_be_inside":["foreach","for","while"]}`.
250
+ - AI tools cannot delete records: `stack.statement_forbidden` with `{"statements":["db.del","db.bulk.delete","db.truncate"],"object_kinds":["tool"]}`.
251
+ - Deletes and emails wait for an approval check: `stack.statement_order` with `{"after":["db.del","db.bulk.delete","util.send_email"]}`. Fill `before.functions`.
252
+
253
+ No rule here can see: Spend caps; Agent tool allowlists; Task retries; Runtime data and copies between environments (see What no check can see).
254
+
255
+ ## What no check can see
256
+
257
+ Policies read the workspace's stored definitions. A request about any of these goes beyond them: say so plainly, and cover what a check can see with a template or a rule. The catalogue serves them as `not_checkable`.
258
+
259
+ - **People and training** (`people_and_training`): Who works on the workspace, their background checks and their security training are about people; policies read object definitions only. Keywords: training, employee, staff, background check, onboarding, offboarding, awareness, people.
260
+ - **Access reviews and change approvals** (`access_reviews_and_approvals`): Reviewing who can reach the workspace, and who approved a change, happens outside the definitions; a blocking policy can hold a merge but cannot see who signed it off. Keywords: access review, approval, approver, sign off, change approval, peer review, four eyes, reviewer, separation of duties.
261
+ - **Runtime data and copies between environments** (`runtime_data`): Policies read stored definitions, never the records in tables, what a request sent or stored, or data copied between branches, environments or tenants. Keywords: runtime, actual data, records, payload, production data, test data, copy data, environment, staging, backup, export.
262
+ - **Infrastructure and network** (`infrastructure`): Hosting, network segmentation, encryption at rest, backups, vulnerability scans and penetration tests are controls of Xano or your hosting provider, not workspace definitions. Keywords: network, firewall, segmentation, encryption at rest, backup, penetration test, vulnerability scan, hosting, infrastructure.
263
+ - **Spend caps** (`spend_caps`): No check reads what AI calls or vendors cost, or caps spend, yet; a rule can keep AI calls out of loops and reads paged. Keywords: spend, cost cap, budget, billing, token usage, usage cap, quota, rate of spend.
264
+ - **Task retries** (`task_retries`): Tasks have no retry setting a check could read, so how often a failed task runs again is not checked yet. Keywords: retry, retries, backoff, failed task, rerun, dead letter.
265
+ - **Retention age** (`retention_age`): A check confirms a cleanup task deletes from each retained table, but not yet how old a record is when it goes: the age lives in the task's own query. Keywords: retention period, how long, days, age, expire after, keep for, retention schedule.
266
+ - **Agent tool allowlists** (`agent_tool_allowlists`): No check limits which tools an AI agent or MCP server may expose yet; a rule can forbid statements inside tools. Keywords: tool allowlist, agent tools, mcp tools, which tools, toolset, tool permissions.
267
+ - **Scope by endpoint path prefix** (`path_prefix_scope`): A rule selects endpoints by tag, API group, verb or auth, not yet by a path prefix such as /admin: tag those endpoints or their API group instead. Keywords: path prefix, /admin, url prefix, route prefix, path starts with, endpoint path.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xano/developer-mcp",
3
- "version": "2.3.0-beta.3",
3
+ "version": "2.3.0-beta.4",
4
4
  "description": "MCP server and library for Xano development - XanoScript validation, Meta API, Run API, and CLI documentation",
5
5
  "mcpName": "io.github.xano-inc/xano-developer-mcp",
6
6
  "type": "module",
@@ -63,7 +63,7 @@
63
63
  "license": "MIT",
64
64
  "dependencies": {
65
65
  "@modelcontextprotocol/sdk": "^1.26.0",
66
- "@xano/xanoscript-language-server": "^12.19.0",
66
+ "@xano/xanoscript-language-server": "^12.21.0",
67
67
  "minimatch": "^10.1.2",
68
68
  "zod": "^4.0.0"
69
69
  },