P0 security fix. Any authenticated agent could previously read, modify, or
decommission agents belonging to other organizations.
Changes:
- IAgentListFilters: add organizationId field (forced from JWT, never from query)
- AgentRepository.findAll(): filter by organizationId when set
- AgentService: getAgentById, updateAgent, decommissionAgent — accept organizationId
and throw AuthorizationError(403) on cross-tenant access
- AgentController: extract req.user.organization_id on all 5 handlers; throw 403
if claim is absent; registerAgent forces body.organizationId from JWT claim
- OpenAPI spec: document tenant isolation rules per endpoint
- Tests: update MOCK_USER with organization_id; add 5 new missing-org-id 403 tests;
assert organizationId is passed through to service on all mutating calls
Fixes field trial failure: Test C.7 (Org Isolation).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix 7 test fixtures missing isPublic field added in WS4 Marketplace
- Add portal/.next/ to .gitignore (build artifacts should not be tracked)
- Mark all Phase 4 tasks 11.1-11.11 complete in tasks.md
QA results: 611/611 tests pass, tsc zero errors, portal build OK, CLI build OK
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>