Skip to content

Remove anon default table privileges on production #470

Closed

Description

@HMarzban

Summary

Production never ran 29-lint-hardening.sql §3, so anon still holds default table privileges on production tables outside the 2026-09-28 hand fix. #316 covers only objects created in the future.

Fix

  1. Read-only on prod: list every table in public where anon has INSERT, UPDATE, DELETE or TRUNCATE, and every table with relrowsecurity = false.
  2. Write one migration that revokes anon writes everywhere except where a policy needs them. Keep the anon SELECT allowlist from §6 and §7.
  3. Mirror it in the scripts, and regenerate seed.sql.

Acceptance

  • The read-only listing is posted here before and after.
  • No anon write privilege remains on a table without a policy that needs it.

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 20261014121200_revoke_anon_default_table_privileges is applied on prod.

    After: check-grants.sql shows no anon_write row and no anon_read_not_allowed row. Anon reads only the allowlisted tables, and it writes to no table in public.

    Before: no listing was posted here before the push, and it cannot be taken now. The earlier prod state is in the 2026-09-28 review on #327.

    What remains: the default privileges for new objects (pg_default_acl) still grant anon on public. That is #316, by design, and check-grants.sql expects those default_acl_anon rows until #316 lands.

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