Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

@icecrasher321 icecrasher321 commented Jan 21, 2026

Summary

* fix(http): options not parsed accurately

* fix lint

* remove boilerplate code'
@vercel
Copy link

vercel bot commented Jan 21, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 21, 2026 10:41am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 21, 2026

Greptile Summary

Fixed the secureFetchWithPinnedIP function's custom DNS lookup implementation to properly handle Node.js agent options parsing. The lookup function now correctly handles the options.all parameter by returning an array of address objects when all: true, or individual values when all: false. Additionally, the accept-encoding header is now removed before making requests since Node.js http/https modules don't automatically decompress responses.

Key Changes:

  • Imported LookupFunction type from 'net' module for proper type safety
  • Fixed lookup function to handle both options.all cases correctly
  • Added explicit type annotation http.AgentOptions for agent configuration
  • Removed accept-encoding header from requests to prevent compression issues
  • Improved code structure by extracting lookup function outside agentOptions

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes fix a legitimate bug in the DNS lookup function where options.all wasn't being handled correctly, which could cause runtime errors when the http/https agent internally calls the lookup function. The fix properly implements the LookupFunction interface from Node.js, adds appropriate type safety, and removes the accept-encoding header which prevents potential decompression issues. The changes are localized, well-commented, and improve code correctness without introducing new risks.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/lib/core/security/input-validation.ts Fixed lookup function to properly handle options.all case and removed accept-encoding header

Sequence Diagram

sequenceDiagram
    participant Client as Tool Executor
    participant Validator as validateUrlWithDNS
    participant DNS as DNS Resolver
    participant Fetch as secureFetchWithPinnedIP
    participant Agent as HTTP/HTTPS Agent
    participant Server as External Server

    Client->>Validator: validateUrlWithDNS(url)
    Validator->>DNS: dns.lookup(hostname)
    DNS-->>Validator: resolvedIP
    Validator->>Validator: Check if IP is private/reserved
    Validator-->>Client: {isValid, resolvedIP}
    
    Client->>Fetch: secureFetchWithPinnedIP(url, resolvedIP, options)
    Fetch->>Fetch: Create lookup function with pinned IP
    Note over Fetch: lookup handles options.all case:<br/>returns [{address, family}] or (address, family)
    Fetch->>Fetch: Remove accept-encoding header
    Fetch->>Agent: Create Agent with custom lookup
    Fetch->>Server: HTTP/HTTPS request with pinned IP
    Note over Agent,Server: Agent uses lookup function<br/>to force connection to resolvedIP
    Server-->>Fetch: Response
    Fetch-->>Client: SecureFetchResponse
Loading

* fix(ring): duplicate should clear original block

* rename correctly
@icecrasher321
Copy link
Collaborator Author

@cursor review

@icecrasher321 icecrasher321 changed the title v0.5.66: external http/s requests fix v0.5.66: external http requests fix, ring highlighting Jan 21, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@icecrasher321 icecrasher321 merged commit 45371e5 into main Jan 21, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants