Skip to Content
Zenlev
ReferenceIndividual lint rules

ZenStack access policies

Check configured ZenStack model access declarations.

Checks resolved ZModel access declarations, including delegated allow predicates. A literal broad allow can be reported even when another policy covers the same operation.

Enable this opt-in rule under lint.rules.

Configuration

import { defineConfig } from '@mwillbanks/zenstack-zenlev'

export default defineConfig({
  lint: {
    rules: {
      'zenlev/zenstack/policies': [
        'error',
        {
          include: ['public.Order'],
          commands: ['read', 'update'],
          postUpdate: true,
          noBroad: true,
        },
      ],
    },
  },
})

Parameters

  • commands accepts create, read, update, delete, post-update, and all. Required commands look for an applicable allow declaration.
  • postUpdate: true requires an explicit post-update policy. An all policy does not satisfy that check.
  • noBroad: true flags literal true allow predicates.

All built-in rules accept the shared selectors.

Example

For this PostgreSQL example, public.Order selects the logical model in the public schema. Use @@map("orders") to set its physical table name. Give read and update applicable allow predicates, then add a separate post-update policy. Validate the predicates for the application role.

On this page