You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
antigravity-ls-proxy: ANTIGRAVITY_LS_ADDRESS port parsed with bare parseInt — malformed addresses silently discarded, managed daemon spawned instead #494
bin/antigravity-ls-proxy.mjs validates its own listen port strictly via the shared parseProxyPort helper (#483), but the port it connects to — taken from the operator-supplied ANTIGRAVITY_LS_ADDRESS env var — is parsed with a bare parseInt and no validation at all.
This branch returns immediately, bypassing even the weak check in the add() helper below it (p > 0, lines 207-214 — which itself has no <= 65535 upper bound, so candidate ports discovered from ps/ss/lsof/log lines are also unbounded above).
And the add() helper accepts 99999 / 65536 as candidate ports.
Why it matters
ensureActive() (line 271+) heartbeats each candidate via checkHeartbeat(port, token), which fetches http://127.0.0.1:${port}/.... With NaN, 0, -5 or 99999 that fetch simply fails and is swallowed (catch { return false }), so a typo'd explicit address is silently discarded and the proxy falls through to startManagedDaemon() — spawning a second, managed language server instead of telling the operator their configured address is malformed. That masks configuration errors and can attach the session to the wrong (fresh) server.
The ANTIGRAVITY_LS_ADDRESS port is validated strictly (digits only, integer 1-65535), reusing parseProxyPortValue from bin/proxy-port.mjs where practical; a malformed address fails fast with an error naming ANTIGRAVITY_LS_ADDRESS and the offending value, instead of silently falling back to a managed daemon.
The add() candidate helper rejects ports > 65535 as well as <= 0 / NaN.
node --test bin/proxy-port.test.mjs (plus any new test file) passes.
Dedup: #483 covered only the *_PROXY_PORT listen ports (closed); #435 is about single-sourcing the proxies' port configuration in opencode config, not about validating this address; no open or closed issue covers ANTIGRAVITY_LS_ADDRESS parsing.
Activity
Merge pull request #495 from developing-today/creator/494-antigravity…