Skip to content

[mcp-2026] CIMD: deny host mismatch and delete duplicate helpers - #80

Closed
AadarshM07 wants to merge 1 commit into
nitrocloudofficial:mainfrom
AadarshM07:issue-26-cimd
Closed

AadarshM07 wants to merge 1 commit into
nitrocloudofficial:mainfrom
AadarshM07:issue-26-cimd

Conversation

@AadarshM07

Copy link
Copy Markdown

Summary

Addresses security and code hygiene gaps in CIMD registration and token verification:

  • Deny on Host Mismatch: apply_cimd_to_registration_body now raises CimdValidationError on host mismatch instead of returning the document with _cimd_host_matches_request: False.
  • Strict Outbound Socket Peer: cimd_peer_is_acceptable requires the outbound socket peer to equal the pinned IP (TRUSTED_PROXIES exception removed for outbound fetch).
  • Remove Duplicate Functions: Deleted the duplicate copy-paste definitions of looks_like_cimd_url and resolve_cimd_sync in nitrostack/auth/cimd.py.
  • Fix Token Verification Handling: verify_bearer_payload catches ValueError from token verification only; DI resolution errors now propagate rather than silently falling back to anonymous.

Testing

  • Updated tests/test_mcp20_oauth_cimd.py for host mismatch rejection, outbound socket peer checks, helper count validation, and bearer verification error handling.
  • Verified test suite:
image

Closes #26

@AadarshM07 AadarshM07 changed the title fix(auth): deny CIMD host mismatch, require pinned IP for outbound pe… [mcp-2026] CIMD: deny host mismatch and delete duplicate helpers Oct 22, 2026
@AadarshM07
AadarshM07 marked this pull request as ready for review October 22, 2026 18:40
@AadarshM07 AadarshM07 closed this Oct 23, 2026
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.

[mcp-2026] CIMD: deny host mismatch and delete duplicate helpers

1 participant