Files
alkhttp/tasks/gateway/review-002-prj16-schema-via-call.md
T

3.9 KiB

id, name, status, depends_on, scope, risk, impact, level, tags
id name status depends_on scope risk impact level tags
review-002-prj16-schema-via-call Block Internal-op schema disclosure via services/schema over /call (PRJ-16, cross-crate CF-004) completed
moderate medium project implementation
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.

Summary

Dispatch-spine guard: invoke/invoke_streaming apply GET /schema's is-internal + ACL checks to the inner services/schema name (404/FORBIDDEN); shared check also used by the MCP schema tool (deduped). ADR-071 records CF-004 layering (complete fix alkcall-side; guard stays as defense-in-depth).