Skip to content

Commit bbf75ca

Browse files
authored
Merge branch 'main' into feat/NODE-7512_smoke_test_windows
2 parents 632b4ba + 90f6967 commit bbf75ca

29 files changed

Lines changed: 254 additions & 187 deletions

.evergreen/ci_matrix_constants.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const UBUNTU_OS = 'ubuntu1804-large';
2020
const UBUNTU_20_OS = 'ubuntu2004-small';
2121
const UBUNTU_22_OS = 'ubuntu2204-large';
2222
const DEBIAN_OS = 'debian11-small';
23+
const GRAVITON_OS = 'amazon2023-arm64-latest-large-m8g';
2324

2425
module.exports = {
2526
MONGODB_VERSIONS,
@@ -37,5 +38,6 @@ module.exports = {
3738
UBUNTU_OS,
3839
UBUNTU_20_OS,
3940
UBUNTU_22_OS,
40-
DEBIAN_OS
41+
DEBIAN_OS,
42+
GRAVITON_OS
4143
};

.evergreen/config.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4120,3 +4120,17 @@ buildvariants:
41204120
NODE_LTS_VERSION: 24
41214121
CLIENT_ENCRYPTION: true
41224122
MONGODB_BUNDLED: true
4123+
- name: amazon-linux-2023-arm64-graviton4
4124+
display_name: Graviton4 AL2023 Node24
4125+
run_on: amazon2023-arm64-latest-large-m8g
4126+
expansions:
4127+
NODE_LTS_VERSION: 24
4128+
CLIENT_ENCRYPTION: true
4129+
TEST_CSFLE: true
4130+
tasks:
4131+
- test-latest-server
4132+
- test-latest-replica_set
4133+
- test-latest-sharded_cluster
4134+
- test-latest-server-v1-api
4135+
- test-zstd-compression
4136+
- test-snappy-compression

.evergreen/generate_evergreen_tasks.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const {
1717
MACOS_OS,
1818
UBUNTU_20_OS,
1919
DEBIAN_OS,
20-
UBUNTU_22_OS
20+
UBUNTU_22_OS,
21+
GRAVITON_OS
2122
} = require('./ci_matrix_constants');
2223

2324
// TODO(NODE-7499): unpin npm version once Node 22 ships a bundled npm that can upgrade itself
@@ -875,6 +876,27 @@ BUILD_VARIANTS.push({
875876
expansions: nodelessExpansions
876877
});
877878

879+
const gravitonTasks = [
880+
'test-latest-server',
881+
'test-latest-replica_set',
882+
'test-latest-sharded_cluster',
883+
'test-latest-server-v1-api',
884+
'test-zstd-compression',
885+
'test-snappy-compression'
886+
];
887+
888+
BUILD_VARIANTS.push({
889+
name: 'amazon-linux-2023-arm64-graviton4',
890+
display_name: `Graviton4 AL2023 Node${LATEST_LTS}`,
891+
run_on: GRAVITON_OS,
892+
expansions: {
893+
NODE_LTS_VERSION: LATEST_LTS,
894+
CLIENT_ENCRYPTION: true,
895+
TEST_CSFLE: true
896+
},
897+
tasks: gravitonTasks
898+
});
899+
878900
// TODO(NODE-4897): Debug socks5 tests on node latest
879901
for (const variant of BUILD_VARIANTS.filter(
880902
variant => variant.expansions && ['latest'].includes(variant.expansions.NODE_LTS_VERSION)

.github/workflows/npm-publish.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,9 @@ jobs:
3636
ref: ${{ inputs.ref }}
3737
- name: Install Node and dependencies
3838
uses: mongodb-labs/drivers-github-tools/node/setup@v3
39-
- run: npm version "${{ inputs.version }}" --git-tag-version=false --allow-same-version
40-
- run: npm publish --provenance --tag="${{ inputs.tag }}"
39+
- run: npm version "$VERSION" --git-tag-version=false --allow-same-version
40+
env:
41+
VERSION: ${{ inputs.version }}
42+
- run: npm publish --provenance --tag="$TAG"
43+
env:
44+
TAG: ${{ inputs.tag }}

.github/workflows/release-6.8.yml

Lines changed: 0 additions & 113 deletions
This file was deleted.

.github/workflows/release-alpha.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ on:
99
type: string
1010

1111
permissions:
12-
id-token: write
12+
actions: write
13+
contents: read
1314

1415
name: release-alpha
1516

@@ -18,17 +19,22 @@ jobs:
1819
runs-on: ubuntu-latest
1920
steps:
2021
- shell: bash
22+
env:
23+
ALPHA_VERSION: ${{ inputs.alphaVersion }}
2124
run: |
2225
ALPHA_SEMVER_REGEXP="-alpha(\.([0-9]|[1-9][0-9]+))?$"
2326
24-
if ! [[ "${{ inputs.alphaVersion }}" =~ $ALPHA_SEMVER_REGEXP ]]; then
27+
if ! [[ "$ALPHA_VERSION" =~ $ALPHA_SEMVER_REGEXP ]]; then
2528
echo "Invalid alphaVersion string"
2629
exit 1
2730
fi
2831
- uses: actions/checkout@v5
29-
- name: Install Node and dependencies
30-
uses: mongodb-labs/drivers-github-tools/node/setup@v3
31-
- run: npm version "${{ inputs.alphaVersion }}" --git-tag-version=false
32-
- run: npm publish --provenance --tag=alpha
32+
- name: Dispatch npm-publish workflow
3333
env:
34-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34+
GH_TOKEN: ${{ github.token }}
35+
ALPHA_VERSION: ${{ inputs.alphaVersion }}
36+
run: |
37+
node ./.github/scripts/dispatch-and-wait.mjs npm-publish.yml \
38+
tag=alpha \
39+
version="$ALPHA_VERSION" \
40+
ref="${{ github.sha }}"

.github/workflows/release.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
permissions:
77
contents: write
88
pull-requests: write
9-
id-token: write
109

1110
name: release-latest
1211

@@ -91,15 +90,20 @@ jobs:
9190

9291
publish:
9392
needs: [release_please, ssdlc, build]
93+
permissions:
94+
actions: write
95+
contents: read
9496
environment: release
9597
runs-on: ubuntu-latest
9698
steps:
9799
- uses: actions/checkout@v5
98100

99-
- name: Install Node and dependencies
100-
uses: mongodb-labs/drivers-github-tools/node/setup@v3
101-
102-
- run: npm publish --provenance --tag=latest
101+
- name: Dispatch npm-publish workflow
103102
if: ${{ needs.release_please.outputs.release_created }}
104103
env:
105-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
104+
GH_TOKEN: ${{ github.token }}
105+
run: |
106+
node ./.github/scripts/dispatch-and-wait.mjs npm-publish.yml \
107+
tag=latest \
108+
version="$(node -p "require('./package.json').version")" \
109+
ref="${{ github.sha }}"

etc/bundle-driver.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ await esbuild.build({
1717
entryPoints: [path.join(rootDir, 'test/mongodb_all.ts')],
1818
bundle: true,
1919
outfile: outputBundleFile,
20-
platform: 'node',
20+
platform: 'browser',
2121
format: 'cjs',
22-
target: 'node20',
22+
target: 'chrome112',
2323
external: [
2424
'@aws-sdk/credential-providers',
2525
'@mongodb-js/saslprep',
2626
'@mongodb-js/zstd',
2727
'@napi-rs/snappy*',
28-
'bson',
2928
'gcp-metadata',
3029
'kerberos',
3130
'mongodb-client-encryption',

src/bson.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ export const readInt32LE = (buffer: Uint8Array, offset: number): number => {
5555
return NumberUtils.getInt32LE(buffer, offset);
5656
};
5757

58+
// readUint8, reads a single unsigned byte from buffer at given offset
59+
export const readUint8 = (buffer: Uint8Array, offset: number): number => {
60+
validateBufferInputs(buffer, offset, 1);
61+
return buffer[offset];
62+
};
63+
5864
export const setUint32LE = (destination: Uint8Array, offset: number, value: number): 4 => {
5965
destination[offset] = value;
6066
value >>>= 8;

src/cmap/auth/scram.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,10 @@ async function continueScramConversation(
166166
const clientKey = await HMAC(cryptoMethod, saltedPassword, 'Client Key');
167167
const serverKey = await HMAC(cryptoMethod, saltedPassword, 'Server Key');
168168
const storedKey = await H(cryptoMethod, clientKey);
169-
const authMessage = [
170-
clientFirstMessageBare(username, nonce),
171-
payload.toString('utf8'),
172-
withoutProof
173-
].join(',');
169+
const firstMessageBytes = clientFirstMessageBare(username, nonce);
170+
const firstMessage = ByteUtils.toUTF8(firstMessageBytes, 0, firstMessageBytes.length, false);
171+
const payloadString = ByteUtils.toUTF8(payload.buffer, 0, payload.position, false);
172+
const authMessage = [firstMessage, payloadString, withoutProof].join(',');
174173

175174
const clientSignature = await HMAC(cryptoMethod, storedKey, authMessage);
176175
const clientProof = `p=${xor(clientKey, clientSignature)}`;
@@ -205,7 +204,7 @@ async function continueScramConversation(
205204
}
206205

207206
function parsePayload(payload: Binary) {
208-
const payloadStr = payload.toString('utf8');
207+
const payloadStr = ByteUtils.toUTF8(payload.buffer, 0, payload.position, false);
209208
const dict: Document = {};
210209
const parts = payloadStr.split(',');
211210
for (let i = 0; i < parts.length; i++) {

0 commit comments

Comments
 (0)