From 96c282ec0689e64f9bf8d36a2860a19f7331d88d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 18 Jun 2026 21:00:40 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A1=EF=B8=8F=20Sentinel:=20[Medium]=20?= =?UTF-8?q?Add=20explicit=20timeouts=20to=20all=20external=20fetch=20calls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🚨 Severity: MEDIUM 💡 Vulnerability: The native \`fetch\` API does not have a default timeout. Several external API calls to Dexscreener, Farcaster public node info endpoints, and GitHub lacked explicit timeouts. 🎯 Impact: If these external services are slow or unresponsive, requests can hang indefinitely, potentially exhausting server connections and causing denial of service (DoS) or very slow page loads. 🔧 Fix: Added \`signal: AbortSignal.timeout(TIMEOUT_MS)\` to all native \`fetch\` calls in \`src/lib/network.ts\`, \`src/lib/snap-market.ts\`, and \`scripts/sync-sources.mjs\`. ✅ Verification: Ran \`npm run lint\`, \`npm run typecheck\`, and \`npm run build\` successfully to ensure no build-time or type errors were introduced. Co-authored-by: felirami <6752178+felirami@users.noreply.github.com> --- .jules/sentinel.md | 5 +++++ scripts/sync-sources.mjs | 3 +++ src/lib/network.ts | 1 + src/lib/snap-market.ts | 2 ++ 4 files changed, 11 insertions(+) diff --git a/.jules/sentinel.md b/.jules/sentinel.md index b5d9250..e5b2a42 100644 --- a/.jules/sentinel.md +++ b/.jules/sentinel.md @@ -12,3 +12,8 @@ **Vulnerability:** XSS risk via unsanitized `<` characters in `JSON.stringify` output injected into `` to break out of the context and inject malicious scripts. **Prevention:** Always replace `<` with `\u003c` when injecting JSON output into script tags, e.g., `JSON.stringify(data).replace(/ { headers: { Accept: "application/json", }, + signal: AbortSignal.timeout(NODE_PROBE_TIMEOUT_MS), }); if (!response.ok) { diff --git a/src/lib/snap-market.ts b/src/lib/snap-market.ts index 19b7c1a..7996ea4 100644 --- a/src/lib/snap-market.ts +++ b/src/lib/snap-market.ts @@ -1,6 +1,7 @@ import { SNAP, correctedSnapFdv } from "@/lib/snap"; export const SNAP_MARKET_REVALIDATE = 30; +export const SNAP_MARKET_TIMEOUT_MS = 10_000; type DexPeriod = { buys?: number; @@ -79,6 +80,7 @@ export async function getSnapMarketData(): Promise { "user-agent": "hypersnap.org market data checker", }, next: { revalidate: SNAP_MARKET_REVALIDATE }, + signal: AbortSignal.timeout(SNAP_MARKET_TIMEOUT_MS), }); if (!response.ok) {