Skip to content

Conversation

kangmingtay
Copy link
Member

@kangmingtay kangmingtay commented Apr 3, 2024

What kind of change does this PR introduce?

  • adds a lint to check if there are any policies that allow access to anonymous users

What is the current behavior?

  • currently, if a user enables anonymous sign-ins for their project, they need to manually check existing RLS policies to see if any of them are compromised.

What is the new behavior?

  • this lint will highlight any policies that:
    • are associated to the authenticated, public, or any other role members
    • policies that don't contain the auth.jwt()->>'is_anonymous' expression in the policy definition

Additional context

Add any other context or screenshots.

@kangmingtay kangmingtay force-pushed the km/add-lint-for-anonymous-users branch from 92fd399 to 172f6f2 Compare April 3, 2024 08:11
@kangmingtay kangmingtay force-pushed the km/add-lint-for-anonymous-users branch from f20e755 to 32a0738 Compare April 3, 2024 08:26
@olirice olirice self-requested a review April 3, 2024 13:09
Copy link
Collaborator

@olirice olirice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to check if a user has enabled anonymous logins from within the database? Currently this lint will fire on almost every project and only a small fraction are likely to enable anonymous logins in the short term.

@kangmingtay kangmingtay requested a review from olirice April 4, 2024 07:08
Copy link
Collaborator

@olirice olirice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we can merge this we need to get the FE integration updated to not run all lints by default.

Terry is back tomorrow and I'll discuss it with him then but this might get pushed out til the week after LW as everyone is starting to get crunched

'INFO' as level,
'EXTERNAL' as facing,
'Detects row level security (RLS) policies that allow access to anonymous users.' as description,
'https://supabase.github.io/splinter/0012_auth_allow_anonymous_sign_ins' as remediation,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change this to a main docs site link please? Following the pattern here: https://supabase.com/docs/guides/database/database-advisors

@kangmingtay
Copy link
Member Author

blocked on deciding how we can run lints conditionally on the platform - currently, there's no way to conditionally execute a lint from the splinter.sql file

Copy link

@MostafaGoodsh MostafaGoodsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool

@kimsoo527

This comment was marked as abuse.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.