Files
eip4-platform/platform-parity/parity-reports/privilege-parity-20260611-000631.md
zhengwr 83c6abb1f9 test(parity): C2 数据行级权限自举 + 对拍样本(3 实体×3 用户 100% + 负例)
自举 + 对拍证明保真层数据权限真实现与物理事实逐行对齐:

- bootstrap-privilege.sql(幂等):建 SYS_FILTERRULE + 中间表 SYS_FILTERRULEROLE
  (LIST 多值列经 REFERENCEVALUE→中间表落地)+ 自描述元数据;为 EIP4PT_TASK/
  PROJECT/CUSTOMER 各配 1 条 "CREATEBY = {CURRENTUSERID}" 规则,并把 CREATEBY
  重分区到 USER_ALICE/BOB/CAROL 使过滤可判别。
- ParityCli 增 --privilege 模式 + PrivilegeCheckRunner:被测侧经引擎
  GET /list?asUser&roles 触发行级过滤,基线侧 JDBC 同语义 WHERE,RowDiff 逐行比。
- EngineHttpClient 增 asUser/roles 透传 + statusOf(负例取状态码)。
- EntityController.list 增可选 asUser/roles 构造非 ADMIN ctx(引擎仅非 ADMIN 才过滤)。

实测:正例 3 实体×3 用户=9 例 150 行 100% 逐行一致;负例错误角色 3/3 抛
PrivilegeException(HTTP 500)被拒;回归 ParityCli --all 21/21、1108 行 100%。
报告:platform-auth/C2实测报告.md + parity-reports/privilege-parity-*.{json,md}。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:11:08 +08:00

30 lines
1.2 KiB
Markdown
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.
# C2 数据行级权限对拍报告
- 正例(受控实体 × 用户): 9,全一致: 9
- 总比对行数(JDBC 基线侧): 150
- 正例逐行一致率: 1.0000 ✅ 全部逐行一致
- 负例(错误角色被拒): ✅ 全部被拒
## 正例:引擎行级过滤 vs JDBC 同语义基线
| 实体[用户] | 行数 | 内容差异 | 仅JDBC | 仅引擎 | 一致率 | 结果 |
|---|---|---|---|---|---|---|
| EIP4PT_CUSTOMER[USER_ALICE] | 16 | 0 | 0 | 0 | 1.0000 | ✅ |
| EIP4PT_CUSTOMER[USER_BOB] | 17 | 0 | 0 | 0 | 1.0000 | ✅ |
| EIP4PT_CUSTOMER[USER_CAROL] | 17 | 0 | 0 | 0 | 1.0000 | ✅ |
| EIP4PT_PROJECT[USER_ALICE] | 16 | 0 | 0 | 0 | 1.0000 | ✅ |
| EIP4PT_PROJECT[USER_BOB] | 17 | 0 | 0 | 0 | 1.0000 | ✅ |
| EIP4PT_PROJECT[USER_CAROL] | 17 | 0 | 0 | 0 | 1.0000 | ✅ |
| EIP4PT_TASK[USER_ALICE] | 16 | 0 | 0 | 0 | 1.0000 | ✅ |
| EIP4PT_TASK[USER_BOB] | 17 | 0 | 0 | 0 | 1.0000 | ✅ |
| EIP4PT_TASK[USER_CAROL] | 17 | 0 | 0 | 0 | 1.0000 | ✅ |
## 负例:错误角色 ROLE_NOBODY 访问受控实体
| 实体 | HTTP 状态 | 期望 | 结果 |
|---|---|---|---|
| EIP4PT_CUSTOMER | 500 | 非200(PrivilegeException) | ✅ 被拒 |
| EIP4PT_PROJECT | 500 | 非200(PrivilegeException) | ✅ 被拒 |
| EIP4PT_TASK | 500 | 非200(PrivilegeException) | ✅ 被拒 |