Skip to content

Add URL validation to reject internal/metadata endpoints in RemoteURL fields #4695

Closed

Description

@JAORMX

Summary

The RemoteURL field on MCPServerEntry (and MCPRemoteProxy) uses a ^https?:// CEL pattern that only validates the URL scheme. This allows potentially dangerous URLs that could become SSRF vectors if any downstream component fetches the URL in-cluster:

  • Cloud metadata: http://169.254.169.254/latest/meta-data/
  • Localhost: http://127.0.0.1:8080/
  • Internal K8s services: http://kubernetes.default.svc/

Context

Raised during review of #4664 by @ChrisJBurns (comment). This is not a regression — the same pattern exists on MCPRemoteProxy today — but it should be addressed for both resource types together.

Proposed approach

Add validation (CEL rules or controller-side checks) to reject well-known internal/metadata IP ranges and hostnames. At minimum:

  • Link-local metadata range (169.254.0.0/16)
  • Loopback (127.0.0.0/8, ::1)
  • Private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) — may need an opt-out for legitimate internal endpoints
  • kubernetes.default.svc and similar well-known in-cluster hostnames

This should apply consistently to both MCPServerEntry and MCPRemoteProxy CRDs.

References

Activity

  1. added
    enhancement
    on Apr 9, 2026
  2. added
    kubernetes
    on Apr 9, 2026
  3. added a commit that references this issue on Apr 9, 2026
    933ae9d
  4. added a commit that references this issue on Apr 9, 2026
    55d82f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementkubernetesoperatorsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions