Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions benchmark/crypto/timingSafeEqual.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ const { randomBytes, timingSafeEqual } = require('node:crypto');
const bench = common.createBenchmark(main, {
n: [1e5],
bufferSize: [10, 100, 200, 2_100, 22_023],
}, {
test: { bufferSize: 256 },
});

function main({ n, bufferSize }) {
const bufs = [randomBytes(bufferSize), randomBytes(bufferSize)];
// Ensure the buffers differ even if the random bytes are identical.
bufs[1][0] = bufs[0][0] ^ 1;
bench.start();
let count = 0;
for (let i = 0; i < n; i++) {
Expand Down
3 changes: 0 additions & 3 deletions test/benchmark/benchmark.status
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ prefix benchmark

[true] # This section applies to all platforms

# https://github.com/nodejs/node/issues/52690
test-benchmark-crypto: PASS, FLAKY

[$system==win32]

[$system==linux]
Expand Down
4 changes: 0 additions & 4 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ test-performance-function: PASS, FLAKY
# https://github.com/nodejs/node/issues/54346
test-esm-loader-hooks-inspect-wait: PASS, FLAKY

[$system==linux && $arch==s390x]
# https://github.com/nodejs/node/issues/58353
test-http2-debug: PASS, FLAKY

[$system==macos]
# https://github.com/nodejs/node/issues/42741
test-http-server-headers-timeout-keepalive: PASS,FLAKY
Expand Down
54 changes: 32 additions & 22 deletions test/parallel/test-http2-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,37 @@ if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
const { spawnSyncAndAssert } = require('../common/child_process');
const fs = require('fs');
const path = require('path');
const tmpdir = require('../common/tmpdir');

spawnSyncAndAssert(process.execPath, [
path.resolve(__dirname, 'test-http2-ping.js'),
], {
env: {
...process.env,
NODE_DEBUG: 'http2',
NODE_DEBUG_NATIVE: 'http2',
},
}, {
trim: true,
stderr(output) {
assert.match(output,
/Setting the NODE_DEBUG environment variable to 'http2' can expose sensitive data/);
assert.match(output, /\(such as passwords, tokens and authentication headers\) in the resulting log\.\r?\n/);
assert.match(output, /Http2Session client \(\d+\) handling data frame for stream \d+\r?\n/);
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session client \(\d+\)\] reading starting\r?\n/);
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session client \(\d+\)\] closed with code 0\r?\n/);
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session server \(\d+\)\] closed with code 0\r?\n/);
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session server \(\d+\)\] tearing down stream\r?\n/);
},
stdout: ''
});
tmpdir.refresh();
const stderrFile = tmpdir.resolve('stderr.log');
// Native debug writes can be lost when a non-blocking stderr pipe fills.
const stderrFd = fs.openSync(stderrFile, 'w');
try {
spawnSyncAndAssert(process.execPath, [
path.resolve(__dirname, 'test-http2-ping.js'),
], {
env: {
...process.env,
NODE_DEBUG: 'http2',
NODE_DEBUG_NATIVE: 'http2',
},
stdio: ['pipe', 'pipe', stderrFd],
}, {
stdout: ''
});
} finally {
fs.closeSync(stderrFd);
}

const output = fs.readFileSync(stderrFile, 'utf8');
assert.match(output,
/Setting the NODE_DEBUG environment variable to 'http2' can expose sensitive data/);
assert.match(output, /\(such as passwords, tokens and authentication headers\) in the resulting log\.\r?\n/);
assert.match(output, /Http2Session client \(\d+\) handling data frame for stream \d+\r?\n/);
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session client \(\d+\)\] reading starting\r?\n/);
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session client \(\d+\)\] closed with code 0\r?\n/);
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session server \(\d+\)\] closed with code 0\r?\n/);
assert.match(output, /HttpStream \d+ \(\d+\) \[Http2Session server \(\d+\)\] tearing down stream\r?\n/);
Loading