3.5 KiB
3.5 KiB
#1179 — Required security DI wiring
Objective
Eliminate the shared fail-open defect class absence read as permission:
- FL-01: missing
CommandAuthorizationServicemust refuse Nest startup and must not permit command effects. - FL-11: missing
SystemOverrideServicemust refuse Nest startup and must not omit stored instruction authority while allowing provider/session effects.
Tracking
- Issue: #1179, child of #1156
- Branch:
fix/1179-required-security-di - Base:
origin/nextat216cd72226cd9ee17eea461cfe7cd0e010a22f02
Plan
- RED: compile the real
AppModulegraph with each required provider independently removed, with a positive control for each intact binding. - RED: directly exercise each malformed absence path and assert zero command/provider/session effects.
- Stop and report RED to the coordinator before production implementation.
- After authorization, make both constructor injections required, remove absence-as-permission branches, and update explicit legitimate optional test seams.
- Run focused Gateway tests, typecheck, lint, format, build, independent exact-head verification, and focused security review.
Immutable path fence
Production changes are confined to:
apps/gateway/src/commands/command-executor.service.tsapps/gateway/src/agent/agent.service.ts
Tests and task evidence are confined to:
apps/gateway/src/__tests__/required-security-wiring.test.ts- existing direct-constructor specs that require explicit required arguments
docs/scratchpads/1179-required-security-di.md
No files in #1178, #1072, #1080, or #1054 lanes are in scope. docs/TASKS.md is orchestrator-owned and will not be modified.
Budget
No explicit token ceiling was provided. Working assumption: one narrow Gateway security packet; split and stop if either arm requires unrelated module rewiring.
Progress
- Intake read from #1179 and parent #1156.
- Base independently resolved from the issue's pre-native-stage ordering and repository
origin/nextref; branch HEAD verified byte-for-byte against the remote ref. - Real consumers and direct constructors inventoried.
Tests
RED
required-security-wiring.test.ts: 4 failed, 2 passed before implementation.- Both real-graph negative controls showed module compilation accepted the missing target binding.
- Direct FL-01 showed one unauthorized command effect; direct FL-11 showed one provider prompt and one session counter mutation.
GREEN
required-security-wiring.test.ts: 6/6 passed.- FL-01-only production revert: exactly the two FL-01 test cases failed; all four other cases, including FL-11, passed.
- FL-11-only production revert: exactly the two FL-11 test cases failed; all four other cases, including FL-01, passed.
- Full Gateway suite: 74 files passed, 7 skipped; 831 tests passed, 17 skipped.
- Gateway typecheck: passed.
- Gateway lint: passed.
- Gateway build: passed.
- Changed-file Prettier check: passed.
Review
- Codex code review: APPROVE, 0 findings.
- Codex focused security review: risk
none, 0 findings. - Independent exact-head review remains assigned to Scrappy through the coordinator.
Risks / blockers
AgentModule/CommandsModule/ChatModulecontain a production cycle; the module test therefore uses the real top-levelAppModuleand replaces only storage/network leaves, preserving the target service in each arm while isolating the separate required consumer that would otherwise mask that arm's defect.- No broad module rewrite was required.