DB 접근 규칙 미설정 (Supabase RLS·Firebase 규칙)
치명VS-OPEN-ACCESS · OWASP A01 Broken Access Control · CWE-862Supabase 테이블에 RLS 를 켜지 않거나 using (true) 정책을 두면, 또는 Firebase 규칙을 if true·테스트 모드로 두면 브라우저에 공개된 키만으로 누구나 전체 데이터를 읽고 고칠 수 있습니다.
위험 시나리오
앱 번들에 들어 있는 Supabase anon 키나 Firebase 설정으로 REST API 를 직접 호출해 다른 사용자의 개인정보를 내려받고, 데이터를 바꾸거나 지웁니다. 화면에서 막아 둔 기능도 DB 규칙이 열려 있으면 소용없습니다.
취약한 코드
create table public.profiles (id uuid primary key, email text, phone text); -- RLS 미설정
create policy "anyone can update" on posts for update using (true);// firestore.rules
match /{document=**} { allow read, write: if true; }
match /{document=**} { allow read, write: if request.time < timestamp.date(2026, 12, 1); } // 테스트 모드안전한 코드
alter table public.profiles enable row level security;
create policy "본인 프로필만 조회" on profiles for select to authenticated using ((select auth.uid()) = id);
create policy "본인 글만 수정" on posts for update to authenticated using ((select auth.uid()) = user_id);// firestore.rules
match /users/{userId} { allow read, write: if request.auth != null && request.auth.uid == userId; }체크리스트
- Supabase 의 public 스키마 테이블은 만들 때 바로
enable row level security를 켠다. - 수정·삭제 정책은
using (true)대신 행 소유자 조건(auth.uid() = user_id)으로 좁힌다. - Firebase 는
if true·테스트 모드(request.time <) 규칙을 배포하지 않고,request.auth.uid로 본인 데이터만 허용한다. request.auth != null만으로는 "로그인한 아무나" 모든 데이터에 접근할 수 있다.- Realtime Database 는 루트의
.read·.write를true로 두지 않는다 (아래 경로 전체에 적용된다).