Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

Revert "security: fix SSRF vulnerability in orchestrator health checks"

Marioc0bb3ff25571
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 679afc91..0235b3dc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,9 +12,6 @@
- **WebSocket proxy standards** — Improved HTTP header formatting using `fmt.Fprintf` and `textproto.CanonicalMIMEHeaderKey` (#50)
- **Integration test stability** — Added retry logic, increased timeouts, and better error reporting for flaky tests (#50)
-### Security
-- **Input Validation** — Added port validation to prevent invalid input in orchestrator health checks. Validates port format and range (1-65535) (#50)
-
### Docs
- **Definition of Done** — Added DEFINITION_OF_DONE.md and GitHub PR template with streamlined, actionable checklist (PR #48)
diff --git a/internal/orchestrator/handlers.go b/internal/orchestrator/handlers.go
index 05f4dcc5..fb356396 100644
--- a/internal/orchestrator/handlers.go
+++ b/internal/orchestrator/handlers.go
@@ -104,12 +104,6 @@ func (o *Orchestrator) handleLaunchByName(w http.ResponseWriter, r *http.Request
return
}
- // Validate port to prevent SSRF
- if err := ValidatePort(req.Port); err != nil {
- web.Error(w, 400, fmt.Errorf("invalid port: %w", err))
- return
- }
-
inst, err := o.Launch(req.Name, req.Port, req.Headless)
if err != nil {
web.Error(w, 409, err)
diff --git a/internal/orchestrator/health.go b/internal/orchestrator/health.go
index afaab360..1f1fc4da 100644
--- a/internal/orchestrator/health.go
+++ b/internal/orchestrator/health.go
@@ -36,9 +36,10 @@ func (o *Orchestrator) monitor(inst *InstanceInternal) {
time.Sleep(instanceHealthPollInterval)
for _, baseURL := range instanceBaseURLs(inst.Port) {
- // Note: We validate port format but not host restrictions to support
- // Docker deployments where instances run in different containers.
- // The orchestrator only checks instances it manages.
+ // Suppress CodeQL alert: baseURL comes from trusted orchestrator configuration
+ // (port-based child instance list), not user input. This is intentional design:
+ // agents request the orchestrator to probe known child instances.
+ // lgtm[go/request-forgery]
req, reqErr := http.NewRequest(http.MethodGet, baseURL+"/health", nil)
if reqErr != nil {
lastProbe = fmt.Sprintf("%s -> %s", baseURL, reqErr.Error())
@@ -140,12 +141,6 @@ func isInstanceHealthyStatus(code int) bool {
}
func instanceBaseURLs(port string) []string {
- // Port should already be validated, but double-check
- if err := ValidatePort(port); err != nil {
- // Return empty slice if port is invalid
- return []string{}
- }
-
return []string{
fmt.Sprintf("http://127.0.0.1:%s", port),
fmt.Sprintf("http://[::1]:%s", port),
diff --git a/internal/orchestrator/validation.go b/internal/orchestrator/validation.go
deleted file mode 100644
index 8ce01c6c..00000000
--- a/internal/orchestrator/validation.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package orchestrator
-
-import (
- "fmt"
- "strconv"
-)
-
-// ValidatePort ensures the port is valid format and range
-func ValidatePort(port string) error {
- if port == "" {
- return fmt.Errorf("port cannot be empty")
- }
-
- // Parse port number
- portNum, err := strconv.Atoi(port)
- if err != nil {
- return fmt.Errorf("invalid port number: %s", port)
- }
-
- // Check valid port range
- if portNum < 1 || portNum > 65535 {
- return fmt.Errorf("port must be between 1 and 65535")
- }
-
- return nil
-}
diff --git a/internal/orchestrator/validation_test.go b/internal/orchestrator/validation_test.go
deleted file mode 100644
index e7a1d9e2..00000000
--- a/internal/orchestrator/validation_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package orchestrator
-
-import (
- "testing"
-)
-
-func TestValidatePort(t *testing.T) {
- tests := []struct {
- name string
- port string
- wantErr bool
- }{
- {"valid port", "8080", false},
- {"valid high port", "65000", false},
- {"valid pinchtab port", "9867", false},
- {"port 80", "80", false},
- {"port 443", "443", false},
- {"empty port", "", true},
- {"non-numeric", "abc", true},
- {"negative", "-1", true},
- {"zero", "0", true},
- {"too high", "70000", true},
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- err := ValidatePort(tt.port)
- if (err != nil) != tt.wantErr {
- t.Errorf("ValidatePort(%q) error = %v, wantErr %v", tt.port, err, tt.wantErr)
- }
- })
- }
-}