Skip to content

Revoke PUBLIC and anon EXECUTE on internal schema helpers #469

Closed

Description

@HMarzban

Summary

Revoke EXECUTE from PUBLIC and anon on the internal schema helpers that no anon policy needs.

Fix

  1. List every function in internal and its callers: pg_policies qual and with_check, storage policies, and invoker bodies that clients reach.
  2. Keep anon EXECUTE only on internal.can_open_document. Keep authenticated only where an authenticated policy calls the function. Grant service_role where a server path calls it.
  3. Revoke the rest from public, anon, authenticated, in the owning scripts and in one new migration. Regenerate seed.sql.
  4. Prove a fresh reset: anon reads a public chat; the owner reads a Private chat; a signed-in send works.

Acceptance

  • Each kept grant names its policy or caller in the PR.
  • has_function_privilege for anon is false on every internal function except can_open_document.
  • The migration is applied to prod, with a read-only check posted here.

Activity

  1. added
    SecuritySecurity, access control, and data exposure
    on Oct 9, 2026
  2. HMarzban commented on Oct 15, 2026

    @HMarzban
    CollaboratorAuthor

    Related issues


    Cross-link review, 2026-10-15. Generated by Claude Code

  3. added this to the v2.2.0 milestone on Oct 18, 2026
  4. HMarzban commented on Oct 19, 2026

    @HMarzban
    CollaboratorAuthor

    Prod check after the 2026-10-19 db push (read-only)

    Migration 20261014121000_revoke_internal_helper_execute is applied on prod.

    Anon can execute exactly one internal function:

    internal.can_open_document(character varying,uuid)
    

    has_function_privilege('anon', …, 'EXECUTE') is false on every other internal function. The post-push guard (check-grants.sql) shows no definer_exec row. Each kept grant is named in packages/supabase/CLAUDE.md (#469 bullet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SecuritySecurity, access control, and data exposure

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions