Skip to content

Views with security_invoker are being migrated without this option #3487

Closed as duplicate

Description

@luizzappa

Bug report

  • [ X ] I confirm this is a bug with Supabase, not with my own application.
  • [ X ] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When creating a view remotely (supabase.com) with the security_invoker = true option, migrations to be applied locally do not come with this option.

To Reproduce

  1. Create a view remotely (supabase.com)
CREATE VIEW test_security WITH (security_invoker) as SELECT 2 as value;
  1. Locally pull migrations
supabase db pull
  1. Note that migrations do not come with the security invoker = true option
+ create or replace view "public"."test_security" as  SELECT 2 AS value;
- create or replace view "public"."test_security" WITH ("security_invoker"='true') as  SELECT 2 AS value;

Expected behavior

The migration should go like this:

create or replace view "public"."test_security" WITH ("security_invoker"='true') as  SELECT 2 AS value;

System information

  • OS: Windows
  • Version of supabase-js: 2.39.3
  • Version of Node.js: v18.18.2

Activity

  1. added
    bug
    on Feb 14, 2024
  2. igorlanko commented on Apr 9, 2024

    @igorlanko

    Thanks for reporting this, I just uncovered this myself too, unfortunately.

    I think you summed it up really well, but just a few additional (maybe obvious) details about the issue:

    • the with (security_invoker) argument is missing in the schema of the view in the Supabase UI too;
    • neither the auto migration supabase db diff -f includes that in the migration script, nor does it detect it as a change to the view if modified from the Supabase's SQL editor.

    Update: there's also actually a related discussion over here https://github.com/orgs/supabase/discussions/901#discussioncomment-6517175.

  3. Hallidayo commented on Feb 23, 2025

    @Hallidayo
    Collaborator

    Hi all, Just checking in here are you still experiencing this?

  4. moved this to Waiting on feeedback in Open Source Maintainerson Feb 23, 2025
  5. FrostedBiscuit commented on Feb 24, 2025

    @FrostedBiscuit

    Hi @Hallidayo this is in fact still an issue. Not a big deal to manually change the migration after it gets generated but it'd be much more convenient if the view's permissions were included by default.

  6. transferred this issue fromsupabase/supabaseon Apr 25, 2025
  7. Hallidayo commented on Apr 25, 2025

    @Hallidayo
    Collaborator

    Transferred from the supabase repo.

  8. sweatybridge commented on Apr 27, 2025

    @sweatybridge
    Contributor

    closing as duplicate

  9. moved this from Waiting on feeedback to Done in Open Source Maintainerson Apr 27, 2025
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

    bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions