Browse the documentation
AI-Soda Brain

Test roles, data scope and permissions

The same question should return only the results each identity is allowed to access. Exercise queries, citations, caches and exports, and repeat the tests after a role change.

Technical guide · November 20264 min read

Define who may access each resource

Build a permission matrix from job responsibilities. Include identity, business scope, readable objects, sensitive fields and permitted actions. Read-only access limits writes. You still need to restrict which records can be read. Align access at the application entry point, the data source and the delivered file.

Use synthetic regional data for regions A and B and separate test identities for a public demonstration. Keep real employee records private. Pair each allowed case with a denied case and document the expected behavior.

A minimal test matrix

Test identityRequestExpected outcome
Region A readerRequest a summary for region AReturn only authorized records.
Region A readerRequest details for region BExplain the restriction without revealing out-of-scope content.
Restricted readerOpen someone else's citation or export linkCheck the reader's access scope again.
Identity whose access has been revokedRepeat an old question or open an earlier sessionApply current permissions. Expired permissions must grant no access.

Check authorization along the request path

Authentication establishes who you are. Authorization determines what you may do. Enforce checks in trusted server-side execution paths. Hiding a button in the interface is insufficient. OWASP recommends denying access by default and checking permissions on every request. Include follow-ups, cache hits and file downloads in those checks.

Database row-level policies can provide one layer of protection. Their behavior depends on the database, identity and deployment. For PostgreSQL or another database, consult the official documentation and test the current role configuration to establish what the policy actually enforces.

Retest after a change

  • Rerun allowed and denied cases after changes to the organization, roles, data sources or field scope.
  • Check that caches, earlier sessions, subscriptions and exported files still respect the new scope.
  • Log access decisions and the context needed to review them. Avoid retaining complete sensitive questions and results by default.
  • If an access control fails, contain the exposure, retain diagnostic records and repair the specific authorization path.

Further reading

Try “permissions,” “data source,” “manufacturing” or “API.”