feat: add development mode handling for gateway registration and host key validation#52
Merged
victorvhs017 merged 2 commits intomainfrom Nov 5, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Adds development mode support for testing gateway and relay commands against localhost Infisical instances.
- Overrides relay host to
127.0.0.1whenCLI_VERSION == "devel"(set at build time via ldflags) - Skips SSH host certificate validation in development mode for easier local testing
- Enables developers to test gateway/relay functionality without production infrastructure
Confidence Score: 4/5
- Safe to merge with low risk - changes only affect development builds
- The changes are well-scoped and only activate in development mode when
CLI_VERSION == "devel". In production builds,CLI_VERSIONis set via ldflags during the build process, so these code paths won't execute. The security bypass (skipping host cert validation) is appropriately gated and won't affect production usage. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| packages/gateway-v2/gateway.go | 4/5 | Adds development mode handling for localhost testing by overriding relay host and skipping host certificate validation when CLI_VERSION == "devel" |
Sequence Diagram
sequenceDiagram
participant G as Gateway
participant API as Infisical API
participant R as Relay Server
Note over G: Start Gateway Command
G->>API: Register Gateway Request
API-->>G: Registration Response (RelayHost, Certificates)
alt CLI_VERSION == "devel"
Note over G: Override RelayHost to 127.0.0.1
G->>G: certResp.RelayHost = "127.0.0.1"
end
G->>G: Setup TLS Config with Certs
G->>R: SSH Connection to RelayHost:2222
alt SSH Host Key Validation
R-->>G: Host Certificate
alt CLI_VERSION == "devel"
Note over G: Skip validation in dev mode
G->>G: return nil (no validation)
else Production Mode
G->>G: validateHostCertificate()
end
end
G-->>R: Connection Established
Note over G,R: Handle Incoming Channels
1 file reviewed, no comments
varonix0
requested changes
Nov 5, 2025
varonix0
requested changes
Nov 5, 2025
…st key validation
varonix0
approved these changes
Nov 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description 📣
Enables the
relayandgatewaycommands on localhost using a local instance of infisical on the--domainflag.Type ✨
Tests 🛠️
Run the gateway and relay commands like:
go run main.go gateway start --name=local-gateway --relay=local-relay --domain=http://localhost:8080 --token=...