Skip to content

fix(gateway): require admin scope for config write endpoints#509

Closed
sytone wants to merge 1 commit into
mainfrom
fix/gateway-admin-scope
Closed

fix(gateway): require admin scope for config write endpoints#509
sytone wants to merge 1 commit into
mainfrom
fix/gateway-admin-scope

Conversation

@sytone
Copy link
Copy Markdown
Owner

@sytone sytone commented May 22, 2026

Closes #506

Changes

  • ConfigController.UpdateSection, UpdateSectionEntry, DeleteSectionEntry now call RequireAdminScope() before proceeding
  • Non-admin GatewayCallerIdentity returns 403 Forbidden with {error: "forbidden", message: "Admin scope required for config write operations."}
  • Callers with no identity in HttpContext.Items (dev mode / auth disabled) are allowed through — backward compatible
  • GatewayAuthMiddleware.CallerIdentityItemKey promoted from internal to public const so tests and future consumers can reference it without string literals
  • 7 new unit tests: admin 200, non-admin 403, no-identity 200 for each write method

Test Results

7 new tests pass. 1513/1513 gateway tests pass (no regressions).

- Add RequireAdminScope() helper to ConfigController
- Apply to UpdateSection, UpdateSectionEntry, DeleteSectionEntry
- Non-admin calleridentity returns 403; no identity (dev mode) passes through
- GatewayAuthMiddleware.CallerIdentityItemKey promoted to public const
- 7 new tests covering admin/non-admin/no-identity paths

Closes #506
Copy link
Copy Markdown
Owner Author

@sytone sytone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Farnsworth Review — PR #509

CI: ⏳ Pending (just opened)
Merge conflicts: ✅ Clean (MERGEABLE)
Conventional commit title:fix(gateway): require admin scope for config write endpoints

Test coverage:

  • ✅ UpdateSection: admin 200, non-admin 403, no-identity 200
  • ✅ UpdateSectionEntry: admin 200, non-admin 403
  • ✅ DeleteSectionEntry: admin 200, non-admin 403
  • 7 new tests; 1513/1513 gateway pass

Spec completeness vs #506: Satisfies all AC. Config write endpoints (PUT, DELETE) now require IsAdmin=true. Human portal sessions (dev mode, no identity) pass through for backward compatibility. Agent sessions without IsAdmin=true receive 403.

Note: Exec approval is via SignalR hub commands (not REST), so not covered here — separate concern if needed.

LGTM.

@sytone
Copy link
Copy Markdown
Owner Author

sytone commented May 22, 2026

Closing as part of a planned hard-reset of the in-flight branch set so the new domain-model refactor can land on a clean trunk.

Audit verdict: security

Rationale: SECURITY FIX. The underlying authorization-scope gap remains in main after closure - must be re-applied as a fresh PR. See #506.

The new plan (in session state) reshapes core types: Citizen (User+Agent union), Vogen-generated value objects, ThreadId removed in favour of composite ChannelAddress, mark-not-delete compaction, centralised SessionContextProjector, single-path routing. Many in-flight branches touch contracts that are about to change — rebasing later would be more work than rebuilding on the new shape.

If this work is still wanted, refile as a new issue/PR against the post-refactor contracts.

@sytone sytone closed this May 22, 2026
@sytone sytone deleted the fix/gateway-admin-scope branch May 22, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(security): gateway admin endpoints lack authorization scope check

1 participant