Skip to content

Commit 6c1fda8

Browse files
committed
fix(webapp): sanitise 500 leaks on deployment finalize routes
Devin's PR review flagged three deployment finalize routes (api.v1/v2/v3.deployments.$deploymentId.finalize.ts) that still surfaced raw `error.message` via the template-string variant (`Internal server error: ${error.message}`) on the catch-all 500 branch. Replace with a generic body and route the full error through logger.error for server-side visibility, matching the pattern used in the rest of this PR. Also fixes the same template-string leak inside the v3 SSE stream's .catch handler, where the raw message would have been written into the SSE event:error data payload.
1 parent 19f29b7 commit 6c1fda8

3 files changed

Lines changed: 10 additions & 22 deletions

File tree

apps/webapp/app/routes/api.v1.deployments.$deploymentId.finalize.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,9 @@ export async function action({ request, params }: ActionFunctionArgs) {
5454
} catch (error) {
5555
if (error instanceof ServiceValidationError) {
5656
return json({ error: error.message }, { status: 400 });
57-
} else if (error instanceof Error) {
58-
logger.error("Error finalizing deployment", { error: error.message });
59-
return json({ error: `Internal server error: ${error.message}` }, { status: 500 });
60-
} else {
61-
logger.error("Error finalizing deployment", { error: String(error) });
62-
return json({ error: "Internal server error" }, { status: 500 });
6357
}
58+
59+
logger.error("Error finalizing deployment", { error });
60+
return json({ error: "Internal server error" }, { status: 500 });
6461
}
6562
}

apps/webapp/app/routes/api.v2.deployments.$deploymentId.finalize.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,9 @@ export async function action({ request, params }: ActionFunctionArgs) {
5454
} catch (error) {
5555
if (error instanceof ServiceValidationError) {
5656
return json({ error: error.message }, { status: 400 });
57-
} else if (error instanceof Error) {
58-
logger.error("Error finalizing deployment", { error: error.message });
59-
return json({ error: `Internal server error: ${error.message}` }, { status: 500 });
60-
} else {
61-
logger.error("Error finalizing deployment", { error: String(error) });
62-
return json({ error: "Internal server error" }, { status: 500 });
6357
}
58+
59+
logger.error("Error finalizing deployment", { error });
60+
return json({ error: "Internal server error" }, { status: 500 });
6461
}
6562
}

apps/webapp/app/routes/api.v3.deployments.$deploymentId.finalize.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,8 @@ export async function action({ request, params }: ActionFunctionArgs) {
7575

7676
if (error instanceof ServiceValidationError) {
7777
errorMessage = { error: error.message };
78-
} else if (error instanceof Error) {
79-
logger.error("Error finalizing deployment", { error: error.message });
80-
errorMessage = { error: `Internal server error: ${error.message}` };
8178
} else {
82-
logger.error("Error finalizing deployment", { error: String(error) });
79+
logger.error("Error finalizing deployment", { error });
8380
errorMessage = { error: "Internal server error" };
8481
}
8582

@@ -93,12 +90,9 @@ export async function action({ request, params }: ActionFunctionArgs) {
9390
} catch (error) {
9491
if (error instanceof ServiceValidationError) {
9592
return json({ error: error.message }, { status: 400 });
96-
} else if (error instanceof Error) {
97-
logger.error("Error finalizing deployment", { error: error.message });
98-
return json({ error: `Internal server error: ${error.message}` }, { status: 500 });
99-
} else {
100-
logger.error("Error finalizing deployment", { error: String(error) });
101-
return json({ error: "Internal server error" }, { status: 500 });
10293
}
94+
95+
logger.error("Error finalizing deployment", { error });
96+
return json({ error: "Internal server error" }, { status: 500 });
10397
}
10498
}

0 commit comments

Comments
 (0)