Skip to content

Commit 2e62663

Browse files
fix: allow the cursorvm.com box gateway family and add a changeset
1 parent 9adf055 commit 2e62663

4 files changed

Lines changed: 17 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"grok-bot-cli": patch
3+
---
4+
5+
Send the gateway and EnsureSandBox bearer tokens only to `https` hosts on `*.cursor.sh`, `*.cursor.com`, or `*.cursorvm.com` (the box gateway family EnsureSandBox returns); refuse cross-origin fetch redirects; redact credential-shaped values from error output. `GROK_BOT_ALLOW_LOCAL_GATEWAY=1` admits loopback gateways and `GROK_BOT_ALLOW_ANY_GATEWAY=1` disables the host check.

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Run `gbot --help` for every command.
3939

4040
## Gateway URL policy
4141

42-
By default `gbot` only sends credentials to `https` URLs on `*.cursor.sh` / `*.cursor.com`.
42+
By default `gbot` only sends credentials to `https` URLs on `*.cursor.sh` / `*.cursor.com` / `*.cursorvm.com` (the box gateway family EnsureSandBox returns).
4343

4444
- `GROK_BOT_ALLOW_LOCAL_GATEWAY=1` — permit `http(s)://127.0.0.1`, `localhost`, and `::1` (local/dev gateways).
4545
- `GROK_BOT_ALLOW_ANY_GATEWAY=1` — disable host checks (unsafe; for break-glass only).

‎src/url-policy.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/**
22
* Gateway / backend URL policy: only send credentials to expected hosts.
33
*
4-
* Default: https + *.cursor.sh / *.cursor.com (and apex).
4+
* Default: https + *.cursor.sh / *.cursor.com (and apex) / *.cursorvm.com, the
5+
* host family EnsureSandBox hands out for the box gateway (e.g.
6+
* <id>-pod-<id>.us12.cursorvm.com).
57
* Local/dev: http(s)://127.0.0.1|localhost|::1 when GROK_BOT_ALLOW_LOCAL_GATEWAY=1.
68
* Escape hatch: GROK_BOT_ALLOW_ANY_GATEWAY=1 (unsafe; disables host checks).
79
*/
@@ -28,7 +30,7 @@ function isCursorHostname(hostname) {
2830
const h = String(hostname || "").toLowerCase();
2931
if (!h) return false;
3032
if (h === "cursor.sh" || h === "cursor.com") return true;
31-
return h.endsWith(".cursor.sh") || h.endsWith(".cursor.com");
33+
return h.endsWith(".cursor.sh") || h.endsWith(".cursor.com") || h.endsWith(".cursorvm.com");
3234
}
3335

3436
/**
@@ -85,7 +87,7 @@ export function assertAllowedCredentialUrl(rawUrl, opts = {}) {
8587
label +
8688
" host \"" +
8789
host +
88-
"\". Expected *.cursor.sh / *.cursor.com, or set GROK_BOT_ALLOW_LOCAL_GATEWAY=1 / GROK_BOT_ALLOW_ANY_GATEWAY=1.",
90+
"\". Expected *.cursor.sh / *.cursor.com / *.cursorvm.com, or set GROK_BOT_ALLOW_LOCAL_GATEWAY=1 / GROK_BOT_ALLOW_ANY_GATEWAY=1.",
8991
);
9092
}
9193

‎test/url-policy.test.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ test("allows https cursor.sh gateway hosts", () => {
3737
assertAllowedCredentialUrl("https://agent.cursor.com"),
3838
"https://agent.cursor.com",
3939
);
40+
// The box gateway EnsureSandBox hands out lives on this family.
41+
assert.equal(
42+
assertAllowedCredentialUrl("https://145d7c6d03c7434e75f0-pod-abc-1340.us12.cursorvm.com/"),
43+
"https://145d7c6d03c7434e75f0-pod-abc-1340.us12.cursorvm.com",
44+
);
45+
assert.throws(() => assertAllowedCredentialUrl("https://cursorvm.com.evil.example"), /Rejected gateway URL host/i);
4046
});
4147
});
4248

0 commit comments

Comments
 (0)