Skip to content

fix(opentelemetry-core): add extra checks on internal merge function for safety#6587

Merged
maryliag merged 2 commits intoopen-telemetry:mainfrom
maryliag:merge-update
Apr 16, 2026
Merged

fix(opentelemetry-core): add extra checks on internal merge function for safety#6587
maryliag merged 2 commits intoopen-telemetry:mainfrom
maryliag:merge-update

Conversation

@maryliag
Copy link
Copy Markdown
Contributor

The mergeTwoObjects function iterates over keys from untrusted objects without filtering proto, constructor, or prototype, which would allow someone controlling a config object to pollute Object.prototype.

Fix: Add a key check before processing

@maryliag maryliag requested a review from a team as a code owner April 13, 2026 15:53
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.74%. Comparing base (36ce569) to head (fc92b57).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
packages/opentelemetry-core/src/utils/merge.ts 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6587      +/-   ##
==========================================
- Coverage   95.75%   95.74%   -0.02%     
==========================================
  Files         375      375              
  Lines       12725    12735      +10     
  Branches     3013     3021       +8     
==========================================
+ Hits        12185    12193       +8     
- Misses        540      542       +2     
Files with missing lines Coverage Δ
packages/opentelemetry-core/src/utils/merge.ts 97.05% <80.00%> (-1.86%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@trentm trentm left a comment

Choose a reason for hiding this comment

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

Looks good, thanks.

(I'd also welcome a separate PR to remove this export from the "core" package -- a breaking change that would need to be part of the coming SDK 3.0 -- and update the only place that currently uses this:


;)

@trentm
Copy link
Copy Markdown
Contributor

trentm commented Apr 15, 2026

(I'd also welcome a separate PR to remove this export

I opened #6597 for this.

@trentm trentm changed the title feat(opentelemetry-core): add extra checks on internal merge function for safety fix(opentelemetry-core): add extra checks on internal merge function for safety Apr 15, 2026
@maryliag maryliag added this pull request to the merge queue Apr 16, 2026
Merged via the queue into open-telemetry:main with commit 36e2a9a Apr 16, 2026
27 checks passed
@maryliag maryliag deleted the merge-update branch April 16, 2026 14:00
maryliag added a commit to maryliag/opentelemetry-js that referenced this pull request Apr 17, 2026
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