Skip to content

Commit 0b6da65

Browse files
fix(deps): patch security vulnerabilities in hono, dependency-cruiser, and transitive deps (#1104)
2 parents 56dce1e + 525c638 commit 0b6da65

9 files changed

Lines changed: 139 additions & 138 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ run-milvus-test.sh
8989

9090
# Git worktrees
9191
.worktrees/
92+
.gw.yml
9293

9394
supabase/.temp
9495

cloud-agent-next/src/server.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,19 @@ app.all('/sessions/:userId/:sessionId/ingest', async (c: Context<HonoContext>) =
8585
return c.text('Expected WebSocket upgrade', 426);
8686
}
8787

88+
const rawUserId = c.req.param('userId');
89+
const sessionId = c.req.param('sessionId');
90+
if (!rawUserId || !sessionId) {
91+
return c.text('Missing route params', 400);
92+
}
93+
8894
let userId: string;
8995
try {
90-
userId = decodeURIComponent(c.req.param('userId'));
96+
userId = decodeURIComponent(rawUserId);
9197
} catch {
9298
return c.text('Invalid userId encoding', 400);
9399
}
94100

95-
const sessionId = c.req.param('sessionId');
96101
const authHeader = c.req.header('Authorization');
97102
const authResult = await validateKiloToken(authHeader ?? null, c.env.NEXTAUTH_SECRET);
98103
if (!authResult.success) {
@@ -116,14 +121,21 @@ const MAX_LOG_UPLOAD_BYTES = 50 * 1024 * 1024; // 50 MB
116121
app.put(
117122
'/sessions/:userId/:sessionId/logs/:executionId/:filename',
118123
async (c: Context<HonoContext>) => {
124+
const rawUserId = c.req.param('userId');
125+
const filename = c.req.param('filename');
126+
const sessionId = c.req.param('sessionId');
127+
const executionId = c.req.param('executionId');
128+
if (!rawUserId || !filename || !sessionId || !executionId) {
129+
return c.text('Missing route params', 400);
130+
}
131+
119132
let userId: string;
120133
try {
121-
userId = decodeURIComponent(c.req.param('userId'));
134+
userId = decodeURIComponent(rawUserId);
122135
} catch {
123136
return c.text('Invalid userId encoding', 400);
124137
}
125138

126-
const filename = c.req.param('filename');
127139
if (!ALLOWED_LOG_FILENAMES.has(filename)) {
128140
return c.text('Invalid filename', 400);
129141
}
@@ -151,8 +163,6 @@ app.put(
151163
return c.text('Request body too large', 413);
152164
}
153165

154-
const sessionId = c.req.param('sessionId');
155-
const executionId = c.req.param('executionId');
156166
const safeUserId = encodeURIComponent(userId);
157167
const safeSessionId = encodeURIComponent(sessionId);
158168
const safeExecutionId = encodeURIComponent(executionId);

cloudflare-ai-attribution/src/ai-attribution.worker.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Cloudflare Worker entry point for AI Attributions Tracking
33
*/
44

5-
import { Hono } from 'hono';
5+
import { Hono, type MiddlewareHandler } from 'hono';
66
import { useWorkersLogger } from 'workers-tagged-logger';
77
import { AttributionTrackerDO, getAttributionTrackerDO } from './dos/AttributionTracker.do';
88
import { logger } from './util/logger';
@@ -30,7 +30,11 @@ export type HonoContext = {
3030

3131
const app = new Hono<HonoContext>();
3232

33-
app.use('*', useWorkersLogger('ai-attribution'));
33+
// TODO: remove cast once workers-tagged-logger publishes a version compiled against hono >=4.12.7
34+
// workers-tagged-logger@1.0.0 was compiled against an older hono whose Handler
35+
// type is structurally incompatible with hono >=4.12.7 (missing [GET_MATCH_RESULT]).
36+
// The runtime middleware is fully compatible; only the .d.ts is stale.
37+
app.use('*', useWorkersLogger('ai-attribution') as unknown as MiddlewareHandler);
3438

3539
// Health check endpoint (no auth required)
3640
app.get('/health', c => {

cloudflare-deploy-infra/builder/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ app.post('/deploy-archive', async (c: Context<HonoEnv>) => {
180180
// Route: GET /deploy/:buildId/status
181181
app.get('/deploy/:buildId/status', async (c: Context<HonoEnv>) => {
182182
const buildId = c.req.param('buildId');
183+
if (!buildId) return c.json({ error: 'Missing buildId' }, 400);
183184

184185
// Get Durable Object stub
185186
const id = c.env.DeploymentOrchestrator.idFromName(buildId);
@@ -201,6 +202,7 @@ app.get('/deploy/:buildId/status', async (c: Context<HonoEnv>) => {
201202
// Route: GET /deploy/:buildId/events
202203
app.get('/deploy/:buildId/events', async (c: Context<HonoEnv>) => {
203204
const buildId = c.req.param('buildId');
205+
if (!buildId) return c.json({ error: 'Missing buildId' }, 400);
204206

205207
// Get Durable Object stub
206208
const id = c.env.DeploymentOrchestrator.idFromName(buildId);
@@ -222,6 +224,7 @@ app.get('/deploy/:buildId/events', async (c: Context<HonoEnv>) => {
222224
// Route: DELETE /deploy/:buildId
223225
app.delete('/deploy/:buildId', async (c: Context<HonoEnv>) => {
224226
const buildId = c.req.param('buildId');
227+
if (!buildId) return c.json({ error: 'Missing buildId' }, 400);
225228

226229
// Get Durable Object stub
227230
const id = c.env.DeploymentOrchestrator.idFromName(buildId);
@@ -246,6 +249,7 @@ app.delete('/deploy/:buildId', async (c: Context<HonoEnv>) => {
246249
*/
247250
app.delete('/worker/:slug', async (c: Context<HonoEnv>) => {
248251
const slug = c.req.param('slug');
252+
if (!slug) return c.json({ error: 'Missing slug' }, 400);
249253

250254
// Validate slug format
251255
try {

cloudflare-gastown/src/middleware/analytics.middleware.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ export async function instrumented(
9696
route,
9797
error,
9898
userId: c.get('kiloUserId') || c.get('agentJWT')?.userId,
99-
townId: c.req.param('townId') as string | undefined,
100-
rigId: c.req.param('rigId') as string | undefined,
101-
agentId: c.req.param('agentId') as string | undefined,
102-
beadId: c.req.param('beadId') as string | undefined,
99+
townId: c.req.param('townId'),
100+
rigId: c.req.param('rigId'),
101+
agentId: c.req.param('agentId'),
102+
beadId: c.req.param('beadId'),
103103
durationMs,
104104
});
105105
}

cloudflare-webhook-agent-ingest/src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Hono } from 'hono';
1+
import { Hono, type MiddlewareHandler } from 'hono';
22
import { useWorkersLogger } from 'workers-tagged-logger';
33
import { TriggerDO } from './dos/TriggerDO';
44
import { logger } from './util/logger';
@@ -18,7 +18,11 @@ export type HonoContext = {
1818

1919
const app = new Hono<HonoContext>();
2020

21-
app.use('*', useWorkersLogger('webhook-agent'));
21+
// TODO: remove cast once workers-tagged-logger publishes a version compiled against hono >=4.12.7
22+
// workers-tagged-logger@1.0.0 was compiled against an older hono whose Handler
23+
// type is structurally incompatible with hono >=4.12.7 (missing [GET_MATCH_RESULT]).
24+
// The runtime middleware is fully compatible; only the .d.ts is stale.
25+
app.use('*', useWorkersLogger('webhook-agent') as unknown as MiddlewareHandler);
2226

2327
app.get('/health', c => {
2428
return c.json(

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
"@types/react-dom": "^19.2.2",
161161
"@typescript/native-preview": "7.0.0-dev.20251019.1",
162162
"babel-plugin-react-compiler": "^1.0.0",
163-
"dependency-cruiser": "^17.3.1",
163+
"dependency-cruiser": "^17.3.8",
164164
"dotenv": "^17.2.3",
165165
"eslint": "catalog:",
166166
"eslint-config-prettier": "^10.1.8",
@@ -197,7 +197,9 @@
197197
"fast-xml-parser": ">=5.3.4",
198198
"vite": ">=6.4.1",
199199
"qs": ">=6.14.1",
200-
"serialize-javascript": ">=7.0.3"
200+
"serialize-javascript": ">=7.0.3",
201+
"hono": "^4.12.7",
202+
"undici@^6": "^6.24.1"
201203
}
202204
}
203205
}

0 commit comments

Comments
 (0)