Title: antigravity-ls-proxy: ANTIGRAVITY_LS_ADDRESS port parsed with bare parseInt — malformed addresses silently discarded, managed daemon spawned instead · Issue #494 · developing-today/code · GitHub
Open Graph Title: antigravity-ls-proxy: ANTIGRAVITY_LS_ADDRESS port parsed with bare parseInt — malformed addresses silently discarded, managed daemon spawned instead · Issue #494 · developing-today/code
X Title: antigravity-ls-proxy: ANTIGRAVITY_LS_ADDRESS port parsed with bare parseInt — malformed addresses silently discarded, managed daemon spawned instead · Issue #494 · developing-today/code
Description: Problem 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 bar...
Open Graph Description: Problem 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_L...
X Description: Problem 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_L...
Opengraph URL: https://github.com/developing-today/code/issues/494
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"antigravity-ls-proxy: ANTIGRAVITY_LS_ADDRESS port parsed with bare parseInt — malformed addresses silently discarded, managed daemon spawned instead","articleBody":"## Problem\n\n`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.\n\n`bin/antigravity-ls-proxy.mjs:199-202` (`LanguageServerManager.detectRunningInstances`):\n\n```js\nif (process.env.ANTIGRAVITY_LS_ADDRESS && process.env.ANTIGRAVITY_CSRF_TOKEN) {\n const parts = process.env.ANTIGRAVITY_LS_ADDRESS.split(':');\n const port = parseInt(parts[parts.length - 1], 10);\n return [{ port, token: process.env.ANTIGRAVITY_CSRF_TOKEN }];\n}\n```\n\nThis branch returns immediately, bypassing even the weak check in the `add()` helper below it (`p > 0`, lines 207-214 — which itself has no `\u003c= 65535` upper bound, so candidate ports discovered from `ps`/`ss`/`lsof`/log lines are also unbounded above).\n\n## Evidence (verified this run on main 72a52d4d)\n\nReplaying the exact lines 200-202 logic in Node:\n\n| `ANTIGRAVITY_LS_ADDRESS` | resulting candidate port |\n|---|---|\n| `127.0.0.1:abc` | `NaN` |\n| `127.0.0.1:` | `NaN` |\n| `127.0.0.1:99999` | `99999` |\n| `127.0.0.1:0` | `0` |\n| `127.0.0.1:-5` | `-5` |\n| `127.0.0.1:18745abc` | `18745` (trailing junk silently dropped) |\n| `127.0.0.1:18745.9` | `18745` (fraction silently dropped) |\n\nAnd the `add()` helper accepts `99999` / `65536` as candidate ports.\n\n## Why it matters\n\n- `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.\n- `18745abc` / `18745.9` silently connect to port 18745, the same wrong-port class #483 fixed for the `*_PROXY_PORT` listen ports.\n- The #483 guard test (`bin/proxy-port.test.mjs`, \"all seven parse sites…\") only regexes `parseInt(process.env.[A-Z_]*PROXY_PORT`, so this site — an `*_ADDRESS`, not a `*_PROXY_PORT` — slips past the guard that was meant to prevent regressions of this class.\n\n## Suggested fix / acceptance criteria\n\n- [ ] 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.\n- [ ] The `add()` candidate helper rejects ports > 65535 as well as `\u003c= 0` / `NaN`.\n- [ ] Regression tests cover at least: `abc`, empty port, `0`, `99999`, `18745abc`, `18745.9`, and a valid `host:18745`; and the #483 guard test (or a new one) catches a bare `parseInt` on the `ANTIGRAVITY_LS_ADDRESS` path.\n- [ ] `node --test bin/proxy-port.test.mjs` (plus any new test file) passes.\n\nDedup: #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.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-21T16:39:09Z","url":"https://github.com/developing-today/code/issues/494"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4ff92ba4-e474-92a8-b081-bcdb0a00afee |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BCC0:74E58:8598FE:B30198:6B06366F |
| html-safe-nonce | 16330668b59618aeab7d8f4245abc1e86d4d914411becefc5d3689f22f6a3a5b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQ0MwOjc0RTU4Ojg1OThGRTpCMzAxOTg6NkIwNjM2NkYiLCJ2aXNpdG9yX2lkIjoiODYxOTk2MjkxMzQ4MDEyODExMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 819703ecb699b9427fc8eb54f360070f35693171bedfb5151b49f6c2674f130f |
| hovercard-subject-tag | issue:5964600772 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/494/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ad1b4691513cb7fb34b9079f2cb15658add7cdb2c53f873ee78412d08cf4a25e/developing-today/code/issues/494 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ad1b4691513cb7fb34b9079f2cb15658add7cdb2c53f873ee78412d08cf4a25e/developing-today/code/issues/494 |
| og:image:alt | Problem 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_L... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | c3584c853cd39700ecff6e2cf8364295ffdb5313e571046c41cd2479270f7df0 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9eb3bb1597d09170a5f282cd38ae376dee1a5ec1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width