refactor: 문서 개선 중
This commit is contained in:
+10
-10
@@ -1,22 +1,22 @@
|
||||
# 격리가 성립하는 세 조건
|
||||
# PostgreSQL RLS 적용 여부를 가르는 분기
|
||||
|
||||
## Alternative text
|
||||
|
||||
격리 판정이 ENABLE RLS 와 FORCE RLS 와 BYPASSRLS 없는 롤을 차례로 확인하는 순서.
|
||||
RLS 비활성은 policy 미적용으로, superuser와 BYPASSRLS는 우회로, owner는 FORCE 여부로 갈리고, policy 대상인데 applicable policy가 없으면 default deny가 되는 흐름도
|
||||
|
||||
## Long description
|
||||
|
||||
SSOT 는 RlsPolicyVerifier.requireEnforced 가 런타임 롤의 BYPASSRLS 를 확인하고 current_schema() 의 실제 테이블을 순회하며 tenant-scoped 목록에 든 것만 검사한다고 적는다.
|
||||
PostgreSQL RLS를 세 개의 동시 전제로 보지 않는다. RLS가 활성화된 뒤 superuser 또는 BYPASSRLS인지, table owner인지와 FORCE RLS 여부를 확인한다. policy 대상 role에 applicable policy가 없으면 default deny이고, policy가 있으면 USING과 WITH CHECK를 평가한다.
|
||||
|
||||
## Elements and evidence
|
||||
|
||||
- **격리 판정** (service): No additional description. Evidence: L7396–L7420.
|
||||
- **RlsPolicyVerifier** (service): No additional description. Evidence: L7396–L7420.
|
||||
- **데이터베이스** (database): No additional description. Evidence: L7396–L7426.
|
||||
- **Boundary: policy 적용 대상 판정** (boundary): No additional description. Evidence: L7400–L7432.
|
||||
- **Boundary: policy 존재와 평가** (boundary): No additional description. Evidence: L7400–L7432.
|
||||
- **RLS 활성 여부** (process): No additional description. Evidence: L7400–L7432.
|
||||
- **policy 적용 대상** (process): No additional description. Evidence: L7400–L7432.
|
||||
- **applicable policy** (process): No additional description. Evidence: L7400–L7432.
|
||||
|
||||
## Relationships
|
||||
|
||||
- **격리 판정 → RlsPolicyVerifier:** 검증 요청. Evidence: L7396–L7420.
|
||||
- **RlsPolicyVerifier → 데이터베이스:** ENABLE RLS 확인. Evidence: L7396–L7420.
|
||||
- **RlsPolicyVerifier → 데이터베이스:** FORCE RLS 확인. Evidence: L7396–L7420.
|
||||
- **RlsPolicyVerifier → 데이터베이스:** BYPASSRLS 없음 확인. Evidence: L7396–L7426.
|
||||
- **RLS 활성 여부 → policy 적용 대상:** RLS on. Evidence: L7400–L7432.
|
||||
- **policy 적용 대상 → applicable policy:** 적용. Evidence: L7400–L7432.
|
||||
|
||||
+16
-14
@@ -1,16 +1,18 @@
|
||||
# 격리가 성립하는 세 조건
|
||||
# Question: RLS 격리는 무엇이 동시에 참이어야 성립하는가?
|
||||
direction: right
|
||||
n0: "격리 판정" {
|
||||
shape: rectangle
|
||||
# PostgreSQL RLS 적용 여부를 가르는 분기
|
||||
# Question: 현재 role과 table에서 RLS policy가 실제로 적용되는가?
|
||||
direction: down
|
||||
g0: "policy 적용 대상 판정" {
|
||||
n0: "RLS 활성 여부" {
|
||||
shape: rectangle
|
||||
}
|
||||
n1: "policy 적용 대상" {
|
||||
shape: rectangle
|
||||
}
|
||||
}
|
||||
n1: "RlsPolicyVerifier" {
|
||||
shape: rectangle
|
||||
g1: "policy 존재와 평가" {
|
||||
n2: "applicable policy" {
|
||||
shape: rectangle
|
||||
}
|
||||
}
|
||||
n2: "데이터베이스" {
|
||||
shape: sql_table
|
||||
}
|
||||
n0 -> n1: "검증 요청"
|
||||
n1 -> n2: "ENABLE RLS 확인"
|
||||
n1 -> n2: "FORCE RLS 확인"
|
||||
n1 -> n2: "BYPASSRLS 없음 확인"
|
||||
g0.n0 -> g0.n1: "RLS on"
|
||||
g0.n1 -> g1.n2: "적용"
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
digraph techviz {
|
||||
graph [rankdir=TB, 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];
|
||||
subgraph cluster_0 {
|
||||
label="policy 적용 대상 판정";
|
||||
style="rounded,dashed";
|
||||
color="#66788a";
|
||||
n0 [label="RLS 활성 여부", shape=box, style="rounded,filled"];
|
||||
n1 [label="policy 적용 대상", shape=box, style="rounded,filled"];
|
||||
}
|
||||
subgraph cluster_1 {
|
||||
label="policy 존재와 평가";
|
||||
style="rounded,dashed";
|
||||
color="#66788a";
|
||||
n2 [label="applicable policy", shape=box, style="rounded,filled"];
|
||||
}
|
||||
n0 -> n1 [label="RLS on", style=solid];
|
||||
n1 -> n2 [label="적용", style=solid];
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?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="rls-three-preconditions" name="PostgreSQL RLS 적용 여부를 가르는 분기">
|
||||
<mxGraphModel dx="860" dy="300" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="860" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0"/>
|
||||
<mxCell id="1" parent="0"/>
|
||||
<mxCell id="g_role" value="policy 적용 대상 판정" style="swimlane;html=1;rounded=1;startSize=30;horizontal=1;dashed=1;strokeWidth=1.5;fillColor=#f7f9fb;strokeColor=#66788a;fontStyle=1;fontSize=13;" vertex="1" parent="1">
|
||||
<mxGeometry x="45.0" y="49.0" width="470.0" height="177.0" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="g_policy-zone" value="policy 존재와 평가" style="swimlane;html=1;rounded=1;startSize=30;horizontal=1;dashed=1;strokeWidth=1.5;fillColor=#f7f9fb;strokeColor=#66788a;fontStyle=1;fontSize=13;" vertex="1" parent="1">
|
||||
<mxGeometry x="565.0" y="49.0" width="250.0" height="160.0" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="n_rls" value="RLS 활성 여부<br/>no → policy 미적용" tooltip="process | Evidence: L7400-L7432" 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="75.0" y="95.0" width="190.0" height="71.0" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="n_subject" value="policy 적용 대상<br/>superuser / BYPASSRLS → 우회<br/>owner + FORCE off → 우회<br/>non-owner 또는 owner + FORCE on → 대상" tooltip="process | Evidence: L7400-L7432" 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="295.0" y="95.0" width="190.0" height="105.0" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="n_policy" value="applicable policy<br/>none → default deny<br/>exists → USING / WITH CHECK 평가" tooltip="process | Evidence: L7400-L7432" 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="595.0" y="95.0" width="190.0" height="88.0" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="e_e1" value="RLS on" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_rls" target="n_subject">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="271.5" y="31.0" as="offset"/>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="e_e2" value="적용" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_subject" target="n_policy">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="564.0" y="143.2" as="offset"/>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
+564
@@ -0,0 +1,564 @@
|
||||
{
|
||||
"type": "excalidraw",
|
||||
"version": 2,
|
||||
"source": "techviz-harness",
|
||||
"elements": [
|
||||
{
|
||||
"id": "group-role",
|
||||
"type": "rectangle",
|
||||
"x": 45.0,
|
||||
"y": 49.0,
|
||||
"width": 470.0,
|
||||
"height": 177.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "#f8f9fa",
|
||||
"fillStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"strokeStyle": "dashed",
|
||||
"roughness": 0,
|
||||
"opacity": 100,
|
||||
"groupIds": [],
|
||||
"frameId": null,
|
||||
"index": null,
|
||||
"roundness": {
|
||||
"type": 3
|
||||
},
|
||||
"seed": 1777472244,
|
||||
"version": 1,
|
||||
"versionNonce": 1516900995,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"id": "group-label-role",
|
||||
"type": "text",
|
||||
"x": 61.0,
|
||||
"y": 55.0,
|
||||
"width": 135,
|
||||
"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": 715621186,
|
||||
"version": 1,
|
||||
"versionNonce": 87917954,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"fontSize": 14,
|
||||
"fontFamily": 5,
|
||||
"text": "policy 적용 대상 판정",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "policy 적용 대상 판정",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "group-policy-zone",
|
||||
"type": "rectangle",
|
||||
"x": 565.0,
|
||||
"y": 49.0,
|
||||
"width": 250.0,
|
||||
"height": 160.0,
|
||||
"angle": 0,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"backgroundColor": "#f8f9fa",
|
||||
"fillStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"strokeStyle": "dashed",
|
||||
"roughness": 0,
|
||||
"opacity": 100,
|
||||
"groupIds": [],
|
||||
"frameId": null,
|
||||
"index": null,
|
||||
"roundness": {
|
||||
"type": 3
|
||||
},
|
||||
"seed": 169725814,
|
||||
"version": 1,
|
||||
"versionNonce": 1032311414,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"id": "group-label-policy-zone",
|
||||
"type": "text",
|
||||
"x": 581.0,
|
||||
"y": 55.0,
|
||||
"width": 117,
|
||||
"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": 1265739546,
|
||||
"version": 1,
|
||||
"versionNonce": 1075054467,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"fontSize": 14,
|
||||
"fontFamily": 5,
|
||||
"text": "policy 존재와 평가",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "policy 존재와 평가",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "edge-e1",
|
||||
"type": "arrow",
|
||||
"x": 265.0,
|
||||
"y": 59.0,
|
||||
"width": 30.0,
|
||||
"height": 88.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": 71197658,
|
||||
"version": 1,
|
||||
"versionNonce": 618174464,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"points": [
|
||||
[
|
||||
0.0,
|
||||
71.5
|
||||
],
|
||||
[
|
||||
30.0,
|
||||
71.5
|
||||
],
|
||||
[
|
||||
30.0,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
0.0,
|
||||
88.5
|
||||
],
|
||||
[
|
||||
30.0,
|
||||
88.5
|
||||
]
|
||||
],
|
||||
"lastCommittedPoint": null,
|
||||
"startBinding": {
|
||||
"elementId": "node-rls",
|
||||
"focus": 0,
|
||||
"gap": 4
|
||||
},
|
||||
"endBinding": {
|
||||
"elementId": "node-subject",
|
||||
"focus": 0,
|
||||
"gap": 4
|
||||
},
|
||||
"startArrowhead": null,
|
||||
"endArrowhead": "arrow",
|
||||
"elbowed": true
|
||||
},
|
||||
{
|
||||
"id": "edge-label-e1",
|
||||
"type": "text",
|
||||
"x": 226.5,
|
||||
"y": 19.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": 246258267,
|
||||
"version": 1,
|
||||
"versionNonce": 768010045,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"fontSize": 13,
|
||||
"fontFamily": 5,
|
||||
"text": "RLS on",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "RLS on",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "edge-e2",
|
||||
"type": "arrow",
|
||||
"x": 485.0,
|
||||
"y": 139.0,
|
||||
"width": 110.0,
|
||||
"height": 8.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": 804950317,
|
||||
"version": 1,
|
||||
"versionNonce": 629875261,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"points": [
|
||||
[
|
||||
0.0,
|
||||
8.5
|
||||
],
|
||||
[
|
||||
55.0,
|
||||
8.5
|
||||
],
|
||||
[
|
||||
55.0,
|
||||
0.0
|
||||
],
|
||||
[
|
||||
110.0,
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"lastCommittedPoint": null,
|
||||
"startBinding": {
|
||||
"elementId": "node-subject",
|
||||
"focus": 0,
|
||||
"gap": 4
|
||||
},
|
||||
"endBinding": {
|
||||
"elementId": "node-policy",
|
||||
"focus": 0,
|
||||
"gap": 4
|
||||
},
|
||||
"startArrowhead": null,
|
||||
"endArrowhead": "arrow",
|
||||
"elbowed": true
|
||||
},
|
||||
{
|
||||
"id": "edge-label-e2",
|
||||
"type": "text",
|
||||
"x": 519.0,
|
||||
"y": 131.25,
|
||||
"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": 340809808,
|
||||
"version": 1,
|
||||
"versionNonce": 1429402641,
|
||||
"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": "node-rls",
|
||||
"type": "rectangle",
|
||||
"x": 75.0,
|
||||
"y": 95.0,
|
||||
"width": 190.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": 46671207,
|
||||
"version": 1,
|
||||
"versionNonce": 1454808113,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"id": "node-label-rls",
|
||||
"type": "text",
|
||||
"x": 85.0,
|
||||
"y": 105.0,
|
||||
"width": 170.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": 1139089945,
|
||||
"version": 1,
|
||||
"versionNonce": 19559202,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"fontSize": 15,
|
||||
"fontFamily": 5,
|
||||
"text": "RLS 활성 여부\nno → policy 미적용",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "RLS 활성 여부\nno → policy 미적용",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "node-subject",
|
||||
"type": "rectangle",
|
||||
"x": 295.0,
|
||||
"y": 95.0,
|
||||
"width": 190.0,
|
||||
"height": 105.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": 809707623,
|
||||
"version": 1,
|
||||
"versionNonce": 308999550,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"id": "node-label-subject",
|
||||
"type": "text",
|
||||
"x": 305.0,
|
||||
"y": 105.0,
|
||||
"width": 170.0,
|
||||
"height": 85.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": 651634604,
|
||||
"version": 1,
|
||||
"versionNonce": 1863011863,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"fontSize": 15,
|
||||
"fontFamily": 5,
|
||||
"text": "policy 적용 대상\nsuperuser / BYPASSRLS → 우회\nowner + FORCE off → 우회\nnon-owner 또는 owner + FORCE on → 대상",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "policy 적용 대상\nsuperuser / BYPASSRLS → 우회\nowner + FORCE off → 우회\nnon-owner 또는 owner + FORCE on → 대상",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"id": "node-policy",
|
||||
"type": "rectangle",
|
||||
"x": 595.0,
|
||||
"y": 95.0,
|
||||
"width": 190.0,
|
||||
"height": 88.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": 1953932615,
|
||||
"version": 1,
|
||||
"versionNonce": 1148359251,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false
|
||||
},
|
||||
{
|
||||
"id": "node-label-policy",
|
||||
"type": "text",
|
||||
"x": 605.0,
|
||||
"y": 105.0,
|
||||
"width": 170.0,
|
||||
"height": 68.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": 1771766625,
|
||||
"version": 1,
|
||||
"versionNonce": 252892369,
|
||||
"isDeleted": false,
|
||||
"boundElements": [],
|
||||
"updated": 0,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"fontSize": 15,
|
||||
"fontFamily": 5,
|
||||
"text": "applicable policy\nnone → default deny\nexists → USING / WITH CHECK 평가",
|
||||
"textAlign": "center",
|
||||
"verticalAlign": "middle",
|
||||
"containerId": null,
|
||||
"originalText": "applicable policy\nnone → default deny\nexists → USING / WITH CHECK 평가",
|
||||
"autoResize": true,
|
||||
"lineHeight": 1.25
|
||||
}
|
||||
],
|
||||
"appState": {
|
||||
"gridSize": 10,
|
||||
"viewBackgroundColor": "#ffffff",
|
||||
"currentItemFontFamily": 5
|
||||
},
|
||||
"files": {}
|
||||
}
|
||||
+11
-7
@@ -2,27 +2,31 @@
|
||||
"harness_version": "0.2.0",
|
||||
"spec_id": "rls-three-preconditions",
|
||||
"spec_version": "1.1",
|
||||
"spec_sha256": "f6268a244e162b30af9d251df67dbe2d8d3e23e84198f91656f865e0f5f96a1c",
|
||||
"spec_sha256": "f49733b25ed5a35fa7ebbe452adbf1a606aad7108643d443b43a9fae25d15ebf",
|
||||
"source_context": {
|
||||
"document": "/home/donghyeon/workspace/chat-gpt-container/document-haness/docs/clean-architecture-backend-template/final/document.md",
|
||||
"document_sha256": "8071fe71b3359d9cf60b95909c26c7b50653ce2f22bbc5fcf6988719bb91236d",
|
||||
"document": "docs/clean-architecture-backend-template/final/document.md",
|
||||
"document_sha256": "7c986b30b6ef3c12060b6749ee60d53e37d6994493d2703419732c9cab6077d8",
|
||||
"anchor": {
|
||||
"kind": "line",
|
||||
"value": 7398,
|
||||
"line": 7398
|
||||
"value": 7400,
|
||||
"line": 7400
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
"rls-three-preconditions.svg",
|
||||
"rls-three-preconditions.drawio",
|
||||
"rls-three-preconditions.mmd",
|
||||
"rls-three-preconditions.d2",
|
||||
"rls-three-preconditions.dot",
|
||||
"rls-three-preconditions.excalidraw",
|
||||
"rls-three-preconditions.alt.md"
|
||||
],
|
||||
"lint_issue_count": 0,
|
||||
"assumption_count": 0,
|
||||
"assumptions_allowed": false,
|
||||
"composition_profile": "sequence",
|
||||
"composition_profile": "two-zone-pipeline",
|
||||
"reference_ids": [
|
||||
"payment-approval-sequence"
|
||||
"localization-pipeline"
|
||||
],
|
||||
"diagram_only": true
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
%% PostgreSQL RLS 적용 여부를 가르는 분기
|
||||
%% question: 현재 role과 table에서 RLS policy가 실제로 적용되는가?
|
||||
flowchart TB
|
||||
subgraph g_role["policy 적용 대상 판정"]
|
||||
n0["RLS 활성 여부"]
|
||||
n1["policy 적용 대상"]
|
||||
end
|
||||
subgraph g_policy_zone["policy 존재와 평가"]
|
||||
n2["applicable policy"]
|
||||
end
|
||||
n0 -->|"RLS on"| n1
|
||||
n1 -->|"적용"| n2
|
||||
+38
-26
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="680" height="418" viewBox="0 0 680 418" role="img" aria-labelledby="diagram-title diagram-description">
|
||||
<title id="diagram-title">격리가 성립하는 세 조건</title>
|
||||
<desc id="diagram-description">SSOT 는 RlsPolicyVerifier.requireEnforced 가 런타임 롤의 BYPASSRLS 를 확인하고 current_schema() 의 실제 테이블을 순회하며 tenant-scoped 목록에 든 것만 검사한다고 적는다.</desc>
|
||||
<metadata>{"techviz":{"spec_version":"1.1","id":"rls-three-preconditions","profile":"sequence"},"source_context":{"document":"/home/donghyeon/workspace/chat-gpt-container/document-haness/docs/clean-architecture-backend-template/final/document.md","document_sha256":"8071fe71b3359d9cf60b95909c26c7b50653ce2f22bbc5fcf6988719bb91236d","anchor":{"kind":"line","value":7398,"line":7398}},"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="860" height="300" viewBox="0 0 860 300" role="img" aria-labelledby="diagram-title diagram-description">
|
||||
<title id="diagram-title">PostgreSQL RLS 적용 여부를 가르는 분기</title>
|
||||
<desc id="diagram-description">PostgreSQL RLS를 세 개의 동시 전제로 보지 않는다. RLS가 활성화된 뒤 superuser 또는 BYPASSRLS인지, table owner인지와 FORCE RLS 여부를 확인한다. policy 대상 role에 applicable policy가 없으면 default deny이고, policy가 있으면 USING과 WITH CHECK를 평가한다.</desc>
|
||||
<metadata>{"techviz":{"spec_version":"1.1","id":"rls-three-preconditions","profile":"two-zone-pipeline"},"source_context":{"document":"docs/clean-architecture-backend-template/final/document.md","document_sha256":"7c986b30b6ef3c12060b6749ee60d53e37d6994493d2703419732c9cab6077d8","anchor":{"kind":"line","value":7400,"line":7400}},"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,26 +49,38 @@
|
||||
.timeline-detail { font-size: 11px; fill: #4b5563; text-anchor: middle; }
|
||||
</style>
|
||||
</defs>
|
||||
<rect class="canvas" width="680" height="418" />
|
||||
<rect class="node-shape kind-service emphasis-normal role-participant" data-evidence="7396-7420" x="45.0" y="35.0" width="150.0" height="64.0" rx="7" />
|
||||
<text class="node-label" x="120.0" y="65.0">격리 판정</text>
|
||||
<line class="lifeline" x1="120.0" y1="99.0" x2="120.0" y2="388.0" />
|
||||
<rect class="node-shape kind-service emphasis-primary role-participant" data-evidence="7396-7420" x="255.0" y="35.0" width="153.0" height="64.0" rx="7" />
|
||||
<text class="node-label" x="331.5" y="65.0">RlsPolicyVerifier</text>
|
||||
<line class="lifeline" x1="331.5" y1="99.0" x2="331.5" y2="388.0" />
|
||||
<rect class="node-shape kind-database emphasis-normal role-participant" data-evidence="7396-7426" x="465.0" y="48.0" width="150.0" height="52.0" /><ellipse class="node-shape kind-database emphasis-normal role-participant" cx="540.0" cy="48.0" rx="75.0" ry="13.0" /><path class="storage-bottom" d="M 465.0 100.0 A 75.0 13.0 0 0 0 615.0 100.0" />
|
||||
<text class="node-label" x="540.0" y="75.0">데이터베이스</text>
|
||||
<line class="lifeline" x1="540.0" y1="113.0" x2="540.0" y2="388.0" />
|
||||
<polyline class="edge kind-request style-solid emphasis-normal" points="120.0,140.0 331.5,140.0" data-evidence="7396-7420" />
|
||||
<rect class="edge-label-bg" x="189.9" y="114.0" width="71.6" height="22" rx="3" />
|
||||
<text class="edge-label" x="225.8" y="129.0">1. 검증 요청</text>
|
||||
<polyline class="edge kind-request style-solid emphasis-normal" points="331.5,202.0 540.0,202.0" data-evidence="7396-7420" />
|
||||
<rect class="edge-label-bg" x="373.1" y="176.0" width="125.2" height="22" rx="3" />
|
||||
<text class="edge-label" x="435.8" y="191.0">2. ENABLE RLS 확인</text>
|
||||
<polyline class="edge kind-request style-solid emphasis-normal" points="331.5,264.0 540.0,264.0" data-evidence="7396-7420" />
|
||||
<rect class="edge-label-bg" x="376.5" y="238.0" width="118.5" height="22" rx="3" />
|
||||
<text class="edge-label" x="435.8" y="253.0">3. FORCE RLS 확인</text>
|
||||
<polyline class="edge kind-request style-solid emphasis-primary" points="331.5,326.0 540.0,326.0" data-evidence="7396-7426" />
|
||||
<rect class="edge-label-bg" x="366.4" y="300.0" width="138.6" height="22" rx="3" />
|
||||
<text class="edge-label" x="435.8" y="315.0">4. BYPASSRLS 없음 확인</text>
|
||||
<rect class="canvas" width="860" height="300" />
|
||||
<rect class="group-box" x="45.0" y="49.0" width="470.0" height="177.0" rx="8" />
|
||||
<rect class="group-label-bg" x="59.0" y="39.0" width="127.0" height="22" />
|
||||
<text class="group-label" x="69.0" y="54.0">policy 적용 대상 판정</text>
|
||||
<rect class="group-box" x="565.0" y="49.0" width="250.0" height="160.0" rx="8" />
|
||||
<rect class="group-label-bg" x="579.0" y="39.0" width="113.0" height="22" />
|
||||
<text class="group-label" x="589.0" y="54.0">policy 존재와 평가</text>
|
||||
<polyline class="edge kind-request style-solid emphasis-normal" points="265.0,130.5 295.0,130.5 295.0,59.0 265.0,59.0 265.0,147.5 295.0,147.5" data-evidence="7400-7432" />
|
||||
<rect class="edge-label-bg" x="242.4" y="17.0" width="58.2" height="22" rx="3" />
|
||||
<text class="edge-label" x="271.5" y="32.0">RLS on</text>
|
||||
<polyline class="edge kind-request style-solid emphasis-primary" points="485.0,147.5 540.0,147.5 540.0,139.0 595.0,139.0" data-evidence="7400-7432" />
|
||||
<rect class="edge-label-bg" x="542.0" y="129.2" width="44.0" height="22" rx="3" />
|
||||
<text class="edge-label" x="564.0" y="144.2">적용</text>
|
||||
<g id="node-rls">
|
||||
<rect class="node-shape kind-process emphasis-normal role-stage" data-evidence="7400-7432" x="75.0" y="95.0" width="190.0" height="71.0" rx="7" />
|
||||
<text class="node-label" x="170.0" y="122.0">RLS 활성 여부</text>
|
||||
<line class="node-detail-divider" x1="89.0" y1="143.0" x2="251.0" y2="143.0" />
|
||||
<text class="node-detail" x="91.0" y="160.0">no → policy 미적용</text>
|
||||
</g>
|
||||
<g id="node-subject">
|
||||
<rect class="node-shape kind-process emphasis-normal role-stage" data-evidence="7400-7432" x="295.0" y="95.0" width="190.0" height="105.0" rx="7" />
|
||||
<text class="node-label" x="390.0" y="122.0">policy 적용 대상</text>
|
||||
<line class="node-detail-divider" x1="309.0" y1="143.0" x2="471.0" y2="143.0" />
|
||||
<text class="node-detail" x="311.0" y="160.0">superuser / BYPASSRLS → 우회</text>
|
||||
<text class="node-detail" x="311.0" y="176.0">owner + FORCE off → 우회</text>
|
||||
<text class="node-detail" x="311.0" y="192.0">non-owner 또는 owner + FORCE on → 대상</text>
|
||||
</g>
|
||||
<g id="node-policy">
|
||||
<rect class="node-shape kind-process emphasis-primary role-stage" data-evidence="7400-7432" x="595.0" y="95.0" width="190.0" height="88.0" rx="7" />
|
||||
<text class="node-label" x="690.0" y="122.0">applicable policy</text>
|
||||
<line class="node-detail-divider" x1="609.0" y1="143.0" x2="771.0" y2="143.0" />
|
||||
<text class="node-detail" x="611.0" y="160.0">none → default deny</text>
|
||||
<text class="node-detail" x="611.0" y="176.0">exists → USING / WITH CHECK 평가</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.8 KiB |
Reference in New Issue
Block a user