Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Do not reuse requestOptions object #3847

Closed
wants to merge 1 commit into from

Conversation

tommoor
Copy link
Contributor

@tommoor tommoor commented Dec 5, 2023

What does this PR do?

Ensures a fresh options object is passed to request on each request.

Motivation

This is good practice and protects against potential memory leaks such as getsentry/sentry-javascript#8654 which just cost me several days of debugging time.

Plugin Checklist

Additional Notes

Security

Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

@tommoor tommoor marked this pull request as ready for review December 5, 2023 14:05
@tommoor tommoor requested a review from a team as a code owner December 5, 2023 14:05
@simon-id
Copy link
Member

Hi @tommoor, thank you for the contribution and sorry for the delayed answer due to the holiday season!

I've reviewed your PR and argument, and I agree I made a small oversight by not taking into account the potential third party libraries that would piggyback on the requestOptions object and mutate it.
I've cherrypicked your commit in this PR #3959 (for CI security reasons), and I'll complete it by updating the relevant tests.

Next time you're running into an issue that only happens when dd-trace is enabled, I suggest you go directly through our customer support, for a faster response, and easier visibility.

@simon-id
Copy link
Member

simon-id commented Jan 12, 2024

Merged in #3959

@simon-id simon-id closed this Jan 12, 2024
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