No slash command · from anofox-visualization
Configures authentication and row/column-level access control for anofox-visualization dashboards. Covers OIDC login, JWT bearer tokens, auth proxies, embed links, API keys, and policy.json row filters/column masking.
Ships in anofox-visualization. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Applies to: the locked server anofox_serve_dashboards(dir, port, options) (options auth, policy, log, audit); serve --dashboards takes --auth / --log / --audit but has no policies | Docs: docs/secure-serving.md (reference + threat models), docs/deployment.md
DuckDB has no users, GRANT or row-level security, so the server enforces it: a login method yields claims, the panels (or a policy) filter on them.
A static HTML export, the browser builder / DuckDB-Wasm demo (the data is in the client) and a MotherDuck token (the whole database). Only the locked server (A) and the static render server (B) keep data on the server; only A has policies.
auth: one object or a list, each mode once)SELECT anofox_serve_dashboards('dashboards', 8095, '{
"hosts": ["dash.example.com"],
"auth": [
{"mode": "oidc", "issuer": "https://login.example.com", "client_id": "dashboards",
"client_secret_env": "OIDC_CLIENT_SECRET", "redirect_url": "https://dash.example.com/auth/callback",
"groups_claim": "groups", "claims": {"tenant": "tid"}, "session_secret_env": "ANOFOX_SESSION_SECRET"},
{"mode": "jwt", "issuer": "https://login.example.com", "audience": "dashboards-api"},
{"mode": "embed", "secret_env": "ANOFOX_EMBED_SECRET", "claims": ["tenant"]},
{"mode": "api_keys", "file": "/etc/anofox/keys.json"}
],
"policy": "/etc/anofox/policy.json",
"log": "/var/log/anofox/requests.jsonl", "audit": "/var/log/anofox/audit.jsonl"
}');
mode | For | Key settings |
|---|---|---|
proxy | an auth proxy that already logs people in | shared_secret_env (≥ 32 chars, the proxy adds it on every request), trusted_proxies (CIDRs), header_user (X-Forwarded-User), opt-in header_groups, claims: {"tenant": {"header": "X-Forwarded-Tenant", "required": true}} |
jwt | bearer tokens from an IdP | issuer (https), audience, optional jwks_url, algorithms (asymmetric only), user_claim (sub), groups_claim, claims (dotted paths), cookie, ca_file |
oidc | browser login, authorization code + PKCE | the jwt keys + client_id, client_secret_env, redirect_url (https://…/auth/callback), scopes, session_ttl_s (8 h), session_secret_env (survives restarts, shared by replicas), revocation_file (durable, shared logouts) |
embed | a host app embeds /d/<id>?embed=<token> in an iframe | HS256 link {"dashboard", "user", "groups", "claims", "vars", "exp", "jti"} signed with secret_env; max_link_ttl_s (300), session_ttl_s, one_time; the link's vars are locked (URL / panel requests can't change them), the session reads only that dashboard |
api_keys | scripts, server-to-server | Authorization: Bearer afx_<id>_<secret>; the file holds SHA-256 hashes, is re-read on change (revocation without restart); serve api-key new --file keys.json --user svc-etl --groups etl --claim tenant=acme --dashboards sales --expires-days 90 prints the key once; serve api-key revoke --file keys.json --id <id>, serve api-key list --file keys.json |
Rules the server enforces: exactly one credential per request (an invalid one is 401, never skipped); a broken auth (unknown key, short or reused secret, http:// issuer, HS* / none algorithm) fails the start — no fallback to anonymous. Prefer *_env (an environment variable name) over a literal secret in SQL. An e-mail identity needs email_verified: true. Cookies are Secure: serve over HTTPS (TLS at the reverse proxy). GET /healthz without a login answers {"status":"ok"} only.
Proxy mode: the proxy must set or remove every configured identity header on every request (never pass the client's through) and be the only way to the server; tested nginx / Caddy / oauth2-proxy recipes are in docs/secure-serving.md → Proxy recipes.
Every method sets, after the viewer's own variables:
| Variable | Type |
|---|---|
getvariable('__claim_user') | VARCHAR |
getvariable('__claim_groups') | VARCHAR[] ([] if none) |
getvariable('__claim_<name>') | VARCHAR (NULL if absent) |
-- rows of the viewer's regions; the 'admins' group sees all
SELECT region::XAXIS, sum(revenue)::BARCHART, 'Revenue in your regions'::TITLE FROM orders
WHERE region IN (SELECT region FROM entitlements WHERE viewer = getvariable('__claim_user'))
OR list_contains(getvariable('__claim_groups'), 'admins')
GROUP BY ALL ORDER BY 2 DESC;
__claim_*, never on a viewer variable (inputs, ?v.*, selected can hold any value). Viewers can never set __claim_* or anofox_data (400 / ignored).-- @vars region, channel, selected in a dashboard's header limits the variables a viewer may set (others are dropped). List its inputs, named selections and selected.auth the claims are NULL, so claim-filtered panels return no rows (not every row).options.state (::SUBMIT, #517)options.state (serving skill) — per-viewer, append-only answers — reuses
these same identities, with one extra rule: only a personal sign-in may
submit. An API key and an embed link opened without its own user (a
shared identity, embed:<id>) are refused 403 "submissions need a personal sign-in" even though both can read dashboards fine — a submission
needs one accountable person behind it, not "whoever holds this link/key
today". A credential-locked variable (an embed link's own vars, a claim
mapped onto a variable) is recorded as the locked value, never the viewer's
own pick — list-valued (::MULTISELECT) exactly like scalar. The audit log
(below) gets a submit event the same way it gets login/auth ones,
never the answers themselves.
policy)With auth the server refuses to start without a policy (options.policy, or policy.json in the dashboard folder) unless "policy": "none" says the panels filter themselves. A policy moves the rule out of the panels: every table reference is rewritten to a per-viewer view.
{
"tables": {
"sales": {"rows": "region IN (SELECT region FROM entitlements WHERE viewer = getvariable('__claim_user')) OR list_contains(getvariable('__claim_groups'), 'admins')"},
"employees": {
"rows": "getvariable('__claim_tenant') = tenant",
"columns": {
"salary": {"allow_groups": ["hr"], "else": "null"},
"email": {"allow_groups": ["hr", "support"], "else": "mask"},
"name": {"allow_groups": ["hr"], "else": "hash"},
"ssn": "deny"
}
},
"ref.regions": {"rows": true}
},
"table_functions": ["read_parquet"]
}
| Key | Meaning |
|---|---|
tables.<t>.rows | required: one SQL condition over the table's columns, reading the viewer only via getvariable('__claim_…'); true = every row |
tables.<t>.columns | deny (column gone), null, mask ('****'), hash (HMAC, joins / count(DISTINCT) still work); or {"allow_groups": […], "allow_users": […], "else": …} |
table_functions | file readers dashboards may call (off by default; files have no row policy) |
functions | extra reviewed scalar / aggregate functions (an extension's) |
Server option "policy_key_env": "ANOFOX_POLICY_KEY" keeps hash values stable across restarts. Keep the policy file outside the dashboard folder when dashboard authors must not decide who sees what.
Fail closed — a dashboard statement that would get around the views stops the start: a table without a rule (including information_schema, a file path, a view over other tables), a database-qualified name, query() / query_table() / catalog table functions, a user macro, a function not on the reviewed allowlist (current_setting, json_serialize_plan, getenv, …), time travel, and any statement other than a query, CREATE TEMP TABLE|VIEW … AS <query> or SET VARIABLE. CTEs, subqueries, joins, set operations, PIVOT in FROM and the dashboard's own temp tables work. Under a policy viewers see a generic panel error; the detail goes to the server log.
Lint before serving (uses the server's classifier):
dashboard --check dash.sql --db snapshot.duckdb --policy policy.json
policy/refused (the server would not start), policy/denied-column (some viewers can't see a column the panel uses; an error when nobody can), policy/masked-column (note), policy/input-options-restricted (an input's options come from a row-filtered table, but panels on unrestricted tables read its variable: their numbers silently differ per viewer — take the options from the unrestricted table), policy/invalid, policy/duckdb-version (the duckdb on PATH is not the pinned 1.5.6).
"log" (serve --log): JSON lines per page view, panel request and refusal — user, status, ms, cache (hit / shared / run), deny reason; log_vars: names (default), values (may be personal data — opt in), none."audit" (serve --audit): logins, logouts, embed exchanges, refused credentials with their reason, API key changes. Tokens, keys, cookies and secrets are never logged. Both files are 0600, rotate by rename.serve --dashboards --auth … has none: every panel must filter on the claims itself.exp: mint per page view, keep max_link_ttl_s at minutes; one_time is per server process.revocation_file, a logout is per replica and forgotten on restart; keep session_ttl_s short.hash is pseudonymisation, not encryption. Column rules decide by user and group only; other claims drive row filters.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
anofox-visualization, row-level-security, oidc, jwt, embed, api-keys
5 skills in this plugin
/anofox-visualization-chartsSQL to SVG with the anofox_visualization DuckDB extension: the anofox_render(spec) scalar (rows + ::ROLE annotations as JSON, width / height, brand colour, category cap, line downsampling), the column macros anofox_bar, anofox_line, anofox_scatter, anofox_area, anofox_xy(x, y, kind :=) and anofox_xyc(x, y, series, kind :=), which chart kinds `kind :=` accepts (bar, stacked / percent bars, line, area, step, scatter, bubble, jitter, histogram, density, boxplot, violin, QQ, pie, donut, radar, sparkline, heatmap, calendar), one SVG per GROUP BY group, saving the SVG to a file, the error messages, and the community (render-only) build versus the full-toolkit C-API build (a GitHub release or from source: render + serving). Use when the user wants "a chart from this query", "render an SVG in DuckDB", "plot these columns", "a bar / line / scatter chart in SQL", asks what anofox_render expects, how to install or load anofox_visualization, or why a chart call fails. For model output tables (coefficients, residuals, ROC, forecasts) see the statistics-plots skill; for ::ROLE dashboards the dashboards skill.
/anofox-visualization-dashboardsBuild an interactive SQL dashboard with anofox-visualization from a plain-text request (the build-dashboard workflow). Use when the user asks to "build / make / create a dashboard", "visualize this data", "turn this query into a dashboard", "explore this table", or describes the charts, KPIs, tables, filters or a process diagram they want. Covers the ::ROLE cast model (each annotated SELECT is a panel, unannotated statements are setup), every role of the registry (charts, waterfall / bullet / funnel, heatmaps, maps, intervals, facets, nested forecast fans, ::MARKAREA, ::TRACK strips, event annotations, thresholds), KPI tiles with delta, sparkline and goal, ::PERIOD comparisons, inputs (dropdown, multiselect, ::BUTTONS, ::TOGGLE, dates) bound to getvariable(), cross-filter, ::SELECT_AS, ::DRILL / ::LINK drill-down and drill-through, URL state, ::ROWSELECT tables (toolbar, ::TOTALS, ::COLGROUP, ::FLAG, ::HIGHLIGHT, ::SUBTOTAL, ::TOOLBAR, ::PAGED), ::DIAGRAM pipelines / lineage / process flows (::UPSTREAM, ::EDGES, ::LANE, flow styles), motion (::ANIMATE, ::STORY, ::TRANSITION, ::LINESTYLE 'flow'), Markdown with {{col:fmt}} values and $LaTeX$, ::INFO / ::CALLOUT, ::IMAGE / ::IMAGE_DARK / ::ALT and Markdown  images, ::ASOF, ::EMPTY / -- @requires panel states, ::SHOW_IF conditional panels and boxes, layout, themes / branding / locale, anofox_plot_* contract plots as panels, the Explore data page, the `dashboard --describe` / `--check` generate-validate-repair loop with its lint codes, the design contract and the gotchas that silently break a panel.
npx claudepluginhub datazoode/anofox-visualization --plugin anofox-visualizationOther plugins' skills for the same job