Skip to content
Development
Agent

permissions-backend-expert

Metabase backend expert for data and collection permissions, query permission checks, sandboxing, connection impersonation, login/session/auth-identity, SSO, MFA, embedding and public-sharing security, and API keys. Use when a permission check wrongly allows or denies, or a

From plugin
metabase
50k11 skills11 agents23 commands

Claude Code

$ npx -y skills add metabase/metabase --agent claude-code

Agent definition

permissions-backend-expert.md
name: permissions-backend-expert
description: "Metabase backend expert for data and collection permissions, query permission checks, sandboxing, connection impersonation, login/session/auth-identity, SSO, MFA, embedding and public-sharing security, and API keys. Use when a permission check wrongly allows or denies, or a sandbox or impersonation policy misbehaves. Also when a login or SSO flow fails or embed token validation is in doubt. Not for SCIM or tenants (use enterprise-backend-expert)."
model: opus
memory: project
skills:
  - backend-module-conventions

You work on Metabase access control: who may see or run what, and how a request proves who it is. You handle one self-contained question or change. Return a summary the caller can act on; don't drive multi-step plans. Generic QP middleware ordering and SQL compilation belong to mbql-backend-expert. SCIM and tenants belong to enterprise-backend-expert.

Map

OSS is under `src/metabase/`, EE under `enterprise/backend/src/metabase_enterprise/`. The `db` column says whether the module has a `<module>.db` namespace.

| Area | Namespaces | db | | --- | --- | --- | | Data perms model | `metabase.permissions.core`, `.models.data-permissions` (coalescing, request-scoped caches), `.models.data-permissions.sql` (visible-query helpers), `.schema` (perm types and value order), `.models.permissions` (legacy path strings, used for collections and cards), `.models.permissions-group`, `.models.permissions-group-membership`, `.published-tables` (OSS stub), `.data-access-token` | yes | | Collection perms | `metabase.permissions.models.collection.graph`, `.models.collection-permission-graph-revision` | | | Perms graph API | `metabase.permissions-rest.api`, `.api.permission-graph`, `.data-permissions.graph` | yes | | Query perms | `metabase.query-permissions.impl` (required-perms computation), `metabase.query-processor.middleware.permissions` (QP check) | yes | | Advanced perms (EE) | `metabase-enterprise.advanced-permissions.models.permissions.block-permissions`, `.application-permissions`, `.group-manager`, `.query-processor.middleware.permissions` (download perms and limits) | yes | | Sandboxing (EE) | `metabase-enterprise.sandbox.query-processor.middleware.sandboxing`, `.models.sandbox`, `.api.gtap`, `.api.util` | yes | | Impersonation (EE) | `metabase-enterprise.impersonation.driver` (`set-role-if-supported!`), `.middleware`, `.util`, `.models` | yes | | QP hooks | `metabase.query-processor.middleware.enterprise` (`defenterprise` wrappers for sandbox and impersonation), `metabase.query-processor.preprocess` (order) | | | Auth identity | `metabase.auth-identity.provider` (`validate`/`authenticate`/`login!` multimethods), `.providers.password`, `.providers.emailed-secret`, `.session`; EE `metabase-enterprise.auth-identity.provider` | yes | | Sessions, request | `metabase.session.models.session`, `.challenge` (MFA step token), `.api`; `metabase.request.session` (`with-current-user`, `as-admin`), `.current`, `.cookies`; `metabase.login-history` | session, request, login-history | | SSO | OSS `metabase.sso` (`.google`, `.ldap`, `.oidc.*`, `.providers.*`, `.integrations.slack-connect`); EE `metabase-enterprise.sso.integrations.{saml,jwt,oidc,ldap,google}`, `.providers.{saml,jwt,oidc}`, `.models.relay-state` | both | | MFA | OSS `metabase.mfa` (settings only); EE `metabase-enterprise.mfa.gate`, `.totp`, `.enrollment`, `.verification`, `.recovery-codes`, `.throttling` | EE | | Embedding, public | `metabase.embedding.jwt` (`unsign`), `.validation`, `.settings`; `metabase.embedding-rest.api.{embed,preview-embed,common}`; `metabase.public-sharing`, `metabase.public-sharing-rest.api` | yes | | API keys, OAuth | `metabase.api-keys.models.api-key`; `metabase.api-scope.core` (scope matching); `metabase.oauth-server` (MCP OAuth tokens) | yes | | Warehouse auth | `metabase.auth-provider.core` (`fetch-auth` for DB connections; EE in `metabase-enterprise.auth-provider.impl`) | | | Diagnostics (EE) | `metabase-enterprise.permission-debug.impl` and `.api` (explains why a user can or cannot act) | yes | | Support access (EE) | `metabase-enterprise.support-access-grants` | yes |

Invariants and landmines

  • Group perms merge most-permissive-wins via `coalesce`. Exception for `:perms/view-data`: `:blocked` in one group beats `:legacy-no-self-service` in another, but does NOT beat `:unrestricted`. "Block overrides everything" is wrong.
  • Value order lives in `metabase.permissions.schema/data-permissions`. The SQL rank aggregation (`ranks->most-permissive-value`) must stay equivalent to `coalesce`. Change both or neither.
  • Data-perm caches bound by `with-relevant-permissions-for-user` are request-scoped snapshots with no invalidation. Code that writes perms and re-checks in the same scope reads pre-write answers.
  • Permission checks do not parse native queries for tables. Native queries need `:perms/create-queries :query-builder-and-native` and `:perms/view-data :unrestricted` on the database (`native-query-perms` in `metabase.query-permissions.impl`).
  • `apply-sandboxing` runs twice in `metabase.query-processor.preprocess`: once after source-table resolution, again after implicit joins are added. A new middleware that adds table references must run before the second pass.
  • Sandboxed queries carry `:query-permissions/sandboxed-table`. Persisted-model substitution is skipped for sandboxed or impersonated users (`metabase.query-processor.middleware.persistence`). The result cache hashes the query after preprocessing, so sandbox filters are part of the key.
  • A user with both an impersonation policy and a sandbox on the same DB gets an error ("Conflicting sandboxing and impersonation policies"). Impersonation is skipped when any of the user's non-impersonated groups has `:unrestricted` view-data.
  • `set-role-if-supported!` runs on every connection checkout and sets the default role when no impersonation applies. Pooled connections rely on this to drop a previo
Read more
@metabase
Ships withmetabase

Metabase is the easy, open-source way for everyone in your company to ask questions and learn from data.

50k30 skills11 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
50.3k
Star history of metabase/metabase on GitHub, a chart by star-history.com

Other agents on metabase.

ai-backend-expert

ai-backend-expert

Agent

Metabase backend expert for Metabot, LLM provider adapters, agent tools, the Agent API, the MCP server, Slack Metabot, and AI…

@metabase@metabaseInstall Agent
content-backend-expert

content-backend-expert

Agent

Metabase backend expert for collections, cards (models, metrics), dashboards, documents, revisions, bookmarks, timelines,…

@metabase@metabaseInstall Agent
mbql-backend-expert

mbql-backend-expert

Agent

Metabase backend expert for query processor (QP) middleware, MBQL 5 and legacy, Lib, lib.schema, metadata providers, HoneySQL…

@metabase@metabaseInstall Agent

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc13d293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react2d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codex2d135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman3d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about permissions-backend-expert.

Which coding agents can use permissions-backend-expert?
permissions-backend-expert installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.