Skip to content

chore(eventbroker): replace axios and related nock tests#20720

Open
toufali wants to merge 1 commit into
mainfrom
remove-axios-eventbroker
Open

chore(eventbroker): replace axios and related nock tests#20720
toufali wants to merge 1 commit into
mainfrom
remove-axios-eventbroker

Conversation

@toufali

@toufali toufali commented Jun 9, 2026

Copy link
Copy Markdown
Member

Because

  • axios is a recurring source of security advisories. This is the first step of removing it in favor of native fetch (FXA-13427), starting with the self-contained fxa-event-broker package.

This pull request

  • Replaces axios with native fetch in ClientCapabilityService, PubsubProxyController, and the simulate-webhook-call script. Behavior is preserved (explicit !res.ok handling, JSON-with-text-fallback body parsing).
  • Migrates the affected specs off nock to a stubbed global.fetch, and adds coverage for the non-ok HTTP path.
  • Removes the now-unused axios and nock dependencies from the package.

Issue that this pull request solves

Closes: FXA-13427 (event-broker package)

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

@toufali toufali force-pushed the remove-axios-eventbroker branch from 560e575 to 3d9c7a6 Compare June 9, 2026 22:53
@toufali toufali marked this pull request as ready for review June 9, 2026 23:53
@toufali toufali requested a review from a team as a code owner June 9, 2026 23:53
Copilot AI review requested due to automatic review settings June 9, 2026 23:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR removes axios (and related nock-based tests) from the fxa-event-broker package, migrating the affected code paths to native fetch to reduce dependency/security advisory surface area.

Changes:

  • Replaced axios usages with fetch in the pubsub proxy controller, client capability service, and the webhook simulation script.
  • Migrated tests from nock to global.fetch stubs, including coverage for non-OK HTTP responses.
  • Removed axios and nock from fxa-event-broker dependencies and simplified Jest config accordingly.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
yarn.lock Removes axios/nock from the fxa-event-broker workspace dependency set.
packages/fxa-event-broker/src/scripts/simulate-webhook-call.ts Switches webhook call simulation from axios to fetch.
packages/fxa-event-broker/src/pubsub-proxy/pubsub-proxy.controller.ts Replaces axios proxying with fetch, adds JSON-with-text-fallback response parsing helper.
packages/fxa-event-broker/src/pubsub-proxy/pubsub-proxy.controller.spec.ts Replaces nock HTTP mocking with global.fetch stubs and adds a non-OK response test.
packages/fxa-event-broker/src/client-capability/client-capability.service.ts Replaces axios client capability fetch with fetch and explicit non-OK handling.
packages/fxa-event-broker/src/client-capability/client-capability.service.spec.ts Updates tests to stub global.fetch and adds coverage for reject + non-OK paths.
packages/fxa-event-broker/package.json Removes axios and nock dependencies from the package.
packages/fxa-event-broker/jest.config.js Removes the special-case transform for axios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/fxa-event-broker/src/scripts/simulate-webhook-call.ts
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