Repository navigation
feat: add policy_function_not_executable lint (0031) - #198
Open
mattmuller wants to merge 1 commit into
Open
mattmuller wants to merge 1 commit into
mattmuller wants to merge 1 commit into
Conversation
|
Hi, a gentle nudge on this and its three siblings (#199, #200, #201). Their checks were never approved to run (first-time contributor), and GitHub marked them failed today after waiting a month. Could a maintainer approve the workflows when you have a moment? I'm happy to rebase all four and renumber after whichever lands first. #197 also uses 0031, so if that merges first I'll move these to 0032 to 0035. If you'd prefer them as one PR, I can combine them. |
Author
|
Thanks, you're right: #214 took 0031 and 0032, so my 0032 to 0035 plan is
out of date. I agree numbers should be given at merge time. Until a
maintainer picks one, I'll leave all four as they are. When one is
approved, I'll rebase it and use whatever number is free hopefully that
same day.
…On Sun, Nov 22, 2026 06:43 AM, Vishv ***@***.***> wrote:
*Vishv07* left a comment (supabase/splinter#198)
<#198 (comment)>
Thanks for the nudge, and for offering to rebase all four.
One correction: the renumbering target has moved since you wrote this.
#214 <#214> merged on 11-17 and
took both 0031 and 0032, so 0032 to 0035 is no longer free. Main is now
0001 to 0032, and 0033 is claimed by both #200
<#200> and #216
<#216>.
Merged lints have now invalidated pending numbers twice (#184
<#184> took 0030 from #169
<#169> in September). Would a
maintainer be willing to allocate the number at merge time instead?
—
Reply to this email directly, view it on GitHub
<#198?email_source=notifications&email_token=AABB3DTHTTC4SXO6VRTRSNT52KDH7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBXGU2DQNJWGQ32M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-7075485647>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABB3DW5ZWW5O3P4M6PUVQD52KDH7AVCNFSNUABFKJSXA33TNF2G64TZHM3TKNBXHE3TEMZQHNEXG43VMU5TKOBRGE3TSNBUG44KC5QC>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
New ERROR-level lint
0031_policy_function_not_executable.What is the current behavior?
Nothing flags an RLS policy that calls a function the policy's role cannot execute. A policy expression is evaluated with the privileges of the querying role, not the policy owner. If that role has no
EXECUTEon a function inUSING/WITH CHECK, every statement the policy applies to fails withpermission denied for function. It is a hard error, not a filtered row.This is easy to cause when hardening function grants. Searching application code or other function bodies does not find policy callers, and
pg_get_functiondefdoes not show them.What is the new behavior?
The lint reads each policy's function dependencies from
pg_depend(classid = pg_policy,refclassid = pg_proc,deptype = 'n') and reports every (policy, function, role) wherehas_function_privilege(role, function, 'EXECUTE')is false.TOnamed roles checks those roles. A policy with noTOclause applies toPUBLIC, which is expanded toanonandauthenticated.has_function_privilegealready accounts forPUBLICgrants, role inheritance and ownership.pg_dependrow, so they are never reported. System schemas use the repo's standard exclusion list.pgrst.db_schemas: the failure happens for any querying role, not only through the Data API.Minimal repro:
Additional context
Related. #196 / #197 propose
policy_without_privilege, which covers a missing table privilege. This lint covers a missing functionEXECUTEprivilege, so the two do not overlap. #197 also claims number0031; I am happy to renumber whichever lands second.How it was tested
test/sql/0031_policy_function_not_executable.sql:PUBLICexecute;PUBLICrevoked butauthenticatedgranted; execute revoked but RLS disabled.PUBLIC, policyTO authenticated(1 row); policy with noTOclause calling the function inWITH CHECK(2 rows:anon,authenticated).EXECUTEback returns 0 rows.Full suite (
docker compose -f dockerfiles/docker-compose.yml run test, including thesplinter.sqlvalidity check) passes onsupabase/postgres15.14.1.169 and 17.6.1.169.bin/check_lints.pypasses.False-positive risk. Low. The lint only fires when Postgres itself would raise a permission error for a role named in the policy. The main residual case is a policy that names a role that never connects.