Skip to content

[security-solution] Remove node-fetch dependency in favor of native fetch#250715

Merged
afharo merged 4 commits intoelastic:mainfrom
afharo:remove-node-fetch/security-solution
Feb 4, 2026
Merged

[security-solution] Remove node-fetch dependency in favor of native fetch#250715
afharo merged 4 commits intoelastic:mainfrom
afharo:remove-node-fetch/security-solution

Conversation

@afharo
Copy link
Copy Markdown
Member

@afharo afharo commented Jan 28, 2026

Summary

This PR removes the node-fetch dependency for files owned by @elastic/security-solution.

Why

Node.js 18+ includes a native fetch API (built on undici internally), making the node-fetch package unnecessary. This reduces the dependency footprint by removing one runtime dependency and its transitive dependencies.

Changes

  • Updated agent downloads service to use native fetch with Readable.fromWeb() for stream conversion
  • Updated usage reporting service to use undici.Agent for custom TLS configuration
  • Updated MITRE tactics/techniques extraction script
  • Updated all related test files

Warning

These changes were vibe-coded using the AI agent claude-4.5-opus-high. Please review carefully.

Test plan

  • Type check passes
  • ESLint passes
  • Unit tests pass for modified files

…etch

## Changes
- Updated agent downloads service to use native fetch with Readable.fromWeb()
- Updated usage reporting service to use undici Agent for TLS
- Updated MITRE extraction script
- Updated all related test files

> [!WARNING]
> These changes were vibe-coded using the AI agent `claude-4.5-opus-high`. Please review carefully.
@afharo afharo requested review from a team as code owners January 28, 2026 13:12
@afharo afharo added backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Defend Workflows “EDR Workflows” sub-team of Security Solution labels Jan 28, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-defend-workflows (Team:Defend Workflows)

The test was using new Response(body, { status: 200 }) which doesn't
properly set the ok property in all test environments. Also improved
the WriteStream mock to support pipe operations needed by
Readable.fromWeb().
Copy link
Copy Markdown
Contributor

@paul-tavares paul-tavares left a comment

Choose a reason for hiding this comment

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

changes to files under x-pack/solutions/security/plugins/security_solution/scripts/endpoint/* look good.

Thank you

Copy link
Copy Markdown
Contributor

@szwarckonrad szwarckonrad left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for addressing this!

@afharo afharo enabled auto-merge (squash) February 4, 2026 16:39
@afharo afharo merged commit 03212e8 into elastic:main Feb 4, 2026
17 checks passed
@afharo afharo deleted the remove-node-fetch/security-solution branch February 4, 2026 19:38
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

The CI Stats report is too large to be displayed here, check out the CI build annotation for this information.

History

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

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants