Add networking validation functions for inbound port restriction and east-west connectivity#25
Open
devin-ai-integration[bot] wants to merge 6 commits intomainfrom
Open
Conversation
- Add ValidateInboundPortRestriction to ensure only SSH port is accessible - Add ValidateEastWestConnectivity to test inter-instance communication - Follow existing validation patterns from instance.go and image.go - Use SSH client for remote port scanning and connectivity testing - Refactor into helper functions to meet linter requirements Co-Authored-By: Alec Fong <alecsanf@usc.edu>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
theFong
requested changes
Aug 10, 2025
Member
theFong
left a comment
There was a problem hiding this comment.
Lets wire these up in the internal/validation package
- Add ValidateInboundPortRestriction test after ValidateInstanceImage - Add ValidateEastWestConnectivity test before ValidateTerminateInstance - Follow existing validation suite patterns and error handling Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Use makeDebuggableName() for test instance creation like ValidateCreateInstance - Follow exact same pattern as working instance creation functions - Ensures proper SSH key setup and unique naming for test instances Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Remove explicit Name field to match ValidateCreateInstance pattern - Let makeDebuggableName() handle naming internally during instance creation - Ensures proper SSH key setup for test instances Co-Authored-By: Alec Fong <alecsanf@usc.edu>
…ions - Add client.GetInstance calls in waitForInstancesReady to refresh instances from API - Follow the same pattern used in validation suite at line 108 - Ensures instances have complete SSH connection details before attempting connections - Update function signature to return refreshed instances Co-Authored-By: Alec Fong <alecsanf@usc.edu>
- Provide default 'test-connectivity' name when attrs.Name is empty - Prevents malformed instance names like '-east' and '-west' - Ensures proper SSH key association for test instances - Fixes SSH authentication failure in CI tests Co-Authored-By: Alec Fong <alecsanf@usc.edu>
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.
Add networking validation functions for inbound port restriction and east-west connectivity
Summary
This PR implements two new networking validation functions in
pkg/v1/networking:ValidateInboundPortRestriction- Validates that only SSH port (22) is accessible from external sources by testing common ports (21, 23, 25, 53, 80, 443, 993, 995, 3389, 5432, 3306) using netcat (nc) to ensure they're properly blocked.ValidateEastWestConnectivity- Creates two temporary test instances and validates inter-instance communication by testing ping connectivity and SSH port accessibility between instances using private IPs.Both functions are integrated into the existing validation suite in
internal/validation/suite.goand follow established patterns for instance lifecycle validation. The implementation includes proper error handling, cleanup mechanisms, and logging.Key Fix: Resolved SSH authentication failures in CI by properly handling empty
attrs.Namefields - providing a default "test-connectivity" name prevents malformed instance names like "-east" and "-west".Review & Testing Checklist for Human
ncbehavior may varyRecommended Test Plan:
make testto verify no regressions in existing validationDiagram
%%{ init : { "theme" : "default" }}%% graph TD ValidationSuite["internal/validation/suite.go<br/>RunInstanceLifecycleValidation"]:::minor-edit NetworkingPkg["pkg/v1/networking.go<br/>New validation functions"]:::major-edit InstancePkg["pkg/v1/instance.go<br/>Existing instance functions"]:::context SSHPkg["pkg/ssh/ssh.go<br/>SSH connection utilities"]:::context ValidationSuite -->|"calls"| NetworkingPkg NetworkingPkg -->|"uses"| InstancePkg NetworkingPkg -->|"uses"| SSHPkg NetworkingPkg -->|"creates"| TestInstance1["Test Instance 1<br/>(temporary)"]:::context NetworkingPkg -->|"creates"| TestInstance2["Test Instance 2<br/>(temporary)"]:::context subgraph Legend L1["Major Edit"]:::major-edit L2["Minor Edit"]:::minor-edit L3["Context/No Edit"]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
nc(netcat) which should be available on most cloud instance images but behavior may varySession Details: