The Open Framework for Building Agents
fix(eve): remove unnecessary preview deployment check that prevented production access from `eve dev` (#461)
Felix Arntz7d1084d66a2e
diff --git a/.changeset/fresh-snakes-flow.md b/.changeset/fresh-snakes-flow.mdnew file mode 100644index 000000000..042e5d027--- /dev/null+++ b/.changeset/fresh-snakes-flow.md@@ -0,0 +1,5 @@+---+"eve": patch+---++fix(eve): remove unnecessary preview deployment check that prevented production access from `eve dev`diff --git a/packages/eve/src/public/channels/auth.test.ts b/packages/eve/src/public/channels/auth.test.tsindex bfc626f62..a03a336a2 100644--- a/packages/eve/src/public/channels/auth.test.ts+++ b/packages/eve/src/public/channels/auth.test.ts@@ -786,7 +786,7 @@ describe("verifyVercelOidc", () => {}});- it("rejects a development user token on production", async () => {+ it("authenticates a development user token as a service principal on production", async () => {vi.stubEnv("VERCEL_PROJECT_ID", "prj_current");vi.stubEnv("VERCEL_TARGET_ENV", "production");@@ -799,7 +799,15 @@ describe("verifyVercelOidc", () => {user_id: "user_ada",});- await expect(verifyVercelOidc(token)).resolves.toEqual({ ok: false });+ const result = await verifyVercelOidc(token);++ expect(result.ok).toBe(true);+ if (result.ok) {+ expect(result.sessionAuth).toMatchObject({+ principalType: "service",+ subject: "owner:acme:project:weather-agent:environment:development",+ });+ }} finally {issuer.restore();}diff --git a/packages/eve/src/public/channels/auth.ts b/packages/eve/src/public/channels/auth.tsindex 774a482f1..5da56ca4d 100644--- a/packages/eve/src/public/channels/auth.ts+++ b/packages/eve/src/public/channels/auth.ts@@ -724,8 +724,8 @@ export interface VerifyVercelOidcOptions {* `email`) are exposed as auth attributes.* - Development tokens with a `user_id` claim authenticate as* `principalType: "user"` only when both the token and configured current- * project environment are `development`. A same-project preview target may- * use one as a `"service"` principal; other target environments reject it.+ * project environment are `development`. Other same-project target+ * environments may use one as a `"service"` principal.* - Tokens from other Vercel projects are accepted **only** when their `sub`* matches one of {@link VerifyVercelOidcOptions.subjects}.*diff --git a/packages/eve/src/runtime/governance/auth/oidc.ts b/packages/eve/src/runtime/governance/auth/oidc.tsindex c54f84d8f..1ddc6e4aa 100644--- a/packages/eve/src/runtime/governance/auth/oidc.ts+++ b/packages/eve/src/runtime/governance/auth/oidc.ts@@ -106,14 +106,11 @@ export async function authenticateOidcStrategy(input: {};}- if (input.strategy.currentVercelProject?.environment !== "preview") {- return {- kind: "caller-not-allowed",- };- }-- // Preview may use a same-project development credential only through the- // generic service path below, never as the user embedded in the token.+ /*+ * A same-project development credential for a different current+ * environment identifies the project, not the embedded local user.+ * Let the generic service path below authenticate it via `sub`.+ */}if (typeof verified.payload.sub !== "string" || verified.payload.sub.length === 0) {