Advisors
Security and performance checks on your schema, each with what is wrong, where, and the SQL that fixes it.
The advisors check your schema for security and performance problems, like Supabase's database linter (Security Advisor and Performance Advisor). Each problem found is a lint: what is wrong, where, and SQL that fixes it.
curl "$FORKBASE/platform/v1/advisors?type=security" -H "apikey: $SERVICE_KEY" -H "Authorization: Bearer $SERVICE_KEY"The dashboard's Advisors page shows both lists; each lint opens to its detail and the SQL. The number beside Advisors in the sidebar is the security advisor's errors and warnings.
The API
GET /platform/v1/advisors?type=security|performance (no type, or all, gives both). Also
GET /platform/v1/advisors/security and /platform/v1/advisors/performance. The service key, or any
team member.
{
"type": "security",
"mode": "postgres",
"counts": { "error": 1, "warn": 2, "info": 0 },
"lints": [
{
"name": "rls_disabled_in_public",
"title": "RLS disabled in a served schema",
"level": "ERROR",
"facing": "EXTERNAL",
"categories": ["SECURITY"],
"description": "A table the API serves is open to anon or authenticated, and row-level security is off, so every row is.",
"detail": "Table public.notes is served by the API and granted to anon (select, insert), with row-level security off: they reach every row.",
"remediation": "Enable row-level security on the table, then add a policy for each role and action.",
"remediation_sql": "alter table public.notes enable row level security;\n...",
"metadata": { "schema": "public", "name": "notes", "type": "table" },
"cache_key": "rls_disabled_in_public_public_notes"
}
],
"skipped": []
}The lint fields are Supabase's; remediation is a sentence rather than a link, and remediation_sql is Forkbase's:
SQL that fixes the problem, or a starting point with <placeholders> to fill in. Read it before you run it in the
SQL editor. Lints come errors first.
skipped lists the checks that couldn't run, each {name, title, reason}: a catalog view the database doesn't
have. On Postgres 16 and on the Chronos engine 0.9.3 every check runs; an older engine may lack one, and the lints
that need it are skipped and named there instead of failing the whole answer.
Security
The security lints look at the served schemas (rest.schemas, public by default) unless said otherwise. A table only
the service key reaches (no grant to anon or authenticated) is not open to the API, so the lints about the API's
roles leave it alone: in Forkbase, unlike Supabase, tables are not granted to anon and authenticated until you
grant them.
| Name | Level | Found when |
|---|---|---|
forkbase_schema_exposed | ERROR | one of Forkbase's own schemas (vault, vectors, chat, evals, ...) is in rest.schemas |
rls_disabled_in_public | ERROR | a table is granted to anon or authenticated and row-level security is off |
policy_exists_rls_disabled | ERROR | a table has policies but row-level security is off (any of your schemas) |
security_definer_view | ERROR | a view anon or authenticated can read runs as its owner (no security_invoker = true), skipping the row-level security of what it reads |
secret_in_function_body | ERROR | a function's source holds what looks like a key: Stripe, OpenAI, Anthropic, GitHub, Slack, Google, AWS, a private key, a service_role JWT, a Forkbase member key (any of your schemas). The key itself is never shown. |
rls_policy_always_true | WARN | a permissive policy for anon or public allows inserts, updates or deletes with true (any of your schemas) |
anon_write_grants | WARN, INFO | anon has insert, update or delete on a table or view; INFO when the table has row-level security on, so its policies decide |
materialized_view_in_api | WARN | anon or authenticated can read a materialized view (they have no row-level security) |
security_definer_function | WARN | anon or authenticated can call a security definer function (every role can, unless you revoke it from public) |
function_search_path_mutable | WARN | a function doesn't set its own search_path (any of your schemas) |
rls_enabled_no_policy | INFO | row-level security is on and there is no policy: the API's roles see no rows (fine for a table only the service key uses) |
Performance
The performance lints look at all your schemas: every schema but the system's and Forkbase's own.
| Name | Level | Found when |
|---|---|---|
duplicate_index | WARN | two indexes on a table are the same but for their names; all but one are listed |
auth_rls_initplan | WARN | a policy calls auth.uid(), auth.jwt(), auth.role() or current_setting() directly, so once per row: wrap it, (select auth.uid()). The SQL rewrites the policy for the auth.* calls. |
multiple_permissive_policies | WARN | more than one permissive policy applies to one role and action on a table (for all counts for each action) |
unindexed_foreign_keys | INFO | no index starts with a foreign key's columns |
unused_index | INFO | an index that is not a primary key or unique has never been scanned, by pg_stat_user_indexes. Postgres counts since its statistics were last reset; the Chronos engine counts since it last started, so check after the app has run its usual load. |
no_primary_key | INFO | a table has no primary key |
Forkbase's own schemas (auth, storage, vault, agents, jobs, ...) are never linted: they are Forkbase's to keep
right, and are not served.
Something wrong or missing? Edit this page on GitHub or open an issue.