Skip to content

Revoke PUBLIC and anon EXECUTE on internal schema helpers #469

Open

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
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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions