refactor: 문서 개선 중
This commit is contained in:
+10
-10
@@ -1,22 +1,22 @@
|
||||
# 지우지 않으면 통과한다
|
||||
# 헤더 도착과 인가 우회는 다르다
|
||||
|
||||
## Alternative text
|
||||
|
||||
밖에서 들어온 위조 헤더가 프록시를 그대로 통과해 앱에 닿는 구성. 프록시가 그 이름을 설정할 때만 덮어쓴다.
|
||||
외부 위조 헤더가 nginx 를 지나 permitAll echo 에서는 200으로 도착하지만 JWT 보호 경로에서는 401로 막히는 분기.
|
||||
|
||||
## Long description
|
||||
|
||||
nginx 는 자기가 proxy_set_header 로 설정한 헤더만 덮어쓴다. 설정하지 않은 이름은 클라이언트가 보낸 값이 그대로 지나간다. 그래서 X-Auth-Request-Roles 같은 헤더를 앱이 믿으려면 프록시가 그 이름을 먼저 빈 값으로 지워야 한다. 그리고 IdP 에서 클레임을 바꿔도 반영되지 않는다. 12회 요청 6초 동안 옛 값이 갔고 세션을 지워 재인증한 뒤에야 새 값이 왔다. 세션은 로그인 시점의 스냅샷이다.
|
||||
위조 헤더는 app1.hyeonworks.com/api 의 permitAll echo 앱까지 그대로 도착했다. 같은 헤더로 JWT 를 요구하는 /api/me 와 /api/protected 를 호출하면 401이었다. 따라서 헤더 도착과 인가 우회는 다른 사건이다. proxy_set_header 로 먼저 지우는 것은 문서에 적힌 처방이지만 이 실험대에서는 적용하지 않아 미검증이다.
|
||||
|
||||
## Elements and evidence
|
||||
|
||||
- **외부 위조 헤더** (actor): 밖에서 들어온 요청이 앱이 믿는 헤더 이름을 그대로 쓴다. Evidence: L393–L400.
|
||||
- **nginx** (gateway): 설정하지 않은 이름은 덮어쓰지 않는다. Evidence: L393–L400.
|
||||
- **oauth2-proxy** (gateway): 인증 결과를 헤더로 넣는다. Evidence: L393–L400.
|
||||
- **앱** (service): 헤더를 믿고 인가한다. Evidence: L401–L408.
|
||||
- **외부 위조 헤더** (actor): 앱이 신뢰할 수 있는 이름과 같은 헤더를 보낸다. Evidence: L823–L830.
|
||||
- **nginx** (gateway): 설정하지 않은 동명 헤더를 덮어쓰지 않는다. Evidence: L829–L830.
|
||||
- **permitAll echo** (service): 위조 헤더가 도착하는 것을 관측한 경로다. Evidence: L825–L840.
|
||||
- **JWT 보호 경로** (service): 같은 위조 헤더만으로는 통과하지 못했다. Evidence: L832–L840.
|
||||
|
||||
## Relationships
|
||||
|
||||
- **외부 위조 헤더 → nginx:** 위조 헤더. Evidence: L393–L400.
|
||||
- **nginx → oauth2-proxy:** 미삭제 시 통과. Evidence: L393–L400.
|
||||
- **oauth2-proxy → 앱:** 인가 헤더. Evidence: L393–L408.
|
||||
- **외부 위조 헤더 → nginx:** 위조 헤더. Evidence: L823–L830.
|
||||
- **nginx → permitAll echo:** 그대로 전달. Evidence: L825–L840.
|
||||
- **nginx → JWT 보호 경로:** 같은 헤더. Evidence: L832–L840.
|
||||
|
||||
+8
-8
@@ -1,18 +1,18 @@
|
||||
# 지우지 않으면 통과한다
|
||||
# Question: Edge 가 넣어주는 인가 헤더를 앱이 믿어도 되는가
|
||||
direction: down
|
||||
# 헤더 도착과 인가 우회는 다르다
|
||||
# Question: 같은 위조 헤더가 도착하는 것과 인가를 우회하는 것은 같은가
|
||||
direction: right
|
||||
n0: "외부 위조 헤더" {
|
||||
shape: person
|
||||
}
|
||||
n1: "nginx" {
|
||||
shape: diamond
|
||||
}
|
||||
n2: "oauth2-proxy" {
|
||||
shape: diamond
|
||||
n2: "permitAll echo" {
|
||||
shape: rectangle
|
||||
}
|
||||
n3: "앱" {
|
||||
n3: "JWT 보호 경로" {
|
||||
shape: rectangle
|
||||
}
|
||||
n0 -> n1: "위조 헤더"
|
||||
n1 -> n2: "미삭제 시 통과"
|
||||
n2 -> n3: "인가 헤더"
|
||||
n1 -> n2: "그대로 전달"
|
||||
n1 -> n3: "같은 헤더"
|
||||
|
||||
+5
-5
@@ -1,12 +1,12 @@
|
||||
digraph techviz {
|
||||
graph [rankdir=TB, splines=ortho, nodesep=0.55, ranksep=0.85];
|
||||
graph [rankdir=LR, splines=ortho, nodesep=0.55, ranksep=0.85];
|
||||
node [fontname=Helvetica, fontsize=11, margin="0.18,0.12", style="rounded,filled", fillcolor=white, color="#2d4357", penwidth=1.5];
|
||||
edge [fontname=Helvetica, fontsize=10, color="#364b5f", penwidth=1.4, arrowsize=0.75];
|
||||
n0 [label="외부 위조 헤더", shape=box, style="rounded,dashed,filled"];
|
||||
n1 [label="nginx", shape=diamond, style="rounded,filled"];
|
||||
n2 [label="oauth2-proxy", shape=diamond, style="rounded,filled"];
|
||||
n3 [label="앱", shape=box, style="rounded,filled"];
|
||||
n2 [label="permitAll echo", shape=box, style="rounded,filled"];
|
||||
n3 [label="JWT 보호 경로", shape=box, style="rounded,filled"];
|
||||
n0 -> n1 [label="위조 헤더", style=solid];
|
||||
n1 -> n2 [label="미삭제 시 통과", style=solid];
|
||||
n2 -> n3 [label="인가 헤더", style=solid];
|
||||
n1 -> n2 [label="그대로 전달", style=solid];
|
||||
n1 -> n3 [label="같은 헤더", style=solid];
|
||||
}
|
||||
|
||||
+15
-15
@@ -1,35 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mxfile host="app.diagrams.net" modified="2026-07-23T00:00:00.000Z" agent="techviz-harness" version="24.7.17" type="device">
|
||||
<diagram id="b4-header-trust-boundary" name="지우지 않으면 통과한다">
|
||||
<mxGraphModel dx="680" dy="690" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<diagram id="b4-header-trust-boundary" name="헤더 도착과 인가 우회는 다르다">
|
||||
<mxGraphModel dx="999" dy="319" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="999" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0"/>
|
||||
<mxCell id="1" parent="0"/>
|
||||
<mxCell id="n_attacker" value="외부 위조 헤더<br/>X-Auth-Request-Roles" tooltip="밖에서 들어온 요청이 앱이 믿는 헤더 이름을 그대로 쓴다. | Evidence: L393-L400" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;dashed=1;fillColor=#f5f7fa;strokeColor=#d97706;fillColor=#fffdf5;" vertex="1" parent="1">
|
||||
<mxGeometry x="82.5" y="60.0" width="170.0" height="84.0" as="geometry"/>
|
||||
<mxCell id="n_attacker" value="외부 위조 헤더<br/>X-Auth-Request-Roles" tooltip="앱이 신뢰할 수 있는 이름과 같은 헤더를 보낸다. | Evidence: L823-L830" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;dashed=1;fillColor=#f5f7fa;strokeColor=#d97706;fillColor=#fffdf5;" vertex="1" parent="1">
|
||||
<mxGeometry x="70.0" y="125.0" width="170.0" height="84.0" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="n_nginx" value="nginx<br/>proxy_set_header ... """ tooltip="설정하지 않은 이름은 덮어쓰지 않는다. | Evidence: L393-L400" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;rhombus;perimeter=rhombusPerimeter;fillColor=#fff7e8;strokeColor=#d97706;fillColor=#fffdf5;" vertex="1" parent="1">
|
||||
<mxGeometry x="70.0" y="240.0" width="195.0" height="71.0" as="geometry"/>
|
||||
<mxCell id="n_nginx" value="nginx<br/>동명 헤더 미삭제" tooltip="설정하지 않은 동명 헤더를 덮어쓰지 않는다. | Evidence: L829-L830" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;rhombus;perimeter=rhombusPerimeter;fillColor=#fff7e8;strokeColor=#d97706;fillColor=#fffdf5;" vertex="1" parent="1">
|
||||
<mxGeometry x="400.0" y="131.5" width="150.0" height="71.0" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="n_proxy" value="oauth2-proxy<br/>--set-xauthrequest" tooltip="인증 결과를 헤더로 넣는다. | Evidence: L393-L400" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;rhombus;perimeter=rhombusPerimeter;fillColor=#fff7e8;" vertex="1" parent="1">
|
||||
<mxGeometry x="87.5" y="407.0" width="160.0" height="71.0" as="geometry"/>
|
||||
<mxCell id="n_echo" value="permitAll echo<br/>/api/echo · HTTP 200" tooltip="위조 헤더가 도착하는 것을 관측한 경로다. | Evidence: L825-L840" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;" vertex="1" parent="1">
|
||||
<mxGeometry x="745.0" y="60.0" width="174.0" height="71.0" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="n_app" value="앱<br/>로그인 시점 스냅샷" tooltip="헤더를 믿고 인가한다. | Evidence: L401-L408" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;strokeColor=#2563eb;strokeWidth=2;" vertex="1" parent="1">
|
||||
<mxGeometry x="92.5" y="574.0" width="150.0" height="71.0" as="geometry"/>
|
||||
<mxCell id="n_protected" value="JWT 보호 경로<br/>/api/me · /api/protected · 401" tooltip="같은 위조 헤더만으로는 통과하지 못했다. | Evidence: L832-L840" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;strokeColor=#2563eb;strokeWidth=2;" vertex="1" parent="1">
|
||||
<mxGeometry x="710.0" y="203.0" width="244.0" height="71.0" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="e_a-n" value="위조 헤더" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_attacker" target="n_nginx">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="191.5" y="192.0" as="offset"/>
|
||||
<mxPoint x="320.0" y="139.0" as="offset"/>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="e_n-p" value="미삭제 시 통과" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_nginx" target="n_proxy">
|
||||
<mxCell id="e_n-e" value="그대로 전달" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_nginx" target="n_echo">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="191.5" y="359.0" as="offset"/>
|
||||
<mxPoint x="671.5" y="126.8" as="offset"/>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="e_p-a" value="인가 헤더" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_proxy" target="n_app">
|
||||
<mxCell id="e_n-p" value="같은 헤더" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_nginx" target="n_protected">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="191.5" y="526.0" as="offset"/>
|
||||
<mxPoint x="654.0" y="207.2" as="offset"/>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
</root>
|
||||
|
||||
+221
-221
@@ -6,10 +6,10 @@
|
||||
{
|
||||
"id": "edge-a-n",
|
||||
"type": "arrow",
|
||||
"x": 167.5,
|
||||
"y": 144.0,
|
||||
"width": 0.0,
|
||||
"height": 96.0,
|
||||
"x": 240.0,
|
||||
"y": 167.0,
|
||||
"width": 160.0,
|
||||
"height": 0.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "transparent",
|
||||
@@ -36,16 +36,16 @@
|
||||
0.0
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
48.0
|
||||
80.0,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
48.0
|
||||
80.0,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
96.0
|
||||
160.0,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"lastCommittedPoint": null,
|
||||
@@ -66,8 +66,8 @@
|
||||
{
|
||||
"id": "edge-label-a-n",
|
||||
"type": "text",
|
||||
"x": 146.5,
|
||||
"y": 180.0,
|
||||
"x": 275.0,
|
||||
"y": 127.0,
|
||||
"width": 90,
|
||||
"height": 24,
|
||||
"angle": 0,
|
||||
@@ -102,13 +102,112 @@
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "edge-n-e",
|
||||
"type": "arrow",
|
||||
"x": 550.0,
|
||||
"y": 95.5,
|
||||
"width": 195.0,
|
||||
"height": 62.5,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "solid",
|
||||
"strokeWidth": 2,
|
||||
"strokeStyle": "solid",
|
||||
"roughness": 1,
|
||||
"opacity": 100,
|
||||
"groupIds": [],
|
||||
"frameId": null,
|
||||
"index": null,
|
||||
"roundness": null,
|
||||
"seed": 148101747,
|
||||
"version": 1,
|
||||
"versionNonce": 318567733,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"points": [
|
||||
[
|
||||
0.0,
|
||||
62.5
|
||||
],
|
||||
[
|
||||
97.5,
|
||||
62.5
|
||||
],
|
||||
[
|
||||
97.5,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
195.0,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"lastCommittedPoint": null,
|
||||
"startBinding": {
|
||||
"elementId": "node-nginx",
|
||||
"focus": 0,
|
||||
"gap": 4
|
||||
},
|
||||
"endBinding": {
|
||||
"elementId": "node-echo",
|
||||
"focus": 0,
|
||||
"gap": 4
|
||||
},
|
||||
"startArrowhead": null,
|
||||
"endArrowhead": "arrow",
|
||||
"elbowed": true
|
||||
},
|
||||
{
|
||||
"id": "edge-label-n-e",
|
||||
"type": "text",
|
||||
"x": 626.5,
|
||||
"y": 114.75,
|
||||
"width": 90,
|
||||
"height": 24,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"strokeStyle": "solid",
|
||||
"roughness": 0,
|
||||
"opacity": 100,
|
||||
"groupIds": [],
|
||||
"frameId": null,
|
||||
"index": null,
|
||||
"roundness": {
|
||||
"type": 3
|
||||
},
|
||||
"seed": 934715894,
|
||||
"version": 1,
|
||||
"versionNonce": 426907020,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"fontSize": 13,
|
||||
"fontFamily": 5,
|
||||
"text": "그대로 전달",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "그대로 전달",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "edge-n-p",
|
||||
"type": "arrow",
|
||||
"x": 167.5,
|
||||
"y": 311.0,
|
||||
"width": 0.0,
|
||||
"height": 96.0,
|
||||
"x": 550.0,
|
||||
"y": 176.0,
|
||||
"width": 160.0,
|
||||
"height": 62.5,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "transparent",
|
||||
@@ -135,16 +234,16 @@
|
||||
0.0
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
48.0
|
||||
80.0,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
48.0
|
||||
80.0,
|
||||
62.5
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
96.0
|
||||
160.0,
|
||||
62.5
|
||||
]
|
||||
],
|
||||
"lastCommittedPoint": null,
|
||||
@@ -154,7 +253,7 @@
|
||||
"gap": 4
|
||||
},
|
||||
"endBinding": {
|
||||
"elementId": "node-proxy",
|
||||
"elementId": "node-protected",
|
||||
"focus": 0,
|
||||
"gap": 4
|
||||
},
|
||||
@@ -165,8 +264,8 @@
|
||||
{
|
||||
"id": "edge-label-n-p",
|
||||
"type": "text",
|
||||
"x": 146.5,
|
||||
"y": 347.0,
|
||||
"x": 609.0,
|
||||
"y": 195.25,
|
||||
"width": 90,
|
||||
"height": 24,
|
||||
"angle": 0,
|
||||
@@ -193,118 +292,19 @@
|
||||
"locked": false,
|
||||
"fontSize": 13,
|
||||
"fontFamily": 5,
|
||||
"text": "미삭제 시 통과",
|
||||
"text": "같은 헤더",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "미삭제 시 통과",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "edge-p-a",
|
||||
"type": "arrow",
|
||||
"x": 167.5,
|
||||
"y": 478.0,
|
||||
"width": 0.0,
|
||||
"height": 96.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "solid",
|
||||
"strokeWidth": 2,
|
||||
"strokeStyle": "solid",
|
||||
"roughness": 1,
|
||||
"opacity": 100,
|
||||
"groupIds": [],
|
||||
"frameId": null,
|
||||
"index": null,
|
||||
"roundness": null,
|
||||
"seed": 579930019,
|
||||
"version": 1,
|
||||
"versionNonce": 141204879,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"points": [
|
||||
[
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
48.0
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
48.0
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
96.0
|
||||
]
|
||||
],
|
||||
"lastCommittedPoint": null,
|
||||
"startBinding": {
|
||||
"elementId": "node-proxy",
|
||||
"focus": 0,
|
||||
"gap": 4
|
||||
},
|
||||
"endBinding": {
|
||||
"elementId": "node-app",
|
||||
"focus": 0,
|
||||
"gap": 4
|
||||
},
|
||||
"startArrowhead": null,
|
||||
"endArrowhead": "arrow",
|
||||
"elbowed": true
|
||||
},
|
||||
{
|
||||
"id": "edge-label-p-a",
|
||||
"type": "text",
|
||||
"x": 146.5,
|
||||
"y": 514.0,
|
||||
"width": 90,
|
||||
"height": 24,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"strokeStyle": "solid",
|
||||
"roughness": 0,
|
||||
"opacity": 100,
|
||||
"groupIds": [],
|
||||
"frameId": null,
|
||||
"index": null,
|
||||
"roundness": {
|
||||
"type": 3
|
||||
},
|
||||
"seed": 1931736220,
|
||||
"version": 1,
|
||||
"versionNonce": 15055194,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"fontSize": 13,
|
||||
"fontFamily": 5,
|
||||
"text": "인가 헤더",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "인가 헤더",
|
||||
"originalText": "같은 헤더",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "node-attacker",
|
||||
"type": "rectangle",
|
||||
"x": 82.5,
|
||||
"y": 60.0,
|
||||
"x": 70.0,
|
||||
"y": 125.0,
|
||||
"width": 170.0,
|
||||
"height": 84.0,
|
||||
"angle": 0,
|
||||
@@ -333,8 +333,8 @@
|
||||
{
|
||||
"id": "node-label-attacker",
|
||||
"type": "text",
|
||||
"x": 92.5,
|
||||
"y": 70.0,
|
||||
"x": 80.0,
|
||||
"y": 135.0,
|
||||
"width": 150.0,
|
||||
"height": 64.0,
|
||||
"angle": 0,
|
||||
@@ -372,9 +372,9 @@
|
||||
{
|
||||
"id": "node-nginx",
|
||||
"type": "rectangle",
|
||||
"x": 70.0,
|
||||
"y": 240.0,
|
||||
"width": 195.0,
|
||||
"x": 400.0,
|
||||
"y": 131.5,
|
||||
"width": 150.0,
|
||||
"height": 71.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
@@ -402,9 +402,9 @@
|
||||
{
|
||||
"id": "node-label-nginx",
|
||||
"type": "text",
|
||||
"x": 80.0,
|
||||
"y": 250.0,
|
||||
"width": 175.0,
|
||||
"x": 410.0,
|
||||
"y": 141.5,
|
||||
"width": 130.0,
|
||||
"height": 51.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
@@ -430,89 +430,20 @@
|
||||
"locked": false,
|
||||
"fontSize": 15,
|
||||
"fontFamily": 5,
|
||||
"text": "nginx\nproxy_set_header ... \"\"",
|
||||
"text": "nginx\n동명 헤더 미삭제",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "nginx\nproxy_set_header ... \"\"",
|
||||
"originalText": "nginx\n동명 헤더 미삭제",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "node-proxy",
|
||||
"id": "node-echo",
|
||||
"type": "rectangle",
|
||||
"x": 87.5,
|
||||
"y": 407.0,
|
||||
"width": 160.0,
|
||||
"height": 71.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "#fff4e6",
|
||||
"fillStyle": "solid",
|
||||
"strokeWidth": 2,
|
||||
"strokeStyle": "solid",
|
||||
"roughness": 1,
|
||||
"opacity": 100,
|
||||
"groupIds": [],
|
||||
"frameId": null,
|
||||
"index": null,
|
||||
"roundness": {
|
||||
"type": 3
|
||||
},
|
||||
"seed": 254112210,
|
||||
"version": 1,
|
||||
"versionNonce": 42167050,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"id": "node-label-proxy",
|
||||
"type": "text",
|
||||
"x": 97.5,
|
||||
"y": 417.0,
|
||||
"width": 140.0,
|
||||
"height": 51.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"strokeStyle": "solid",
|
||||
"roughness": 0,
|
||||
"opacity": 100,
|
||||
"groupIds": [],
|
||||
"frameId": null,
|
||||
"index": null,
|
||||
"roundness": {
|
||||
"type": 3
|
||||
},
|
||||
"seed": 418528669,
|
||||
"version": 1,
|
||||
"versionNonce": 1299542283,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"fontSize": 15,
|
||||
"fontFamily": 5,
|
||||
"text": "oauth2-proxy\n--set-xauthrequest",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "oauth2-proxy\n--set-xauthrequest",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "node-app",
|
||||
"type": "rectangle",
|
||||
"x": 92.5,
|
||||
"y": 574.0,
|
||||
"width": 150.0,
|
||||
"x": 745.0,
|
||||
"y": 60.0,
|
||||
"width": 174.0,
|
||||
"height": 71.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
@@ -528,9 +459,9 @@
|
||||
"roundness": {
|
||||
"type": 3
|
||||
},
|
||||
"seed": 594277328,
|
||||
"seed": 625814709,
|
||||
"version": 1,
|
||||
"versionNonce": 293358427,
|
||||
"versionNonce": 210846281,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
@@ -538,11 +469,11 @@
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"id": "node-label-app",
|
||||
"id": "node-label-echo",
|
||||
"type": "text",
|
||||
"x": 102.5,
|
||||
"y": 584.0,
|
||||
"width": 130.0,
|
||||
"x": 755.0,
|
||||
"y": 70.0,
|
||||
"width": 154.0,
|
||||
"height": 51.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
@@ -558,9 +489,9 @@
|
||||
"roundness": {
|
||||
"type": 3
|
||||
},
|
||||
"seed": 1055843055,
|
||||
"seed": 1277422196,
|
||||
"version": 1,
|
||||
"versionNonce": 1025494149,
|
||||
"versionNonce": 1238585544,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
@@ -568,11 +499,80 @@
|
||||
"locked": false,
|
||||
"fontSize": 15,
|
||||
"fontFamily": 5,
|
||||
"text": "앱\n로그인 시점 스냅샷",
|
||||
"text": "permitAll echo\n/api/echo · HTTP 200",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "앱\n로그인 시점 스냅샷",
|
||||
"originalText": "permitAll echo\n/api/echo · HTTP 200",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "node-protected",
|
||||
"type": "rectangle",
|
||||
"x": 710.0,
|
||||
"y": 203.0,
|
||||
"width": 244.0,
|
||||
"height": 71.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "#ffffff",
|
||||
"fillStyle": "solid",
|
||||
"strokeWidth": 2,
|
||||
"strokeStyle": "solid",
|
||||
"roughness": 1,
|
||||
"opacity": 100,
|
||||
"groupIds": [],
|
||||
"frameId": null,
|
||||
"index": null,
|
||||
"roundness": {
|
||||
"type": 3
|
||||
},
|
||||
"seed": 1165546669,
|
||||
"version": 1,
|
||||
"versionNonce": 1511744997,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"id": "node-label-protected",
|
||||
"type": "text",
|
||||
"x": 720.0,
|
||||
"y": 213.0,
|
||||
"width": 224.0,
|
||||
"height": 51.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"strokeStyle": "solid",
|
||||
"roughness": 0,
|
||||
"opacity": 100,
|
||||
"groupIds": [],
|
||||
"frameId": null,
|
||||
"index": null,
|
||||
"roundness": {
|
||||
"type": 3
|
||||
},
|
||||
"seed": 101710672,
|
||||
"version": 1,
|
||||
"versionNonce": 1663076746,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"fontSize": 15,
|
||||
"fontFamily": 5,
|
||||
"text": "JWT 보호 경로\n/api/me · /api/protected · 401",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "JWT 보호 경로\n/api/me · /api/protected · 401",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
}
|
||||
|
||||
+4
-4
@@ -2,22 +2,22 @@
|
||||
"harness_version": "0.2.0",
|
||||
"spec_id": "b4-header-trust-boundary",
|
||||
"spec_version": "1.1",
|
||||
"spec_sha256": "ad0e26787a9e508ddce08e196ceeaacf2dfe1ef2caa047537f4355b5e34739a1",
|
||||
"spec_sha256": "e395b6fd6e149bcaf143b2a8c71685720ecc099f79a443dd98690f2b19aae141",
|
||||
"source_context": {
|
||||
"document": "docs/keycloak-session-store/final/document.md",
|
||||
"document_sha256": "1d44cba1905544d92f1d26ae36a8deb64a3db3914d6b488fd30d6ae7f8cfbabe",
|
||||
"document_sha256": "28aef96a2bbb94fbb10ade26a71238fee62a5a4d9fa6e7749ae98cfd0a65e560",
|
||||
"anchor": {
|
||||
"kind": "heading",
|
||||
"value": "B-4 · Edge 인가의 범위 (Q4)",
|
||||
"line": 401
|
||||
"line": 821
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
"b4-header-trust-boundary.svg",
|
||||
"b4-header-trust-boundary.drawio",
|
||||
"b4-header-trust-boundary.mmd",
|
||||
"b4-header-trust-boundary.d2",
|
||||
"b4-header-trust-boundary.dot",
|
||||
"b4-header-trust-boundary.drawio",
|
||||
"b4-header-trust-boundary.excalidraw",
|
||||
"b4-header-trust-boundary.alt.md"
|
||||
],
|
||||
|
||||
+7
-7
@@ -1,12 +1,12 @@
|
||||
%% 지우지 않으면 통과한다
|
||||
%% question: Edge 가 넣어주는 인가 헤더를 앱이 믿어도 되는가
|
||||
flowchart TB
|
||||
%% 헤더 도착과 인가 우회는 다르다
|
||||
%% question: 같은 위조 헤더가 도착하는 것과 인가를 우회하는 것은 같은가
|
||||
flowchart LR
|
||||
n0(["외부 위조 헤더"])
|
||||
n1{"nginx"}
|
||||
n2{"oauth2-proxy"}
|
||||
n3["앱"]
|
||||
n2["permitAll echo"]
|
||||
n3["JWT 보호 경로"]
|
||||
n0 -->|"위조 헤더"| n1
|
||||
n1 -->|"미삭제 시 통과"| n2
|
||||
n2 -->|"인가 헤더"| n3
|
||||
n1 -->|"그대로 전달"| n2
|
||||
n1 -->|"같은 헤더"| n3
|
||||
classDef external stroke-dasharray: 6 4
|
||||
class n0 external
|
||||
|
||||
+30
-30
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="680" height="690" viewBox="0 0 680 690" role="img" aria-labelledby="diagram-title diagram-description">
|
||||
<title id="diagram-title">지우지 않으면 통과한다</title>
|
||||
<desc id="diagram-description">nginx 는 자기가 proxy_set_header 로 설정한 헤더만 덮어쓴다. 설정하지 않은 이름은 클라이언트가 보낸 값이 그대로 지나간다. 그래서 X-Auth-Request-Roles 같은 헤더를 앱이 믿으려면 프록시가 그 이름을 먼저 빈 값으로 지워야 한다. 그리고 IdP 에서 클레임을 바꿔도 반영되지 않는다. 12회 요청 6초 동안 옛 값이 갔고 세션을 지워 재인증한 뒤에야 새 값이 왔다. 세션은 로그인 시점의 스냅샷이다.</desc>
|
||||
<metadata>{"techviz":{"spec_version":"1.1","id":"b4-header-trust-boundary","profile":"component-flow"},"source_context":{"document":"docs/keycloak-session-store/final/document.md","document_sha256":"1d44cba1905544d92f1d26ae36a8deb64a3db3914d6b488fd30d6ae7f8cfbabe","anchor":{"kind":"heading","value":"B-4 · Edge 인가의 범위 (Q4)","line":401}},"evidence_policy":"Each factual element cites source lines or is marked assumption.","diagram_only":true}</metadata>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="999" height="319" viewBox="0 0 999 319" role="img" aria-labelledby="diagram-title diagram-description">
|
||||
<title id="diagram-title">헤더 도착과 인가 우회는 다르다</title>
|
||||
<desc id="diagram-description">위조 헤더는 app1.hyeonworks.com/api 의 permitAll echo 앱까지 그대로 도착했다. 같은 헤더로 JWT 를 요구하는 /api/me 와 /api/protected 를 호출하면 401이었다. 따라서 헤더 도착과 인가 우회는 다른 사건이다. proxy_set_header 로 먼저 지우는 것은 문서에 적힌 처방이지만 이 실험대에서는 적용하지 않아 미검증이다.</desc>
|
||||
<metadata>{"techviz":{"spec_version":"1.1","id":"b4-header-trust-boundary","profile":"component-flow"},"source_context":{"document":"docs/keycloak-session-store/final/document.md","document_sha256":"28aef96a2bbb94fbb10ade26a71238fee62a5a4d9fa6e7749ae98cfd0a65e560","anchor":{"kind":"heading","value":"B-4 · Edge 인가의 범위 (Q4)","line":821}},"evidence_policy":"Each factual element cites source lines or is marked assumption.","diagram_only":true}</metadata>
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M 0 0 L 10 5 L 0 10 z" />
|
||||
@@ -49,36 +49,36 @@
|
||||
.timeline-detail { font-size: 11px; fill: #4b5563; text-anchor: middle; }
|
||||
</style>
|
||||
</defs>
|
||||
<rect class="canvas" width="680" height="690" />
|
||||
<polyline class="edge kind-request style-solid emphasis-normal" points="167.5,144.0 167.5,192.0 167.5,192.0 167.5,240.0" data-evidence="393-400" />
|
||||
<rect class="edge-label-bg" x="165.8" y="178.0" width="51.5" height="22" rx="3" />
|
||||
<text class="edge-label" x="191.5" y="193.0">위조 헤더</text>
|
||||
<polyline class="edge kind-request style-solid emphasis-normal" points="167.5,311.0 167.5,359.0 167.5,359.0 167.5,407.0" data-evidence="393-400" />
|
||||
<rect class="edge-label-bg" x="155.7" y="345.0" width="71.6" height="22" rx="3" />
|
||||
<text class="edge-label" x="191.5" y="360.0">미삭제 시 통과</text>
|
||||
<polyline class="edge kind-request style-solid emphasis-normal" points="167.5,478.0 167.5,526.0 167.5,526.0 167.5,574.0" data-evidence="393-408" />
|
||||
<rect class="edge-label-bg" x="165.8" y="512.0" width="51.5" height="22" rx="3" />
|
||||
<text class="edge-label" x="191.5" y="527.0">인가 헤더</text>
|
||||
<rect class="canvas" width="999" height="319" />
|
||||
<polyline class="edge kind-request style-solid emphasis-normal" points="240.0,167.0 320.0,167.0 320.0,167.0 400.0,167.0" data-evidence="823-830" />
|
||||
<rect class="edge-label-bg" x="294.2" y="125.0" width="51.5" height="22" rx="3" />
|
||||
<text class="edge-label" x="320.0" y="140.0">위조 헤더</text>
|
||||
<polyline class="edge kind-request style-solid emphasis-normal" points="550.0,158.0 647.5,158.0 647.5,95.5 745.0,95.5" data-evidence="825-840" />
|
||||
<rect class="edge-label-bg" x="642.4" y="112.8" width="58.2" height="22" rx="3" />
|
||||
<text class="edge-label" x="671.5" y="127.8">그대로 전달</text>
|
||||
<polyline class="edge kind-request style-solid emphasis-normal" points="550.0,176.0 630.0,176.0 630.0,238.5 710.0,238.5" data-evidence="832-840" />
|
||||
<rect class="edge-label-bg" x="628.2" y="193.2" width="51.5" height="22" rx="3" />
|
||||
<text class="edge-label" x="654.0" y="208.2">같은 헤더</text>
|
||||
<g id="node-attacker">
|
||||
<g class="actor-symbol emphasis-warning" data-evidence="393-400"><circle cx="167.5" cy="80.0" r="11.0" /><line x1="167.5" y1="96.0" x2="167.5" y2="105.0" /><line x1="149.5" y1="106.0" x2="185.5" y2="106.0" /><line x1="167.5" y1="105.0" x2="152.5" y2="122.0" /><line x1="167.5" y1="105.0" x2="182.5" y2="122.0" /></g>
|
||||
<text class="node-label" x="167.5" y="137.0">외부 위조 헤더</text>
|
||||
<g class="actor-symbol emphasis-warning" data-evidence="823-830"><circle cx="155.0" cy="145.0" r="11.0" /><line x1="155.0" y1="161.0" x2="155.0" y2="180.0" /><line x1="137.0" y1="171.0" x2="173.0" y2="171.0" /><line x1="155.0" y1="180.0" x2="140.0" y2="197.0" /><line x1="155.0" y1="180.0" x2="170.0" y2="197.0" /></g>
|
||||
<text class="node-label" x="155.0" y="202.0">외부 위조 헤더</text>
|
||||
</g>
|
||||
<g id="node-nginx">
|
||||
<polygon class="node-shape kind-gateway emphasis-warning role-control" data-evidence="393-400" points="167.5,240.0 265.0,275.5 167.5,311.0 70.0,275.5" />
|
||||
<text class="node-label" x="167.5" y="267.0">nginx</text>
|
||||
<line class="node-detail-divider" x1="84.0" y1="288.0" x2="251.0" y2="288.0" />
|
||||
<text class="node-detail" x="86.0" y="305.0">proxy_set_header ... ""</text>
|
||||
<polygon class="node-shape kind-gateway emphasis-warning role-control" data-evidence="829-830" points="475.0,131.5 550.0,167.0 475.0,202.5 400.0,167.0" />
|
||||
<text class="node-label" x="475.0" y="158.5">nginx</text>
|
||||
<line class="node-detail-divider" x1="414.0" y1="179.5" x2="536.0" y2="179.5" />
|
||||
<text class="node-detail" x="416.0" y="196.5">동명 헤더 미삭제</text>
|
||||
</g>
|
||||
<g id="node-proxy">
|
||||
<polygon class="node-shape kind-gateway emphasis-normal role-control" data-evidence="393-400" points="167.5,407.0 247.5,442.5 167.5,478.0 87.5,442.5" />
|
||||
<text class="node-label" x="167.5" y="434.0">oauth2-proxy</text>
|
||||
<line class="node-detail-divider" x1="101.5" y1="455.0" x2="233.5" y2="455.0" />
|
||||
<text class="node-detail" x="103.5" y="472.0">--set-xauthrequest</text>
|
||||
<g id="node-echo">
|
||||
<rect class="node-shape kind-service emphasis-normal role-target" data-evidence="825-840" x="745.0" y="60.0" width="174.0" height="71.0" rx="7" />
|
||||
<text class="node-label" x="832.0" y="87.0">permitAll echo</text>
|
||||
<line class="node-detail-divider" x1="759.0" y1="108.0" x2="905.0" y2="108.0" />
|
||||
<text class="node-detail" x="761.0" y="125.0">/api/echo · HTTP 200</text>
|
||||
</g>
|
||||
<g id="node-app">
|
||||
<rect class="node-shape kind-service emphasis-primary role-target" data-evidence="401-408" x="92.5" y="574.0" width="150.0" height="71.0" rx="7" />
|
||||
<text class="node-label" x="167.5" y="601.0">앱</text>
|
||||
<line class="node-detail-divider" x1="106.5" y1="622.0" x2="228.5" y2="622.0" />
|
||||
<text class="node-detail" x="108.5" y="639.0">로그인 시점 스냅샷</text>
|
||||
<g id="node-protected">
|
||||
<rect class="node-shape kind-service emphasis-primary role-target" data-evidence="832-840" x="710.0" y="203.0" width="244.0" height="71.0" rx="7" />
|
||||
<text class="node-label" x="832.0" y="230.0">JWT 보호 경로</text>
|
||||
<line class="node-detail-divider" x1="724.0" y1="251.0" x2="940.0" y2="251.0" />
|
||||
<text class="node-detail" x="726.0" y="268.0">/api/me · /api/protected · 401</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 6.9 KiB |
Reference in New Issue
Block a user