Proposal update to make it where Supabase rule 0029 will skip functions whose body matches a reasonable "gated" heuristic - e.g. contains a check on 'auth.uid( )', 'has_role', 'is_admin', or equivalent.
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng việc xác định phần triển khai và các bài kiểm thử cho rule 0029_authenticated_security_definer_function_executable; payload không nêu các tệp cụ thể. So sánh các đề xuất về heuristic, SQL comment opt-out và config allowlist, sau đó xác nhận maintainers muốn đi theo hướng nào trước khi coding. Được xem là hoàn tất khi behavior suppression đã chọn được triển khai và được kiểm thử, mà không che giấu các function thực sự không an toàn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Title
0029: allow opt-in suppression for SECURITY DEFINER functions that self-gate the caller
Body
Summary
Rule 0029_authenticated_security_definer_function_executable flags every SECURITY DEFINER function in the exposed API schema that is executable by authenticated. In codebases that legitimately rely on definer RPCs for cross-user reads, RPC-only tables, and rate-limit counters, this produces a large number of warnings that cannot be resolved without either (a) removing DEFINER and breaking the RPC's purpose, or (b) revoking EXECUTE from authenticated and moving the call off the Data API.
Both options are unattractive for the common pattern where a definer function is the gate:
CREATE OR REPLACE FUNCTION public.mp_end_room_v2(p_game_id uuid, p_reason text)
RETURNS void LANGUAGE plpgsql SECURITY DEFINER
SET search_path = 'public' AS $$
DECLARE v_uid uuid := auth.uid();
BEGIN
IF v_uid IS NULL THEN RETURN; END IF;
-- ...participant check against mp_games...
UPDATE public.mp_games SET status = 'ended' WHERE id = p_game_id
AND (host_user_id = v_uid OR guest_user_id = v_uid);
END $$;
This function needs DEFINER because it mutates the opponent's row in mp_games; it self-gates via auth.uid() and a participant check. There is no safe alternative: SECURITY INVOKER would fail RLS, and revoking EXECUTE FROM authenticated would make the game unplayable.
Concrete data point
In a game project with ~40 definer RPCs (matchmaking, chat, ranked Elo, spectator flow), rule 0029 flags 33+ functions. After a manual audit, all 33 were confirmed as intentionally-gated definers. The signal-to-noise ratio for this rule in that codebase is effectively 0%.
Proposals (any one would help)
Option A — Heuristic: Skip functions whose body references any of auth.uid(), auth.jwt(), public.has_role(, is_admin(, or RAISE EXCEPTION within the first N statements. False positives are still possible, but the rule stops firing on the common "check-then-act" pattern.
Option B — Explicit opt-out via COMMENT: Skip functions whose Postgres comment matches a marker such as lint:0029-safe. Example:
COMMENT ON FUNCTION public.mp_end_room_v2(uuid, text)
IS 'lint:0029-safe — participant check via auth.uid() inside body';
This is the same escape-hatch pattern many linters use (# noqa, // eslint-disable) and gives auditors a searchable marker in the source.
Option C — Config-driven allowlist: Support a project-level allowlist (e.g. an entry in supabase/config.toml or a magic table public._splinter_ignore) that lists function names to skip.
Option B is the least invasive and the most auditable. Option A alone would already remove most noise.
Why this matters
Right now, teams doing the right thing (definer RPCs for privileged writes, self-gated with auth.uid()) are indistinguishable in the linter output from teams that accidentally left a definer function exposed. That creates alert fatigue on 0029 and pushes teams toward either ignoring the whole rule or maintaining out-of-band allowlists. Any of the three options above would let 0029 flag only the risky definers, which is what the rule was intended to catch.
Happy to contribute a PR for option B if there's interest.
- Ngôn ngữ chính
- PLpgSQL
- Star
- 284
- Fork
- 110
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của supabase/splinter
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
supabase/splinter#206 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
0002_auth_users_exposed false positive: pg_depend join lacks a refclassid filter (cross-catalog OID collision)Có thể đã có người làm @tushardev-365 đã nhận 96 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 40/100
supabase/splinter#210 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
0030_autovacuum_disabled misses tables where autovacuum_enabled is set to off, 0 or noCó thể đã có người làm @RaphaelFakhri đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Proposal: lint for RLS policies whose role lacks the table privilege (policy_without_privilege)Có thể đã có người làm @larik15 đã nhận 28 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 1/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của supabase/splinter
Issue tương tự
-
Lint rule GV016 order-by-randomCó thể đã có người làm @YinL-k đã nhận hôm nay. Đang mởenhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
laaielichter/Gulliver#20 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
database documentation from-review-extraction severity:nit
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
LearningCircuit/local-deep-research#8217 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
"Sync columns from source" fails on ClickHouse tables with ALIAS, MATERIALIZED or DEFAULT columnsCó thể đã có người làm @bmuraykhi đã nhận hôm nay. Đang mở#bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bazel bug odb
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
The-OpenROAD-Project/OpenROAD#12095 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ClickHouse/clickhouse-go#2093 ·
Maintainer thường phản hồi trong vòng 1 ngày