docs(tasks): decompose review-002 into 24 tasks (23 implementation + 1 bracketed follow-up)

Decomposition of docs/reviews/002-post-remediation-review.md per its
5-unit remediation plan:

- Unit 1 (security-critical): gw15-publish-body-cap,
  prj16-schema-via-call (CF-004 filed alkcall-side), fwd13-dot-segments,
  fwd16-missing-capability, oai11-ref-memoization
- Unit 2 (timeout/terminality): ws13-idle-progress,
  fwd15-stream-timeout, cli01-retry-after-budget, con17-mcp-pagination,
  con18-wss-sweep-exit
- Unit 3 (projection/docs): projection-truthfulness, mcp-batch-cap,
  gw16-status-drift
- Unit 4 (spec-import): yaml-normalization, oai13-path-item-wildcards,
  import-loudness-cluster, js01-placeholder-check,
  fwd17-19-contract-decisions
- Unit 5 (WS polish + tests): con18b-ws-polish,
  client-policy-wire-tests, cov-deployment-knobs, cov13-dead-code,
  srv11-srv12-router-ordering
- review-002-bracketed-followup: tentatively planned post-bulk pass
  (stale-check, OQA-18 enforcement decision, CON-08/09 close() lever,
  cross-crate re-checks) — deliberately not serialized against the
  bulk

Also: review-002 numbering repair (CON-14 was double-booked; MCP
pagination now CON-14, from_wss monitor renumbered CON-18, missing
CON-14 section added).

taskgraph: 66 valid, no cycles; 24 pending (all review-002);
gen-1/gen-2 parallel waves identified; workflow-cost hotspots are
prj16 (12.8) and ws13 (11.1), both carrying the reviewed slicing
guidance in their Notes.
This commit is contained in:
2026-08-30 10:50:34 +00:00
parent 5452785f0d
commit e2c255d40c
25 changed files with 1679 additions and 10 deletions
@@ -0,0 +1,76 @@
---
id: review-002-prj16-schema-via-call
name: Block Internal-op schema disclosure via services/schema over /call (PRJ-16, cross-crate CF-004)
status: pending
depends_on: []
scope: moderate
risk: medium
impact: project
level: implementation
tags: [gateway, security, review-002, cross-crate]
---
## Description
Review 002 PRJ-16 [major, security]. Internal/ACL-restricted op specs
are readable through the *op* path even though the GET `/schema` route
was fixed in review-001 (SRV-02):
- `call_handler` (`src/gateway/routes.rs:120-133`) pre-checks only the
**outer** op name — `services/schema` is External with default ACL,
so the pre-check passes.
- `registry.invoke` dispatches to alkcall's `services_schema_handler`
(`alkcall src/registry/discovery.rs:327-343`), which does a bare
`registry.registration(name)``spec_to_json` with **no visibility
and no AccessControl check**.
`POST /call {"operation":"services/schema","input":{"name":"secret/op"}}`
→ the full spec (input/output/error schemas + required_scopes) of any
Internal op, unauthenticated. Same hole via the MCP `call` tool. The
regenerated to_openapi doc asserts "Internal (hidden from HTTP
discovery, GW-02)" — currently false at runtime. The alkcall-side
instance is filed as **CF-004** in
`alkcall/docs/reviews/consumer-findings-ledger.md` (the handler-level
fix there is the complete one; this task is the alkhttp-local layer).
## Acceptance Criteria
- [ ] alkhttp-side guard: before dispatch, when the requested
operation resolves to a `services/schema`-family handler, apply
the same is_internal_op + access_check_for_op pre-checks to the
**inner `name` input** as GET `/schema` does (404 for Internal,
403 for ACL denial, mirroring routes.rs:151-156)
- [ ] Implementer's choice on mechanism (options: a dispatch-path hook
in `call_handler`/`batch_handler`/`subscribe_handler`; an
alkhttp-side wrapper around the registry that intercepts
`services/schema` inputs; a GatewayDispatch-level check) — the
invariant is transport-level: **no alkhttp transport may fetch a
spec the GET `/schema` route would deny for the same identity**
- [ ] Test matrix mirroring the GET /schema tests: `/call` on
services/schema{internal-op} → 404; unauthorized identity →
403; MCP `call` tool with the same input → same result
(feature-gated `mcp` test)
- [ ] A comment/ADR-note recording that the complete fix is
alkcall-side (CF-004) and this task is the local layer — when
CF-004 lands, the alkhttp guard becomes defense-in-depth (do NOT
remove it; the per-transport check stays)
- [ ] `cargo test`, `cargo clippy --all-targets -- -D warnings`,
`cargo fmt --check` pass (plus `--all-features` if the mcp test lands)
## References
- docs/reviews/002-post-remediation-review.md (Part F', PRJ-16)
- alkcall/docs/reviews/consumer-findings-ledger.md (CF-004, filed 2026-08-30)
- alkcall/src/registry/discovery.rs:327-343 (the unchecked handler)
- src/gateway/routes.rs:120-133 (outer-name-only pre-check), 151-156 (the correct GET /schema checks to mirror)
- docs/architecture/decisions/015-privilege-model-and-authority-context.md
## Notes
The three gateway invoke routes (`/call`, `/batch`, `/subscribe`) all
dispatch through the same spine, so a single interception point (if
found) covers all three + MCP; if the mechanism is route-local, mirror
it in all three pre-check sites. Do not block on the alkcall fix —
this task is shippable independently and the alkcall lead time is
unknown. If CF-004 lands first, re-scope this task to defense-in-depth
assertions only.