Security definer views should be allowed in certain conditions
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
- 38/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện bản phác thảo SQL trong PostgreSQL và kiểm tra cách linter hiện gắn cờ các security definer views. So sánh các điều kiện security_barrier và SELECT-only grant được đề xuất với hành vi hiện có; được xem là hoàn tất khi các qualifying views được cho phép hoặc hạ xuống thành cảnh báo có thể bỏ qua mà không cho phép các mutation 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ả
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
"security definer" views are flagged as an error.
There are cases where RLS is not the right tool for the job, such as where the per-row checks are very expensive, or where certain columns should not be shown to the user. Postgres has two features I can think of that are helpful here:
- A view with security_invoker=true that calls a security definer function
- A view wth secuity_invoker=false, secuirty_barrier=true
This is touched on in #98, but the discussion focussed on dismissing the error.
I believe the correct behaviour is to allow security definer views if the following conditions are met:
- security_barrier=true – this prevents predicate injection
- grant is limited to select operation only – this prevents mutating the base table if the view is a simple view
Given the intention is to take away footguns from the user base, a warning that could be dismissed also seems fine.
Sketch
To verify the behaviour:
create schema app;
create table app.test (
id uuid primary key default gen_random_uuid(),
slug text unique
);
-- optionally
-- alter table app.test enable row level security;
create view app.test_v as select * from app.test;
create role app_user;
grant app_user to postgres;
revoke all privileges on app.test from app_user;
revoke all privileges on app.test_v from app_user;
-- if RLS is enabled
-- grant select on app.test
grant select on app.test_v to app_user;
grant usage on schema app to app_user;
-- security vulnerability (simple views only)
-- grant insert, update, delete on app.text_v to app.user;
set role app_user;
select * from app.test; -- ERROR: permission denied for table test
select * from app.test_v; -- rows
insert into app.test_v (slug) values ('hello'); -- ERROR: permission denied for view test_v
reset role;
- 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