10 KiB
title, source_type, url, archive_url, related_branches, related_projects, tags, created
| title | source_type | url | archive_url | related_branches | related_projects | tags | created | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| official-doc / MDN — Set-Cookie header, `SameSite` attribute (Strict / Lax / None) | official-doc | https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie |
|
|
2026-07-25 |
official-doc / MDN — Set-Cookie header, SameSite attribute (Strict / Lax / None)
Layer:
raw/official-docs/— MDN Web Docs "Set-Cookie header" 레퍼런스 중SameSite속성 정의 부분의 원문 발췌.feature-keycloak-bff-csrf-samesite-defensebranch의 D3 결정(AP3 BFF 세션 쿠키에SameSite=Lax를 CSRF defense-in-depth 로 결합) 근거로 보관. 이 branch 의 기존 CSRF 근거(csrf-protection-spring-official)는 SameSite 를 전혀 다루지 않아 소스 미확보(UNSUPPORTED_DECISION) 상태였던 것을 보강한다.
source_type 허용값
frontmatter source_type: 에는 official-doc 사용 — MDN Web Docs 는 Mozilla 가 운영하는 크로스브라우저 웹 플랫폼 레퍼런스(HTTP 헤더/Web API)로, 특정 벤더 제품이 아닌 웹 표준·다중 브라우저 공통 동작을 문서화하는 공식 reference.
Parent / 활용 branch
| Branch | 이 자료가 정당화하는 결정 |
|---|---|
| raw/branch-notes/feature-keycloak-bff-csrf-samesite-defense | D3 — AP3 BFF branch가 세션 쿠키에 SameSite=Lax 를 CSRF defense-in-depth 로 적용하기로 한 결정의 근거. 브라우저 벤더 중립 레퍼런스가 정의하는 SameSite 값(Strict/Lax/None)의 동작, Lax 의 top-level-navigation 예외(Keycloak 외부 IdP 로그인 redirect 와의 호환성 근거), 기본값 동작, None 의 Secure 요구사항을 제공. |
출처
- 원본 URL: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie
- 아카이브 URL: (미확보 — 사용자 미제공)
- 저자 / 조직: Mozilla (MDN Web Docs contributors)
- 발행일: (MDN 페이지는 지속 업데이트되는 레퍼런스 문서이며 최초 발행일이 페이지에 명시되지 않음)
- 마지막 확인일: 2026-07-25
왜 저장했는지
feature-keycloak-bff-csrf-samesite-defense branch 의 D3 결정("SameSite 쿠키 속성을 defense-in-depth 로 결합")이 완료조건에 명시되어 있으나, 이 branch 의 기존 CSRF 근거(Spring Security 공식 문서)는 SameSite 를 전혀 언급하지 않아 UNSUPPORTED_DECISION 상태였다. 본 자료는 브라우저 벤더 중립 정의(Strict/Lax/None 각 값의 실제 동작, 기본값, Secure 요구사항)를 제공해 D3 의 근거를 확보한다.
핵심 인용
[§SameSite=<samesite-value> > Strict] "Send the cookie only for requests originating from the same site that set the cookie."
[§SameSite=<samesite-value> > Lax] "Send the cookie only for requests originating from the same site that set the cookie, and for cross-site requests that meet both of the following criteria:"
[§SameSite=<samesite-value> > Lax > 조건 1: top-level navigation] "The request is a top-level navigation: this essentially means that the request causes the URL shown in the browser's address bar to change."
[§SameSite=<samesite-value> > Lax > 기본값] "Some browsers use Lax as the default value if SameSite is not specified: see Browser compatibility for details."
[§SameSite=<samesite-value> > None] "Send the cookie with both cross-site and same-site requests." / "The Secure attribute must also be set when using this value."
Claims Extracted / 추출된 주장
이 자료가 직접 말하는 것만 claim 으로 분리한다. 내 프로젝트에 적용한 결론은 여기 쓰지 않는다.
| Claim ID | Claim | Evidence quote | Strength | Applies to | Does not prove |
|---|---|---|---|---|---|
| MDN-SAMESITE-C1 | SameSite=Strict 는 쿠키를 설정한 것과 동일 사이트에서 발생한 요청에만 쿠키를 전송한다 |
"Send the cookie only for requests originating from the same site that set the cookie." | official-reference |
모든 브라우저·프레임워크에 걸친 Set-Cookie: SameSite=Strict 의 일반 정의 |
Spring Boot/서블릿 컨테이너가 이 값을 어떤 설정 키로 노출하는지는 이 문서 범위 밖 |
| MDN-SAMESITE-C2 | SameSite=Lax 는 동일 사이트 요청 및, cross-site 요청 중 (a) top-level navigation 이면서 (b) safe method(POST/PUT/DELETE 제외)인 요청에만 쿠키를 전송한다 |
"Send the cookie only for requests originating from the same site that set the cookie, and for cross-site requests that meet both of the following criteria:" + "The request is a top-level navigation: this essentially means that the request causes the URL shown in the browser's address bar to change." | official-reference |
D3 의 핵심 근거 — 외부 IdP(Keycloak) 로의 OAuth2 로그인 redirect(링크 클릭/document.location 이동 방식의 top-level navigation)는 이 조건을 만족해 SameSite=Lax 쿠키가 여전히 전송됨 |
이 branch 의 실제 oauth2Login redirect 체인이 브라우저 구현상 정확히 "top-level navigation" 으로 분류되는지는 코드 구현·재현 전까지 미검증 |
| MDN-SAMESITE-C3 | 일부 브라우저는 SameSite 속성이 명시되지 않았을 때 Lax 를 기본값으로 사용한다 |
"Some browsers use Lax as the default value if SameSite is not specified: see Browser compatibility for details." | official-reference |
"일부 브라우저"(some browsers) 라는 원문 한정어 그대로만 적용 | 모든 브라우저·모든 버전에서 보장된 기본값이라는 뜻은 아님(원문이 명시적으로 "some" 으로 한정, Browser compatibility 섹션은 본 raw 문서에 미포함) |
| MDN-SAMESITE-C4 | SameSite=None 은 cross-site 및 same-site 요청 모두에 쿠키를 전송하며, 이 값을 사용할 때는 Secure 속성도 반드시 함께 설정해야 한다 |
"Send the cookie with both cross-site and same-site requests." / "The Secure attribute must also be set when using this value." | official-reference |
SameSite=None 사용 시 Secure 속성 병행이 규범적으로 요구됨(D3 가 None 을 채택할 경우의 제약 조건) |
Secure 미설정 시 브라우저가 정확히 어떻게 거부/무시하는지의 세부 동작(거부 시점, 로그 노출 등)은 이 인용 범위 밖 |
Strength 허용값
official-standard— RFC, 표준 사양, 언어/프로토콜 표준official-vendor-doc— Spring, Keycloak, AWS, Google 등 공식 벤더 문서official-reference— 공식 reference/API 문서 (본 문서는 MDN Web Docs — 크로스브라우저 웹 플랫폼 reference — 이 등급 사용)company-case-study— 대기업/실무 기술 블로그의 특정 사례engineering-blog— 개인/팀 블로그의 엔지니어링 해설tutorial— 튜토리얼/가이드. 일반화 금지needs-confirmation— 원문만으로는 적용 판단 불가
Usage Boundaries / 적용 경계
- 이 자료가 직접 증명하는 것:
MDN-SAMESITE-C1:SameSite=Strict는 동일 사이트 요청에만 쿠키 전송.MDN-SAMESITE-C2:SameSite=Lax는 top-level navigation + safe method 조건을 만족하는 cross-site 요청에도 쿠키 전송 (D3 의 crux — Keycloak redirect 호환성 근거).MDN-SAMESITE-C3: 일부 브라우저의Lax기본값 채택 사실.MDN-SAMESITE-C4:SameSite=None사용 시Secure속성 병행 필수.
- 이 자료가 증명하지 않는 것:
SameSite단독으로 CSRF 를 완전히 방어한다는 것 — 원문 자체가 "This provides some protection against certain cross-site attacks" 로 완곡하게 표현하며 완전 방어를 주장하지 않음 (D3 의 "defense-in-depth" 라는 표현과 일치, CSRF token 병행 필요).- Spring Boot/Spring Security 에서 세션 쿠키의
SameSite값을 실제로 어떻게 설정하는지(예:server.servlet.session.cookie.same-site) — 이는 Spring 공식 문서 별도 확인 필요, 이 자료 범위 밖. feature-keycloak-bff-oauth2login-session이 실제로 발급하는 세션 쿠키(SESSION)와 이 branch 의XSRF-TOKEN쿠키 각각에SameSite를 어떤 값으로 설정할지의 구현 결정 — 이 자료는 값의 정의만 제공하며 적용 대상 선택은 D3 의UNSUPPORTED_IMPL_DECISION(a)로 남아있음.
- 내 프로젝트에 적용하려면 추가 확인이 필요한 것:
- AP3 코드 구현 후 Keycloak OAuth2 로그인 redirect 가 실제로 top-level navigation 으로 처리되어
SameSite=Lax쿠키가 전송되는지 로컬 재현으로 검증. - Spring Boot 세션 쿠키 SameSite 설정 API 자체는 별도 공식 문서(Spring Session/Spring Boot reference) 인용 필요.
- AP3 코드 구현 후 Keycloak OAuth2 로그인 redirect 가 실제로 top-level navigation 으로 처리되어
메모
나중에 wiki로 옮길 때 참고할 짧은 메모. 검증되지 않은 내 추론은 여기에 두지 말 것.
- 원문이 "provides some protection"(완전 방어 아님)이라고 표현한 점은 D3 의 "defense-in-depth" 결정 문구와 정확히 일치 — CSRF token(D2) 병행이 필수라는 branch 결론을 뒷받침.
- 브라우저별
Lax기본값 채택 현황(Browser compatibility 표)은 이 raw 문서에 미포함 — 필요 시 별도 확인. - Spring Boot 세션 쿠키의 SameSite 설정 키(
server.servlet.session.cookie.same-site)는 이 자료 범위 밖이라 별도 Spring 공식 문서 아카이빙이 필요할 수 있음(현재 확인 결과[[raw/official-docs/spring-boot-session-cookie-samesite-property-official]]로 이미 별도 확보되어 있음). - RFC 6265bis(SameSite 의 IETF draft/표준화 문서) 및 OWASP CSRF cheat sheet 도 branch 진행 중 메모에 candidate 로 언급되어 있으나, 본 문서 작성 시점 기준 이 raw 파일과는 별개로 확인 필요.
관련
같은 주제의 다른 raw 자료, 또는 이 자료를 인용한 wiki 문서.
- 같은 branch 의 CSRF 메커니즘 근거:
[[raw/official-docs/csrf-protection-spring-official]](Spring Security synchronizer token pattern — 이 문서와 상호 보완, SameSite 는 defense-in-depth) - 같은 branch 의 SameSite 설정 API 근거(값의 정의가 아니라 프로퍼티 키):
[[raw/official-docs/spring-boot-session-cookie-samesite-property-official]] - 이 자료를 인용한 wiki 요약: 아직 없음 (생성 시
wiki/concepts/경로에 추가 예정 — 미생성 상태라 wikilink 대신 경로 텍스트로만 표기)