Files
Gnuboard7/plugins/_bundled/sirsoft-gdpr/tests/scenarios/functional-gating.yaml
T
HeuJung 1124fad027 feat(gdpr): 필수 저장 항목 허용목록을 운영자 설정으로 이관
허용목록이 플러그인 코드 상수라, 새 확장이 저장 키를 도입할 때마다 이 플러그인을
고쳐야 했다. 고치지 않으면 그 키는 방문마다 파기되는데 예외도 로그도 남지 않아
운영자에게는 "설정이 저장되지 않는다" 는 증상만 보인다.

허용목록을 운영자 설정(necessary_storage_allowlist)으로 옮기고, 관리자 환경설정에
브라우저 저장소·세션 저장소·쿠키 세 카드를 두어 직접 편집하게 했다. 확장은 GDPR 을
알 필요가 없고 GDPR 도 확장을 알 필요가 없다 — 연결은 운영자가 화면에서 한다.
저장 키를 플러그인이 관측·수집하지 않는 것도 같은 이유다: 관측 자체가 추적이다.

판정은 서버(미들웨어)와 클라이언트 셋(인터셉터 둘 + 정리기)이 같은 설정을 같은 매칭
규칙으로 읽는다. 잠금 항목(로그인 토큰·CSRF·세션 쿠키·동의 기록)만 설정 밖에 두고
판정 시점에 합집합으로 얹는다 — 설정에 담기면 저장 요청 한 번으로 지워져 잠금이
아니게 된다. 기설치본은 업그레이드 스텝이 현재 카탈로그를 설정 파일에 못박되,
운영자가 이미 편집했으면 그대로 둔다.

함께 고친 선재 결함 셋:
- 차단 도메인 추천 목록이 응답에 실리지 않아 자동완성이 동작하지 않던 문제
- 세션 쿠키 이름을 기본값에서 바꾼 사이트에서 브라우저 측 목록의 그 항목이 죽던 문제
- 쿠키 목록에만 앞부분 매칭(`이름_*`)이 적용되지 않던 문제
2026-09-03 22:18:18 +09:00

116 lines
6.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# audit:allow test-scenario-coverage reason: Phase 2 단순화 후 functional 게이팅은 4영역(클라이언트 storage / 클라이언트 cookie / 서버 미들웨어 / cleanup) × 3축(consent / user_initiated / cookie_state) cross product 로 축소됨. registered 축 제거로 cross product 가 작아져 등록된 PHPUnit 16 + Vitest 36 = 52 케이스로 모든 axes 의 핵심 조합과 후속 효과 체인을 커버.
feature: GDPR functional 카테고리 1st-party 게이팅 (Phase 2 단순화)
description: |
EDPB Guidelines 2/2023 §16 (사전 차단) + Guidelines 05/2020 §117 (철회 즉시 파기) 충족을 위해
functional 카테고리에 4영역 게이팅을 적용한다.
단순화 배경 (Phase 2 → Phase 2 단순화):
초기 Phase 2 는 운영자가 admin UI 에서 functional storage/cookie 를 "등록 표" 에 추가하면
그 키만 게이팅 대상이 되도록 설계했으나, 이는 GDPR 원칙 ("strictly necessary 외 비-필수는
동의 전 차단") 과 충돌하여 등록 표를 제거하고 4단계 단순화 규칙으로 통합:
1. strictly necessary 허용목록 (운영자 설정 ∪ 잠금 집합) → 통과
2. functional 동의 → 통과
3. user-initiated 면제 (WP29 §3.6, 항상 활성) → 통과
4. 그 외 → 차단
영역:
1. 클라이언트 storageInterceptor — Storage.prototype.setItem 가로채기
2. 클라이언트 cookieInterceptor — Document.prototype.cookie setter 가로채기
3. 서버 CookieConsentMiddleware — 응답 Set-Cookie 헤더에서 allowlist 외 모든 cookie 제거
4. functionalCleaner — 동의 철회 또는 부팅 시 미동의면 allowlist 외 모든 storage/cookie 즉시 파기
cleared cookie (Max-Age=0 / expires 과거) 는 위 모든 영역에서 항상 통과 — EDPB §117 와 §16
가 충돌하지 않도록 함.
axes:
area: [storage_interceptor, cookie_interceptor, server_middleware, cleaner]
consent: [functional_granted, functional_denied]
user_initiated: [recent_interaction, no_interaction]
necessary: [in_allowlist, not_in_allowlist]
cookie_state: [normal, cleared]
storage_kind: [localStorage, sessionStorage]
exclusions:
- { area: storage_interceptor, cookie_state: any, reason: "storage 영역엔 cookie_state 축 미적용" }
- { area: cleaner, consent: functional_granted, reason: "cleaner 는 동의 철회 또는 부팅 시 미동의 상태에서만 호출 — 동의 시점엔 호출되지 않음" }
- { area: server_middleware, user_initiated: any, reason: "서버 미들웨어는 user-interaction 컨텍스트 부재 — 클라이언트 인터셉터가 담당" }
- { necessary: in_allowlist, consent: any, user_initiated: any, reason: "strictly necessary 는 모든 조건 무관 항상 통과" }
- { cookie_state: cleared, consent: any, user_initiated: any, necessary: any, reason: "파기 cookie 는 모든 조건 무관 항상 통과 (§117 충돌 회피)" }
effects:
# storageInterceptor (영역 1)
- storage_necessary_always_passes
- storage_prefix_match_passes
- storage_consented_passes_all_keys
- storage_denied_user_initiated_passes
- storage_denied_no_interaction_blocks
- storage_update_config_applies_consent_change
- storage_uninstall_restores_original_setItem
- storage_is_storage_allowed_pure_evaluation
# cookieInterceptor (영역 2)
- cookie_necessary_xsrf_always_passes
- cookie_consented_passes_all_names
- cookie_denied_user_initiated_passes
- cookie_denied_no_interaction_blocks
- cookie_malformed_string_blocked
- cookie_cleared_always_passes_max_age_zero
- cookie_update_config_applies_consent_change
- cookie_uninstall_restores_original_setter
- cookie_is_cookie_allowed_pure_evaluation
# CookieConsentMiddleware (영역 3, 서버)
- middleware_removes_all_non_allowlist_cookies_on_decline
- middleware_passes_all_cookies_on_consent
- middleware_preserves_strictly_necessary_cookies
- middleware_passes_cleared_cookies_even_without_consent
- middleware_full_pass_under_consent
# GdprCookieConsentController::store (등록 표 제거로 cookie 추가 발송 없음)
- controller_does_not_dispatch_extra_cookies_on_functional_decline
# functionalCleaner (영역 4)
- cleaner_clears_non_allowlist_localStorage_keys
- cleaner_clears_non_allowlist_sessionStorage_keys
- cleaner_preserves_necessary_storage_keys
- cleaner_preserves_prefix_match_keys
- cleaner_clears_non_allowlist_cookies
- cleaner_preserves_necessary_cookies
- cleaner_combined_storage_plus_cookie_purge
- cleaner_empty_state_silent
- cleaner_custom_allowlist_option_extends_protection
# userInitiatedTracker (공통 의존성)
- tracker_install_idempotent
- tracker_isTrusted_only_updates_timestamp
- tracker_within_threshold_returns_true
- tracker_beyond_threshold_returns_false
- tracker_boundary_value_inclusive
- tracker_uninstall_clears_timestamp
# Settings 응답 노출 (Phase 2 단순화 — 등록 표 응답 제거)
- public_settings_does_not_expose_phase2_registration_fields
- admin_settings_does_not_expose_phase2_registration_fields
test_files:
# PHPUnit (백엔드)
- plugins/_bundled/sirsoft-gdpr/tests/Unit/Http/Middleware/CookieConsentMiddlewareTest.php
- plugins/_bundled/sirsoft-gdpr/tests/Feature/Api/Public/GdprCookieConsentControllerTest.php
- plugins/_bundled/sirsoft-gdpr/tests/Feature/Api/Public/GdprSettingsControllerTest.php
- plugins/_bundled/sirsoft-gdpr/tests/Feature/Api/Admin/GdprAdminSettingsControllerTest.php
# Vitest (프론트엔드)
- plugins/_bundled/sirsoft-gdpr/resources/js/__tests__/userInitiatedTracker.test.ts
- plugins/_bundled/sirsoft-gdpr/resources/js/__tests__/storageInterceptor.test.ts
- plugins/_bundled/sirsoft-gdpr/resources/js/__tests__/cookieInterceptor.test.ts
- plugins/_bundled/sirsoft-gdpr/resources/js/__tests__/functionalCleaner.test.ts
limitations:
- "strictly necessary 허용목록은 **운영자 설정**이다 (necessary_storage_allowlist). 코드 상수는 신규 설치 시드용 출하 카탈로그일 뿐이며, 새 저장 키가 필요하면 운영자가 관리자 화면에서 추가한다 — 이 플러그인 소스 수정은 필요 없다. 상세: necessary-storage-allowlist.yaml"
- "인터셉터는 신규 쓰기만 차단. 인터셉터 install 이전에 동기 실행된 쓰기는 잡지 못함 — 부팅 시점 cleaner 가 보완."
- "user-initiated 면제 (WP29 §3.6) 의 500ms 임계값은 휴리스틱 — 일반 SPA 의 click → setState → effect → localStorage 체인 커버 목적."
- "외부 추적 도메인 (Crisp 등) 의 자동 차단은 별도 영역 — 본 시나리오는 1st-party storage 만 다룸 (blocker-domains.yaml / preblocker.yaml 참조)."
- "JavaScript 비활성화 환경에선 클라이언트 인터셉터 / cleaner 모두 동작 불가 — 서버 미들웨어가 부분적 보완 (응답 Set-Cookie 단계 차단)."