Skip to content

πŸ›‘οΈ Sentinel: [ENHANCEMENT] Add timeout to external API calls - #41

Open
felirami wants to merge 1 commit into
mainfrom
sentinel-add-fetch-timeouts-418629655227238592
Open

πŸ›‘οΈ Sentinel: [ENHANCEMENT] Add timeout to external API calls#41
felirami wants to merge 1 commit into
mainfrom
sentinel-add-fetch-timeouts-418629655227238592

Conversation

@felirami

@felirami felirami commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

User description

🚨 Severity: ENHANCEMENT
πŸ’‘ Vulnerability: Missing timeouts on external fetch calls, which can cause resource exhaustion or hanging processes if external services are down or unresponsive.
🎯 Impact: Prevents potential DoS or hanging build processes caused by hanging network requests.
πŸ”§ Fix: Added signal: AbortSignal.timeout(10_000) to 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 to ensure the build and code verifications pass.


PR created automatically by Jules for task 418629655227238592 started by @felirami


Note

Low Risk
Small, defensive networking change with no auth or data-model impact; worst case is earlier failures when external APIs are slow.

Overview
Adds 10-second AbortSignal.timeout on outbound fetch calls so slow or stuck third-party APIs cannot hang builds or server work indefinitely.

scripts/sync-sources.mjs defines FETCH_TIMEOUT_MS and applies it to GitHub JSON and raw text helpers used during source sync. src/lib/network.ts wires the existing NODE_PROBE_TIMEOUT_MS into the public node info probe in getNetworkStatus. src/lib/snap-market.ts exports FETCH_TIMEOUT_MS and uses it for the Dexscreener market fetch in getSnapMarketData.

Failures surface through existing error handling (e.g. network status and market responses) rather than open-ended waits.

Reviewed by Cursor Bugbot for commit 7e0b6ed. Bugbot is set up for automated code reviews on this repo. Configure here.


CodeAnt-AI Description

Add timeouts to external API requests

What Changed

  • External network calls now stop after 10 seconds instead of waiting indefinitely
  • Network status checks fail sooner when the public node API is slow or unresponsive
  • Snap market data requests stop hanging on slow Dexscreener responses
  • Source sync requests to GitHub now time out instead of stalling the script

Impact

βœ… Fewer hung sync jobs
βœ… Faster failure when third-party APIs are down
βœ… Reduced build and server waits on slow network calls

πŸ’‘ Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Note

Add 10-second abort timeouts to external API fetch calls

Adds AbortSignal.timeout(10000) to fetch calls in three modules: GitHub sync utilities in sync-sources.mjs, the node info probe in network.ts, and the market data fetch in snap-market.ts. Timed-out requests throw and flow into existing error-handling paths, returning ok=false where applicable. Behavioral Change: requests that previously hung indefinitely will now fail after 10 seconds.

Macroscope summarized 7e0b6ed.

Co-authored-by: felirami <6752178+felirami@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hypersnaporg Ready Ready Preview, Comment Jul 5, 2026 9:12pm

Request Review

@codeant-ai

codeant-ai Bot commented Jul 5, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@codeant-ai

codeant-ai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! πŸŽ‰

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X Β·
Reddit Β·
LinkedIn

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Jul 5, 2026
@codeant-ai

codeant-ai Bot commented Jul 5, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e0b6ed7d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/network.ts
headers: {
Accept: "application/json",
},
signal: AbortSignal.timeout(NODE_PROBE_TIMEOUT_MS),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve memoization for repeated status probes

On /network, NetworkPage awaits getNetworkStatus() before rendering NetworkStatusGrid, which calls getNetworkStatus() again; on a cache miss/revalidation with a slow public node, adding a fresh signal here opts the server fetch out of Next request memoization (Next fetch docs). That makes the route wait for one 10s probe and then start another 10s probe instead of sharing the first result, so the degraded page can take ~20s or exceed serverless budgets; consider passing the first status into the grid or wrapping the status lookup in an explicit cache.

Useful? React with πŸ‘Β / πŸ‘Ž.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant