Commit be90dea
* fix(plugin-audit,rest)!: sys_comment 的访问权从 thread_id 指向的记录继承 (#4630)
sys_attachment 的可见性由父记录派生,sys_comment 什么都不派生:同一条
记录、同一个用户,两者答案不同 —— 读不到 opportunity 的 rep2 依然能列出
它下面的评论,并且能 POST 一条(连 `"crm_opportunity:"` 这种空 id 的悬空
thread 也 201)。sys_comment 是 public、无 owner 列、父记录藏在 thread_id
字符串里,所以 OWD/sharing 与 RLS 从来没有收窄过它;而 enable.feeds 是
opt-out(spec 默认 true),于是每个应用的每个对象都挂着这条组织级可读可写
的旁路。
AuditPlugin 现在装上 service-storage 给 sys_attachment 装的同一套两件套,
按 thread_id 的 `{object_name}:{record_id}` 解析父记录:
- 读侧:find/findOne/count/aggregate 中间件把查询与"调用者真的读得到的
thread"求交(用调用者上下文探测父对象,父对象自己的 OWD/sharing/RLS/
对象级 CRUD 说了算)。count() 与 find() 同样被过滤,列表 total 不会泄露
被隐藏行的存在。
- 写侧:beforeInsert 要求对父记录可读(能看见的记录就能讨论);
beforeUpdate / beforeDelete 要求调用者是评论作者,或对父记录有 EDIT
(attachment 的 uploader-or-parent-editor 规则)。author_id 由服务端按
会话盖章,客户端传的值永远不生效 —— 否则"作者可删"本身就可伪造。
全部 fail closed:解析不出记录的 thread_id(悬空空 id、自由文本、指向
sys_comment 自身)写入拒绝、读取排除;过滤器算不出来就 deny-all。拒绝统一
答 403 `RECORD_NOT_ACCESSIBLE` —— 按 ADR-0112 的账本约定,通用权限条件用
标准目录里的码而不是新造同义词;`error.object` 报父记录的对象名,REST 的
映射分支与 attachment/feeds 两个网关同形。
正交且未改动:enable.feeds(FEEDS_DISABLED)仍然只管"这个对象有没有评论",
匿名调用仍然在这一切之前 401。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Br2xsJsczFsTR9bvbh2Ny
* fix(plugin-audit): sharing 槽位查找带上契约类型,不再擦除为 any (#4251 棘轮)
`check:slot-lookup` 报 audit-plugin.ts 的擦除计数 1 → 2:文件的祖父豁免只
保存量点位,新点位必须带 slot 的契约类型。
- `ctx.getService<ISharingService>('sharing')` —— 用真的契约接口。
- `CommentSharingLike` 从本地手写接口改为 `Pick<ISharingService, 'canEdit'>`:
"只用 canEdit"这个窄面是有意的,再手写一份它的形状不是(PD #12,一份契约
不要方言);`callerContext` 的返回类型同步换成 `SharingExecutionContext`。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Br2xsJsczFsTR9bvbh2Ny
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 05d8a54 commit be90dea
11 files changed
Lines changed: 1713 additions & 1 deletion
File tree
- .changeset
- packages
- plugins/plugin-audit/src
- qa/dogfood/test
- fixtures
- rest/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
130 | 165 | | |
131 | 166 | | |
132 | 167 | | |
| |||
0 commit comments