Repository navigation
feat(core): isolate the supplier portal by a contact membership key (v0.6 U2) - #88
Merged
Merged
Conversation
Implements v0.6 U2 (#78). The time-boxed test of ObjectSchema.membershipKeys (18.1.0) passed, so the portal uses scheme B: ADR-0010 supersedes ADR-0003. - srm_supplier_contact gains portal_user (flow-only) and declares the membership key portal_supplier_ids (portal_user -> supplier, active only). - Static positions srm_portal_user / srm_portal_admin and permission sets srm_portal_supplier / srm_portal_admin; every portal RLS reads the key. - External members only see private objects through a share, so the application, change request and contract get read sharing rules to srm_portal_user; the RLS narrows them to the own supplier. - srm_disposition_apply clears portal_user on elimination and blacklisting. - test/portal-isolation.test.ts covers 04 §3.7 (except sealed bids, v0.7) plus metadata guards that fail if a portal object loses its RLS. - portal_position, its prefix rule and the backfill flow are dropped from the design; AGENTS.md red line 2, 02/03/04/06/07 and the pack drafts follow. Claude-Session: https://claude.ai/code/session_017ihL2dk71wiRBasBp9drzu Co-authored-by: Claude <noreply@anthropic.com>
Resolve 04 §3.3 and 07 §6.2 against the U1 platform checks (#87): keep the invite-only prerequisite and the org-admin provisioning path, drop the per-supplier position steps, and record V4 as rechecked on the formal metadata. V6 stays the v0.6 exit condition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2dk71wiRBasBp9drzu
This was referenced Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by 田騏 · project thread
Closes #78.
改了什么
限时验证结论:通过 → 方案 B。 按总监裁定先测
ObjectSchema.membershipKeys(18.1.0),门户用户按组织角色external、托管同一套plugin-security、fail-closed、04 §3.7 用例全部通过,所以写 ADR-0010 取代 ADR-0003(总监线程已认可,并提了 4 个条件,下面逐条落实)。srm_supplier_contact.portal_user(user,字段级只读,只由 flow 写)+ 成员键portal_supplier_ids(userField: portal_user、valueField: supplier、filter: active == true)。srm_portal_supplier/srm_portal_admin(src/core/security/portal-permission-sets.ts):每条 RLS 都读current_user.portal_supplier_ids;合同只放行签署中及以后,考评单只放行已发布 / 申诉中;供应商只能改资料字段,证书只能新建(不能自带已核验),门户管理员可新增联系人与银行账户、看完整账号。都不设isDefault。srm_portal_user、srm_portal_admin,不再每家供应商建岗位。external成员,权限集 RLS 只解除public_read对象的「仅本人」下限,解除不了private(方案 A 同样会碰到)。准入申请、变更单、合同各加一条只授srm_portal_user的读共享规则(合同只共享可见状态),再由 RLS 限定本公司。srm_disposition_apply在淘汰 / 拉黑时清掉该供应商联系人上的portal_user,下一个请求即失效(总监条件 4)。portal_position不加(从未合入),前缀校验和回填 flow 一并取消。临时做法
srm_supplier.risk_level暂时对门户可读:平台默认搜索会扫描选项字段且不跳过调用者读不到的字段,隐藏它会让门户的供应商搜索整体 403。就是 objectstack#25672(主干已修、18.1.0 未含),没有另提 issue;升级后改回隐藏。怎么验证的
test/portal-isolation.test.ts(26 条):srm_portal_user,对象上必须有这条 RLS;不设 isDefault、不授删除 / 全量读写 / 导出;每个带供应商引用的对象要么授给门户,要么写明理由;字段权限里的字段名都存在。pnpm validate/lint/typecheck/i18n:check/test(276 通过,1 条负载测试照常跳过)/build全绿;governance/scripts/build.py --check(含三个扩展包)通过;文档相对链接无新增失效。Generated by Claude Code