Skip to content

docs(0006): clarify multiple permissive policies example and fix logic bug#155

Open
SAY-5 wants to merge 1 commit intosupabase:mainfrom
SAY-5:fix/0006-policy-doc-clarity-and-correctness
Open

docs(0006): clarify multiple permissive policies example and fix logic bug#155
SAY-5 wants to merge 1 commit intosupabase:mainfrom
SAY-5:fix/0006-policy-doc-clarity-and-correctness

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented Apr 15, 2026

Per supabase/supabase#44600, the 'How to Resolve' section of the 0006_multiple_permissive_policies lint has prose that doesn't match the SQL, a typo, and a 'consolidated' policy that doesn't actually fix the bug it's supposed to fix.

Changes

  1. Policy B description was 'at or above a certain grade level', but the SQL uses grade_level <= current_user_grade_level(). Match the prose to the code: 'at or below the current user's grade level.'

  2. Stated intention was 'below the querying user's grade level' even though the example uses <=. Updated to 'at or below'.

  3. Typo: 'departemnt' → 'department'.

  4. Added clarity to the failure-mode paragraph — 'regardless of grade level' / 'regardless of department' so readers can see why the original setup is wrong, and an explicit note that the rows that come through are the ones satisfying at least one policy (OR semantics), not both.

  5. The 'consolidated' policy still contained the original bug — it used OR and >=, which is the same broken semantics in different syntax. Replaced with AND grade_level <= current_user_grade_level() so the policy actually implements the stated intention.

Closes supabase/supabase#44600

…c bug

Per supabase/supabase#44600, the 'How to Resolve' section of the
`0006_multiple_permissive_policies` lint had several issues:

1. Policy B was described as 'at or above a certain grade level' even
   though the SQL uses `grade_level <= current_user_grade_level()`.
   Match the prose to the code: 'at or below the current user's
   grade level.'

2. The intention was described as 'below the querying user's grade
   level' but the SQL uses `<=`. Update to 'at or below'.

3. Typo: 'departemnt' → 'department'.

4. Add 'regardless of grade level' / 'regardless of department' to
   make the failure mode explicit, and clarify that rows are returned
   when *at least one* policy passes (OR semantics).

5. The 'consolidated' policy still had the original bug — it used
   `OR` and `>=`, which doesn't restrict access at all. Replace
   with `AND` and `<=` so the policy actually implements the stated
   intention.
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.

0006 multiple permissive policies - Increase clarity of example, correct final example code

1 participant