Skip to content

crypto: free disabled OpenSSL compression methods#64683

Open
BridgeAR wants to merge 1 commit into
nodejs:mainfrom
BridgeAR:BridgeAR/2026-07-22-fix-openssl-compression-leak
Open

crypto: free disabled OpenSSL compression methods#64683
BridgeAR wants to merge 1 commit into
nodejs:mainfrom
BridgeAR:BridgeAR/2026-07-22-fix-openssl-compression-leak

Conversation

@BridgeAR

@BridgeAR BridgeAR commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

Node's compression-enabled OpenSSL build initializes the legacy TLS record-compression methods during startup. sk_SSL_COMP_zero() removed those methods from the stack without freeing them, so LeakSanitizer reported a 24-byte leak after otherwise successful test runs.

Free each method before removing it while keeping OpenSSL's stack container valid. This preserves Node's process-wide CRIME protection, including when SSL_CONF enables record compression at security level 1, while certificate compression remains available.

The regression test starts Node with that unsafe OpenSSL configuration and verifies that its TLS 1.2 ClientHello still advertises only null compression. Without the fix it also advertises zlib.

Refs: #62217

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run. labels Jul 22, 2026
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-07-22-fix-openssl-compression-leak branch from 8ef0f45 to 4ad0562 Compare July 22, 2026 20:58
Node's compression-enabled OpenSSL build allocates TLS
record-compression methods during startup. Clearing the stack loses
the only pointers without freeing entries, so LeakSanitizer reports
a 24-byte leak.

Pop and free every method while preserving the OpenSSL-owned stack.
Record compression remains unavailable process-wide, including when
SSL_CONF attempts to enable it at a lower security level.

Refs: nodejs#62217
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
@BridgeAR
BridgeAR force-pushed the BridgeAR/2026-07-22-fix-openssl-compression-leak branch from 4ad0562 to 0469d65 Compare July 23, 2026 12:21
@BridgeAR BridgeAR changed the title crypto: stop clearing OpenSSL compression methods crypto: free disabled OpenSSL compression methods Jul 23, 2026
@BridgeAR
BridgeAR marked this pull request as ready for review July 23, 2026 14:27
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (3437feb) to head (0469d65).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64683      +/-   ##
==========================================
- Coverage   90.13%   90.13%   -0.01%     
==========================================
  Files         741      741              
  Lines      242158   242161       +3     
  Branches    45608    45612       +4     
==========================================
- Hits       218265   218260       -5     
- Misses      15361    15381      +20     
+ Partials     8532     8520      -12     
Files with missing lines Coverage Δ
src/crypto/crypto_util.cc 72.63% <100.00%> (+0.17%) ⬆️

... and 26 files with indirect coverage changes

🚀 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.

@pimterry pimterry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some linting errors here, otherwise LGTM 👍

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

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants