fix: 신고 즉시 알림 트리거 + 시크릿 상수시간 비교 공용화 + 리미터 fail-open 알림 - #195
Merged
Merged
Conversation
외부 리뷰 후속 조치 묶음 (0031/0032 미조치 3건):
1. 신고 접수 즉시 관리자 알림 (약관 §12③ 24시간 약속의 이행 장치)
- reports INSERT 트리거 → app.ops_alarm_fire('report:new', 30분 쿨다운)
- 지금까지 신고 관측은 주간 스윕뿐 — 최악 7일 지연이었다
- 운영 적용 완료(20260831061325), 롤백 트랜잭션으로 실증(알람 1·관리자 알림 1)
2. 시크릿 비교 secretEq 공용 승격 (_shared/auth.ts)
- send-push·purge-business-docs 가 !== 로 비교 — 타이밍이 일치 길이를 누설
- sync-facilities 에만 있던 상수시간 비교를 셋이 공유 — 한 곳만 안전한
'부분 적용'(0032 §1) 해소
3. 레이트리밋 fail-open 을 무알림에서 관측 가능으로 (0031 §3.5)
- rate_limit_hit 실패 시 alertAdmins — 상한이 조용히 풀린 상태의 지속을 알림
- 알림 스로틀 자신도 같은 RPC 라 아이솔레이트 시계로 10분 1회 추가 조임
부수: README 배포 절 정정 — 경고 아래 그대로 남아 있던 'supabase db push' 예시
제거(경고와 예시가 싸우면 예시가 이긴다), 함수 배포는 CI 정본 명시, 스키마 규모
표를 0016 시점/현재(실측) 2열로.
검증: deno check 오류 1(래칫 상한 1, 잔존분), pgTAP 전체 통과, dump_schema.sh 갱신.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
배포 함수 전수 대조(2026-08-31)에서 문서 전체에 언급이 없는 함수는 sync-facilities 하나였다. 보충 표에 추가하고, '위 표는 N개' 식의 산술은 표가 바뀔 때마다 어긋나므로 배포 총수(실측)만 남긴다. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2 tasks
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.
외부 리뷰 후속 조치 묶음 — 0031/0032 미조치 항목 3건.
1. 신고 접수 즉시 관리자 알림 (약관 §12③ 이행 장치)
reportsINSERT 트리거 →app.ops_alarm_fire('report:new', 30분 쿨다운)→ ops_alarms 기록 + 활성 관리자 전원 알림(기존 푸시 파이프라인 재사용).20260831061325), 롤백 트랜잭션 실증: 신고 INSERT → 알람 1행 + 관리자 알림 1건 확인 후 롤백.2. 시크릿 비교 상수시간 공용화
send-push·purge-business-docs가!==비교 — 첫 불일치 바이트에서 끝나 응답 시간이 누설.sync-facilities에만 있던secretEq를_shared/auth.ts로 승격, 세 함수가 공유. 한 곳만 안전한 '부분 적용'(0032 §1)의 정확한 사례였다.3. 레이트리밋 fail-open 무알림 해소 (0031 §3.5)
rateLimited()의 리미터 오류 fail-open 은 유지(가용성)하되, 그 순간부터 모든 상한(OTP 대입·SMS 총량·유료 API)이 풀린 상태임을alertAdmins로 알린다.rate_limit_hitRPC 라 리미터가 죽으면 스로틀도 fail-open → 아이솔레이트 내 시계 10분 1회로 한 번 더 조임.부수
supabase db push예시 제거(실제 절차인 psql 직접 적용으로 교체), 함수 배포는 CI(main 머지 = 배포)가 정본임을 명시.검증
dump_schema.sh스냅샷 동시 갱신🤖 Generated with Claude Code