C.W.K.
Stream
Lesson 04 of 06 · published

PII, Compliance, Access Control

~11 min · pii, security, compliance

Level 0구경꾼
0 XP0/47 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

프로 최소

모든 production 데이터 엔지니어가 결국 PII (개인 식별 정보) 다룸. 최소 기준: 본인 테이블에서 뭐가 PII 인지 알기, 누가 읽을 수 있는지 통제, 누가 읽나 로깅, 삭제 요청 들어오면 처리. 정확한 규제는 지역마다 다름 (EU 의 GDPR, California 의 CCPA, 한국 개인정보보호법) 지만 근저의 엔지니어링 모양은 비슷.

4가지 엔지니어링 통제

  • Tagging. 모든 column 이 메타데이터 카탈로그 또는 dbt schema.yml 에 PII / sensitive / public 으로 태그.
  • Masking. 비-특권 사용자가 hashed 또는 redacted 값 봄; 특권 사용자는 진짜 값 보고 access 가 로깅.
  • Row-level security. 같은 테이블이 다른 role 에 다르게 filter (각 region 분석가가 자기 region 만).
  • Right-to-be-forgotten 전파. 사용자가 삭제 요청하면 삭제가 모든 derived 테이블 통해 흘러야 함. 어디 그들 데이터 있는지 모르면 삭제됐다고 솔직히 말 못 함.

모든 분석가가 못 해야 하는 것

PII 포함 테이블을 개인 노트북에 bulk-export. Production warehouse (Snowflake, BigQuery, row-level security 있는 Postgres) 가 다 이걸 막는 정책 지원. 새 분석가 계정 default 는: aggregated mart 에 read-only, PII 없음, 명시적 승인 워크플로우 없는 export-to-CSV 없음. 나중에 권한 죄는 게 default 로 죄는 것보다 천 배 어려워.

Code

dbt schema.yml 의 PII tagging — meta tag 가 model 과 함께 이동·yaml
version: 2

models:
  - name: dim_customers
    description: "고객 dimension. PII 포함."
    meta:
      contains_pii: true
      access_classification: restricted
    columns:
      - name: customer_id
        meta:
          pii: false
          column_classification: pseudonymous_id
      - name: email
        meta:
          pii: true
          column_classification: personal_contact
      - name: phone
        meta:
          pii: true
          column_classification: personal_contact
      - name: country
        meta:
          pii: false
          column_classification: demographic
PostgreSQL row-level security — enforce 하는 메커니즘·sql
ALTER TABLE fact_orders ENABLE ROW LEVEL SECURITY;

-- Region 분석가는 자기 region 만 봄
CREATE POLICY region_filter ON fact_orders
    FOR SELECT TO region_analyst_role
    USING (region = current_setting('app.current_region'));

-- Global admin 은 다 봄
CREATE POLICY admin_all ON fact_orders
    FOR ALL TO admin_role
    USING (true);

-- 애플리케이션이 connect 시점 세션별로 app.current_region 설정:
--   SET app.current_region = 'KR';

External links

Exercise

본인 작업 production 테이블 하나 inventory. 모든 column 나열하고 각각 PII / sensitive / public 태그. PII column 마다 적기: (a) 본인 조직에서 누가 raw 값 읽을 수 있어야 하나, (b) 오늘 그걸 enforce 하는 메커니즘 뭐, (c) 그 메커니즘이 warehouse 안인지 그냥 BI 도구 안인지. 대부분 audit 가 최소 한 gap surface.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.