Skip to content

AZ503: A test names a scope the policy doesn't have ​

with scope checks a line as a key or a token limited to those scopes would be. The scopes are the policy's scope lines, and read, which is built in.

Reported when the tests are compiled: rowstile test, the editor, rowstile dev.

The mistake ​

authz
app role app_user
type user = app.users
type folder = app.folders
  owner : user = owner_id
  can view = owner
scope files = folder.view
test "keys"
  given f = {INSERT INTO app.folders (owner_id, name) VALUES (1, 'a') RETURNING id}
  user 1 with scope file can view folder $f
line 9: no scope 'file' in the policy (it has: files, read) [AZ503]

Fixed ​

authz
app role app_user
type user = app.users
type folder = app.folders
  owner : user = owner_id
  can view = owner
scope files = folder.view
test "keys"
  given f = {INSERT INTO app.folders (owner_id, name) VALUES (1, 'a') RETURNING id}
  user 1 with scope files can view folder $f