Skip to content
Closed
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
9 changes: 7 additions & 2 deletions apps/supervisor/src/workloadServer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
* Verify the deployment token from the workload deployment-id header and return the verified
* environment_id to forward upstream. The env id is only forwarded in enforce mode: in log mode
* we still verify + record metrics but attach no header (so the platform never scopes). Only
* enforce fails a request, and only for a present-but-invalid token; absent and legacy ids pass.
* enforce fails a request, and only for an absent or invalid token; legacy bare ids pass.
*
* `claims` are returned on any valid token, for local use only - never to scope the platform,
* which is why environmentId stays gated on enforce.
Expand All @@ -213,7 +213,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {

const result = await verifyDeploymentIdHeader(this.deploymentIdFromRequest(req), "http");

if (result.outcome === "jwt_invalid" && workloadTokenEnforced) {
if (workloadTokenEnforced && (result.outcome === "jwt_invalid" || result.outcome === "token_absent")) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Enforce-mode test contradicts new behavior

The existing enforce-mode test expects an absent token to return 200. authorizeWorkloadRequest now returns 401, so the test fails.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Server fix lacks release note

This user-visible server fix adds 401 responses in enforce mode. Repository rules require a .server-changes/ entry, but none exists.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

return { ok: false };
}

Expand Down Expand Up @@ -735,6 +735,11 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
"GET",
async () => {
const { req, reply, params } = ctx;
const auth = await this.authorizeWorkloadRequest(req);
if (!auth.ok) {
reply.empty(401);
return;
}
const dequeueResponse = await this.workerClient.dequeueFromVersion(
params.deploymentId,
1,
Expand Down