Skip to content

Conversation

@x032205
Copy link
Member

@x032205 x032205 commented Dec 16, 2025

Error when gateway does not support resource type

CleanShot 2025-12-16 at 16 07 26@2x

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 16, 2025

Greptile Overview

Greptile Summary

Added gateway capability checking to provide clear error messages when a gateway doesn't support a requested PAM resource type (postgres, mysql, ssh, kubernetes).

  • Introduced new PAM_CAPABILITIES ALPN protocol for querying gateway-supported resource types
  • Client-side validation occurs before starting proxy, showing actionable upgrade instructions if resource type is unsupported
  • Uses length-prefixed JSON protocol for capability exchange between client and gateway
  • Applied consistently across database, SSH, and Kubernetes proxy implementations

Confidence Score: 5/5

  • This PR is safe to merge - it adds a pre-flight capability check without modifying existing proxy logic.
  • The changes are well-structured and consistent across all proxy types. The new capability checking is additive and doesn't modify existing proxy behavior. Communication occurs over mTLS connections ensuring trust. No breaking API changes.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
packages/gateway-v2/gateway.go 5/5 Added ForwardModePAMCapabilities mode and handler for the new capabilities endpoint. Changes are straightforward protocol additions.
packages/pam/local/base-proxy.go 4/5 Added FetchGatewayCapabilities and ValidateResourceTypeSupported methods. Added resourceType field. The length-prefixed read could allocate up to 4GB on malformed input, though this is mitigated by mTLS trust.
packages/pam/local/database-proxy.go 5/5 Added ALPNInfisicalPAMCapabilities constant and resourceType field initialization. Calls ValidateResourceTypeSupported before starting proxy.
packages/pam/local/kubernetes-proxy.go 5/5 Added resourceType field initialization and ValidateResourceTypeSupported call before starting proxy.
packages/pam/local/ssh-proxy.go 5/5 Added resourceType field initialization and ValidateResourceTypeSupported call before starting proxy.
packages/pam/pam-proxy.go 5/5 Added PAMCapabilitiesResponse type, GetSupportedResourceTypes function, and HandlePAMCapabilities handler for the gateway side.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

6 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@x032205
Copy link
Member Author

x032205 commented Dec 16, 2025

@greptile review this

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

6 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@x032205 x032205 merged commit 6a741bf into main Dec 19, 2025
3 checks passed
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.

3 participants