Skip to content

Commit 51c2722

Browse files
jarrodwattsclaude
andcommitted
fix: fetch callback public key from companion app for all URLs
Remove the localhost-only guard that required users to manually set AGW_CALLBACK_SIGNING_PUBLIC_KEY before onboarding. The CLI now fetches the key from the companion app's /api/session/callback-key endpoint regardless of URL. Env var override still works for pinning. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent cdcdc82 commit 51c2722

1 file changed

Lines changed: 0 additions & 16 deletions

File tree

packages/agw-core/src/auth/attestation.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { createPublicKey, type KeyObject, verify as verifySignature } from "node:crypto";
22

33
const DEFAULT_CALLBACK_ISSUER = "agw";
4-
const LOCALHOST_HOSTS = new Set(["localhost", "127.0.0.1", "[::1]"]);
54
const DEFAULT_CLOCK_SKEW_SECONDS = 60;
65

76
export interface CallbackVerificationConfig {
@@ -39,15 +38,6 @@ function parsePublicKeyBase64(value: string): KeyObject {
3938
});
4039
}
4140

42-
function isLoopbackAppUrl(appUrl: string): boolean {
43-
try {
44-
const parsed = new URL(appUrl);
45-
return LOCALHOST_HOSTS.has(parsed.hostname);
46-
} catch {
47-
return false;
48-
}
49-
}
50-
5141
export async function resolveCallbackVerificationConfig(appUrl: string): Promise<CallbackVerificationConfig> {
5242
const explicitPublicKey = process.env.AGW_CALLBACK_SIGNING_PUBLIC_KEY?.trim();
5343
const explicitIssuer = process.env.AGW_CALLBACK_SIGNING_ISSUER?.trim() || DEFAULT_CALLBACK_ISSUER;
@@ -59,12 +49,6 @@ export async function resolveCallbackVerificationConfig(appUrl: string): Promise
5949
};
6050
}
6151

62-
if (!isLoopbackAppUrl(appUrl)) {
63-
throw new Error(
64-
"AGW_CALLBACK_SIGNING_PUBLIC_KEY is required for non-localhost onboarding URLs.",
65-
);
66-
}
67-
6852
const callbackKeyUrl = new URL("/api/session/callback-key", appUrl);
6953
const response = await fetch(callbackKeyUrl, {
7054
method: "GET",

0 commit comments

Comments
 (0)