Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ async function gate(
await deps.identity.refresh();
if (deps.identity.classify(actor.p).type !== "internal") actor = null;
}
if (!isPublicRoute && requirePortalIdentity) {
if (!isPublicRoute && routeAuth !== "source" && requirePortalIdentity) {
const webTurn =
method === "POST" &&
pathname === "/v1/turns" &&
Expand Down
20 changes: 20 additions & 0 deletions test/auth-gate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,23 @@ test("egress-audit ingest requires source auth: unsigned is 401, signed lands
await srv.close();
}
});

test("source-only run reads remain available under portal-identity enforcement", async () => {
const built = buildApp(testConfig({ dataDir: mkdtempSync(join(tmpdir(), "auth-run-read-")) }));
const server = createServer(built.app, {
signingSecret: SECRET,
runs: built.runs,
requireSignedPortalIdentity: true,
capabilitySecret: `${SECRET}-cap`,
portalIdentitySecret: `${SECRET}-portal`,
});
server.listen(0);
const base = `http://localhost:${(server.address() as AddressInfo).port}`;
try {
const path = "/v1/runs/missing";
const response = await fetch(`${base}${path}`, { headers: sign("GET", path, "") });
assert.equal(response.status, 404);
} finally {
await new Promise<void>((resolve) => server.close(() => resolve()));
}
});