Why Role-Based Dashboards and Shared Read Replicas Fail at Least Privilege and What Replaces Them
Dashboards and read replicas hide data, so enforce access in the database.

Least-privilege access control for internal database tools means enforcing permissions at the data layer — row-level and column-level security in the database or a semantic execution layer — rather than at the dashboard or application UI. Role-based dashboards that hide columns, and shared read replicas for analytics, both fail this standard because the data still reaches the client or the over-permissioned credential can still read everything. The alternative is a database-native platform with row-level permissions and permissioned views, which lets non-technical users self-serve without widening the blast radius.
Why access control at the presentation layer is structurally insufficient
The fundamental problem with role-based dashboards is that access control happens at the presentation layer. The user sees only what the interface chooses to display, but the underlying query returns far more than that. Open the network inspector, and the full result set is sitting there in the JSON payload. A regional sales manager sees her region’s detail grid, but a KPI tile built on a pre-aggregated summary table shows the company total, because the filter was never applied to that query.
If the enforcement point is the UI, then every data path that does not go through the UI — exports, API calls, scheduled jobs, hand-written SQL — is outside the control. The dashboard hides data. It does not restrict access to it.
How the BI tool's shared service credential breaks the access model before RLS can run
The execution model of most BI tools makes the problem worse. The BI tool connects to the warehouse with a service account. The user opens a dashboard. The BI tool generates the SQL. The query runs as the service account. The warehouse sees a connection from a service account with certain grants, and it returns whatever that account is allowed to read.
Row-level security in a BI tool is applied after the data has already left the database. The BI tool fetches the full result set under the service credential, then filters rows and masks columns in memory before rendering the dashboard. This presentation filter can be bypassed by a bug, a misconfiguration, or a code path the team forgot about. If identity passthrough (such as AAD OAuth or DirectQuery in AAD mode) is not configured, the data layer never sees the user’s identity at all, and the warehouse honors the service account’s permissions, which are typically broad.
Caching makes this worse. A cache key that does not include the user’s permission scope will serve one user’s result set to another. The VP’s numbers land in the intern’s screen with no code change and no error. This is why the guidance in ToolJet’s guide to secure dashboards points in the right direction: the dashboard should call a trusted backend that checks identity and permission before querying the database or calling a service.
Why read replicas do not solve the problem and can conceal it
The standard infrastructure answer is to point the BI tool at a read replica. A read replica is a separate database instance that receives changes from the primary and serves read traffic. It is physically a different system, but it is logically identical to the primary: every table, every column, every row that exists on the primary exists on the replica.
A service account that can connect to the replica and run queries can read everything the replica contains, subject to the grants on that account. If the grants are broad, the replica is just as exposed as the primary. The replica prevents writes. It does not prevent reads.
This is a real distinction, and it is worth stating plainly: a read replica is a load management and write isolation tool. It keeps analytics queries from contending with transactional writes. It is not an access control mechanism. Teams that treat it as one have set up a false boundary — the blast radius of a compromised or over-permissioned session is the same whether it hits the primary or the replica. Infrastructure guides often present read-only replica access as a security benefit for BI tools, and that framing is accurate for write isolation, but it conflates two different concerns.
How privilege creep accumulates on top of these structural failures
Even when the role model is designed well, it tends to accumulate privilege over time. Roles are created to solve a problem, then they are never cleaned up. The joiner gets access, the mover gets more access, the leaver’s access is often never fully revoked. Scheduled exports and dashboard subscriptions can outlive the account they were created under, because the schedule is owned by a user record that was deactivated but not fully deprovisioned.
New dashboard widgets and exports are added to existing pages without inheriting the page’s permission model. A role that was appropriate six months ago is too broad today, because the team’s data has grown and the role has not. Four roles become a dozen sub-variants in a few months, each one a patch for an edge case: “analyst but not salary data,” “viewer but only the EMEA client,” “external auditor, read-only, expires in 90 days.” At that point the role model is attribute-based access control that was never designed to be.
What happens when AI agents inherit these same access models
The same structural problem gets worse when an AI agent is the one connecting to the database. An agent that connects under a service identity with broad grants can read whatever that identity can read, with no presentation layer in between to slow it down or filter it. If the authorization layer is the BI tool, and the agent bypasses the BI tool and connects to the warehouse directly with a connection string, there is no authorization at all.
System prompt instructions are not access control. Telling an agent “only generate SELECT queries” is a natural language guardrail. A prompt injection or a structural hallucination can get around it. OWASP’s MCP Top 10 names this class of problem: MCP02:2025 — Privilege Escalation via Scope Creep. Temporary or loosely defined permissions within MCP servers often expand over time, granting agents excessive capabilities.
The read-replica non-fix applies here too. An agent connected to a replica with a broad credential can exfiltrate every readable table. The replica stops it from writing. That is about all it does.
Where enforcement must actually live to satisfy least privilege

The fix is to move enforcement down to the data layer. This means the database engine or the semantic execution layer is the thing that refuses the query. There are three real options, and they are not equivalent.
Database-native row-level security — PostgreSQL’s CREATE POLICY, Snowflake’s row access policies, and similar features — is the strongest option. The database enforces the policy. A bug in the application layer cannot leak rows, because the database will not return them. The trade-off is performance: RLS policies that involve subqueries or IN clauses against mapping tables can degrade query performance significantly. The fix is to use a materialized entitlement table with a covering index, and to make sure the policy expressions use leakproof operators where possible (LEAKPROOF designation requires superuser, and is primarily a security classification that affects predicate pushdown). Digital Heroes’ guide to the cost of RBAC documents the 40ms-to-3.5s degradation case and the materialized-table solution. One critical detail: RLS is bypassed by the table owner and any role with the BYPASSRLS privilege. If the migration user and the application connection user are the same role, the control does not work.
Semantic layer enforcement is the second option. Access control is defined at the level of the concepts — “this team can see revenue metrics but not cost metrics” — and the semantic layer applies it consistently across dashboards, exports, and APIs. The benefit is that the same definition of “revenue” is enforced everywhere, rather than each tool having its own implementation that drifts over time. The semantic layer also makes it easier to prevent unauthorized intent from ever reaching the warehouse: if the query cannot be compiled against the user’s permitted metrics, the data layer is never touched.
The third option is to enforce it in the application layer with WHERE clauses. This is the fastest to build and the most fragile. It only works if every read path in the codebase goes through the same repository function that adds the filter. One raw query written outside that path and the control is gone. It requires a test that fails when a read path bypasses the filter, written on day one. It is not a good primary enforcement mechanism for sensitive data.
The rule of thumb: enforce at the lowest layer you can. If you can use database RLS, use it. If you have a semantic layer, enforce there. If you must enforce in the application layer, treat it as a supplement. ToolJet’s guide to secure dashboards makes the same point from the other direction: apply least privilege, session controls, and monitoring, because no single layer is sufficient on its own.
What permission design looks like when it actually scales
The permission model itself needs to be designed for the complexity that will actually arrive. A common failure is to start with a simple role model — “admin,” “editor,” “viewer” — and discover within months that the real requirement is relational: a user belongs to a team, the team belongs to a territory, the territory rolls up to a region, and the VP can see everything under her region. That is a hierarchy, and hierarchies change.
The question to ask early is: when a manager is promoted, can she see last quarter’s numbers for her new region? The answer is a product decision, but the data layer has to be able to express it. If the permission model is a flat role lookup, the answer is “no, and we will need a new role.” If the model is relationship-based, the answer is encoded in the data.
Another question that comes up: what happens when a user has two roles, one of which grants access and one of which denies it? Does the deny win? The rule has to be explicit, and the UI has to show the effective permission. Ambiguity here produces support tickets that are impossible to reproduce.
Permission checks that run inside a loop are a performance trap. Rendering a list of 200 dashboards with one authorization call per row will produce latency that makes the team want to give everyone more access, just to get the UI to load. Batch authorization checks, or “list objects user can access” primitives, are necessary at scale.
Role design should start with fewer roles than the team thinks it needs. Role proliferation is a symptom of modeling every exception instead of fixing the process that creates the exception. ToolJet’s guide recommends starting from an access matrix: for each role, list which records it can read, which fields it can change, and which actions it can approve. Then write a negative test for each restriction.
How to give non-technical teams self-serve data access without widening the blast radius
The tension between governance and accessibility is real, but it is not a trade-off that has to be managed at the UI layer. If you over-index on governance, you end up with approved dashboards that users can filter but not explore, which amounts to a read-only report with extra steps. If you over-index on accessibility without enforcement at the data layer, you get metric divergence, satellite copies of data exported outside IT’s control, and eventually a security incident.
The way out is to enforce at the data layer and be generous at the interface layer. Row-level permissions and scoped credentials in the database mean that the non-technical user can explore freely within a boundary that they cannot see and cannot breach. Permissioned editable views let operations, support, and sales teams update data safely, because the same enforcement model that restricts what they can read also restricts what they can write. Saved queries and dashboards built on top of a direct database connection inherit the data-layer permission automatically, so there is no separate UI access control to configure and no second place for the permission model to drift.
This is what a database-native platform with row-level permissions and permissioned views is for. The engineering team sets up the enforcement once, at the data layer. The cross-functional team — product, marketing, support, ops — self-serves on top of it, without filing tickets or waiting on the data team, and without the blast radius of a misconfiguration extending beyond the rows and columns the permission model allows.


