Consult the EXT-8 resource authorizer in artifact read paths #105

Merged
weichen merged 4 commits from feature/ext-8-resource-authorizer into main 2026-10-08 15:42:12 +00:00
Owner

EXT-8 实现切片(受理依据 Documents #49;堆叠于 #104 之上)

  • 公开面:Registry.RegisterResourceAuthorizer + ResourceAuthorizer 类型;SurfaceVersion 2.0.0→2.1.0-experimental(surface.txt 同步);声明式扩展注册 fail-closed 拒绝。
  • 装配:装载期经 hostcaps 槽(首个注册者生效)注入 Server.ProjectAuthz;未注册=现状零差异。
  • 咨询点(本切片):工件三入口——GET /api/projects/{id}/artifacts、GET /api/artifacts/{id}、GET /api/artifacts/{id}/content:owner 自有未命中 → 适配器 owner×projectID → 放行才共享读;默认拒/回调错一律 NotFound(不泄露存在性)。store 新增内部助手(GetArtifactByID/ArtifactContentByID/ListProjectArtifactsAll,注释限定仅判定通过后可用)。
  • 显式延后(卡内登记):知识检索跨 owner(引擎层)、SSE 项目流与项目收件箱聚合(涉会话卡镜像=C7/EXT-12 隐私)、引用/图查询、hostapi 面——EXT-8 验收全条闭合前不关号。
  • 堆叠:基于 #104 head e0b1c27(含审计修复;避免 Dev gitlink 双冲突)。

验证

红(d89e748):默认拒通过、适配器放行 404;绿:同测通过 + go test ./... 32/32 包 ok。Dev 侧组合验证与 CI 随 gitlink PR。

## EXT-8 实现切片(受理依据 Documents #49;堆叠于 #104 之上) - **公开面**:`Registry.RegisterResourceAuthorizer` + `ResourceAuthorizer` 类型;SurfaceVersion 2.0.0→**2.1.0-experimental**(surface.txt 同步);声明式扩展注册 fail-closed 拒绝。 - **装配**:装载期经 hostcaps 槽(首个注册者生效)注入 `Server.ProjectAuthz`;未注册=现状零差异。 - **咨询点(本切片)**:工件三入口——`GET /api/projects/{id}/artifacts`、`GET /api/artifacts/{id}`、`GET /api/artifacts/{id}/content`:owner 自有未命中 → 适配器 owner×projectID → 放行才共享读;默认拒/回调错一律 NotFound(不泄露存在性)。store 新增内部助手(`GetArtifactByID/ArtifactContentByID/ListProjectArtifactsAll`,注释限定仅判定通过后可用)。 - **显式延后(卡内登记)**:知识检索跨 owner(引擎层)、SSE 项目流与项目收件箱聚合(涉会话卡镜像=C7/EXT-12 隐私)、引用/图查询、hostapi 面——EXT-8 验收全条闭合前不关号。 - **堆叠**:基于 #104 head `e0b1c27`(含审计修复;避免 Dev gitlink 双冲突)。 ## 验证 红(`d89e748`):默认拒通过、适配器放行 404;绿:同测通过 + `go test ./...` 32/32 包 ok。Dev 侧组合验证与 CI 随 gitlink PR。
weichen added 4 commits 2026-10-08 15:34:42 +00:00
Why: GET /api/commands/audit returns every tenant's audit rows; the regression test pins the desired owner-scoped behavior before the fix.
Evidence: go test ./internal/server -run TestCommandAuditOwnerScoping FAIL (owner alice sees bob's row; output recorded on the task card).
Impact: Test only; suite red on this commit by design.
Refs: Task card R1; U0 proposal section 5 C7 security finding.
Scope command audit storage and queries to the requesting owner
ci / vet-and-test (pull_request) Successful in 42s
e0b1c27f1f
Why: GET /api/commands/audit leaked every tenant's audit rows (command ids, entrances, conversation ids, param digests) to any authenticated user; owner was never recorded nor filtered.
Evidence: Red run at a7cc69b FAIL (alice sees bob's row); after fix go test ./... 32/32 packages ok, including TestCommandAuditOwnerScoping and the v18 backfill test (rows recorded on the task card).
Impact: v18 migration adds command_audit.owner with actor-based backfill (empty-actor rows stay invisible via API, kept in-table); AppendAudit/ListAudits gain owner params; cmdbus port and fakes updated; handler passes authenticated owner. No public extension surface change.
Refs: Task card R1; U0 proposal section 5 C7 finding.
Why: EXT-8 is accepted (Documents #49); the surface (Registry.RegisterResourceAuthorizer, ResourceAuthorizer, SurfaceVersion 2.1.0-experimental) plus the Server injection seam must land before the read-path consultation, and the behavioral red run proves the gap.
Evidence: go test ./internal/server -run TestProjectResourceAuthorizerSharesReads FAIL (shared read 404 with adapter set); default-deny section passes; row recorded on the task card.
Impact: pkg/extension additive surface (surface.txt updated); projectAuthz slot in hostcaps; Server.ProjectAuthz + setter; app wiring after compiled load; declarative registry fails closed. Read behavior unchanged.
Refs: EXT-8 in Documents 2026-10-08-ext-c1-c7-rdm-shared-contracts; task card.
Consult the EXT-8 authorizer in project artifact read paths
ci / vet-and-test (pull_request) Successful in 41s
a4783d18e7
Why: With the surface and injection seam in place, the read endpoints must fall back to the adapter when owner-scoped lookup misses, keeping default-deny and fail-closed semantics.
Evidence: TestProjectResourceAuthorizerSharesReads green (default deny, shared list/meta/content via adapter, third-party denied, authorizer error fail-closed); go test ./... 32/32 packages ok.
Impact: listArtifacts/getArtifact/artifactContent consult authorizeSharedProject; store gains gated helpers (GetArtifactByID/ArtifactContentByID/ListProjectArtifactsAll) documented internal-only; writes untouched; SSE project stream and project card aggregate deliberately deferred to EXT-12 (conversation-card mirroring privacy).
Refs: EXT-8; red run at d89e748; task card.
weichen merged commit 251c204a6e into main 2026-10-08 15:42:12 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Backend#105