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 identity | Request | Expected outcome |
|---|---|---|
| Region A reader | Request a summary for region A | Return only authorized records. |
| Region A reader | Request details for region B | Explain the restriction without revealing out-of-scope content. |
| Restricted reader | Open someone else's citation or export link | Check the reader's access scope again. |
| Identity whose access has been revoked | Repeat an old question or open an earlier session | Apply 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.
