Skip to content

Commit 794d95a

Browse files
authored
feat(deps): bump oidc-plugin to 2.0.0 MONGOSH-2194 (#2500)
1 parent e72790d commit 794d95a

File tree

12 files changed

+863
-565
lines changed

12 files changed

+863
-565
lines changed

package-lock.json

Lines changed: 824 additions & 552 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/arg-parser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"mongodb-connection-string-url": "^3.0.1"
4141
},
4242
"devDependencies": {
43-
"@mongodb-js/devtools-connect": "^3.4.1",
43+
"@mongodb-js/devtools-connect": "^3.9.2",
4444
"@mongodb-js/eslint-config-mongosh": "^1.0.0",
4545
"@mongodb-js/prettier-config-devtools": "^1.0.1",
4646
"@mongodb-js/tsconfig-mongosh": "^1.0.0",

packages/cli-repl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
}
6363
},
6464
"dependencies": {
65-
"@mongodb-js/devtools-proxy-support": "^0.4.2",
65+
"@mongodb-js/devtools-proxy-support": "^0.5.1",
6666
"@mongosh/arg-parser": "^3.14.0",
6767
"@mongosh/autocomplete": "^3.18.0",
6868
"@mongosh/editor": "^3.18.0",

packages/cli-repl/webpack.config.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,18 @@ const config = {
9696

9797
module.exports = merge(baseWebpackConfig, config);
9898

99+
function moduleExportNeedsIdentityPreserved(pkg, key) {
100+
// This provides special-casing for the `allowInsecureRequests`
101+
// exports of the openid-client package. While the specific object
102+
// identity of exported functions is generally not important, and
103+
// wrappers can freely be applied, in this specific case the
104+
// openid-client package *does* check whether the `execute` array
105+
// passed to `.discover()` contains the `allowInsecureRequests`
106+
// function, and aligns behavior based on that (in addition to just
107+
// calling the function, as one would expect).
108+
return pkg === 'openid-client' && key === 'allowInsecureRequests';
109+
}
110+
99111
// Helper to create a module that lazily loads the actual target package
100112
// when it is being encountered. This is useful for snapshotting, where some
101113
// packages either cannot be snapshotted or perform initialization during
@@ -150,7 +162,10 @@ function makeLazyForwardModule(pkg) {
150162
.join(', ')} } = Reflect;\n`;
151163
let i = 0;
152164
for (const key of Object.keys(moduleContents)) {
153-
if (typeof moduleContents[key] === 'function') {
165+
if (
166+
typeof moduleContents[key] === 'function' &&
167+
!moduleExportNeedsIdentityPreserved(pkg, key)
168+
) {
154169
source += `module.exports[${S(key)}] = new Proxy(function() {}, {
155170
${proxyProps
156171
.map(

packages/e2e-tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
"dependencies": {
3030
"@mongosh/cli-repl": "2.5.6",
3131
"@mongosh/service-provider-core": "3.3.5",
32-
"@mongodb-js/oidc-plugin": "^1.1.8",
32+
"@mongodb-js/oidc-plugin": "^2.0.1",
3333
"strip-ansi": "^6.0.0"
3434
},
3535
"devDependencies": {
3636
"mongodb-log-writer": "^2.3.1",
3737
"@mongodb-js/eslint-config-mongosh": "^1.0.0",
38-
"@mongodb-js/oidc-mock-provider": "^0.10.2",
38+
"@mongodb-js/oidc-mock-provider": "^0.11.3",
3939
"@mongodb-js/prettier-config-devtools": "^1.0.1",
4040
"@mongodb-js/tsconfig-mongosh": "^1.0.0",
4141
"@types/chai-as-promised": "^7.1.3",

packages/e2e-tests/test/e2e-oidc.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ describe('OIDC auth e2e', function () {
502502
await shell.waitForSuccessfulExit();
503503

504504
shell.assertContainsOutput('BEGIN OIDC TOKEN DUMP');
505-
shell.assertContainsOutput('"tokenType": "Bearer"');
505+
shell.assertContainsOutput('"tokenType": "bearer"');
506506
shell.assertContainsOutput('"alg": "RS256"');
507507
shell.assertContainsOutput('"sub": "testuser"');
508508
shell.assertNotContainsOutput('"signature":');
@@ -522,7 +522,7 @@ describe('OIDC auth e2e', function () {
522522
await shell.waitForSuccessfulExit();
523523

524524
shell.assertContainsOutput('BEGIN OIDC TOKEN DUMP');
525-
shell.assertContainsOutput('"tokenType": "Bearer"');
525+
shell.assertContainsOutput('"tokenType": "bearer"');
526526
shell.assertContainsOutput('"alg": "RS256"');
527527
shell.assertContainsOutput('"sub": "testuser"');
528528
shell.assertContainsOutput('"signature":');

packages/logging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"dependencies": {
2020
"@mongodb-js/device-id": "^0.2.1",
21-
"@mongodb-js/devtools-connect": "^3.4.1",
21+
"@mongodb-js/devtools-connect": "^3.9.2",
2222
"@mongosh/errors": "2.4.2",
2323
"@mongosh/history": "2.4.8",
2424
"@mongosh/types": "3.10.0",

packages/service-provider-node-driver/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
}
4848
},
4949
"dependencies": {
50-
"@mongodb-js/devtools-connect": "^3.4.1",
51-
"@mongodb-js/oidc-plugin": "^1.1.8",
50+
"@mongodb-js/devtools-connect": "^3.9.2",
51+
"@mongodb-js/oidc-plugin": "^2.0.1",
5252
"@mongosh/errors": "2.4.2",
5353
"@mongosh/service-provider-core": "3.3.5",
5454
"@mongosh/types": "3.10.0",

packages/service-provider-node-driver/src/node-driver-service-provider.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,7 @@ describe('NodeDriverServiceProvider', function () {
10981098
).to.deep.equal({
10991099
oidc: { ...cloneableOidcOptions },
11001100
...productInfo,
1101+
__skipPingOnConnect: false,
11011102
});
11021103
});
11031104

packages/service-provider-node-driver/src/node-driver-service-provider.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,17 @@ export type DropDatabaseResult = {
140140
/**
141141
* Default driver options we always use.
142142
*/
143-
const DEFAULT_DRIVER_OPTIONS: MongoClientOptions = Object.freeze({});
143+
const DEFAULT_DRIVER_OPTIONS: MongoClientOptions = Object.freeze({
144+
// In COMPASS-9455 / https://github.com/mongodb-js/devtools-shared/pull/557,
145+
// we turned on the driver-internal `__skipPingOnConnect` option on by default
146+
// for devtools-connect usage, turning off an extra `ping` rountrip when auth
147+
// options have been provided. In mongosh, we do require this ping check,
148+
// because we only print a warning rather than throwing an exception
149+
// if a follow-up ping fails (e.g. in load-balanced mode). So setting this
150+
// flag to `false` here restores mongosh's existing behavior, and we can
151+
// revisit this in the next major version of mongosh.
152+
__skipPingOnConnect: false,
153+
} as MongoClientOptions);
144154

145155
/**
146156
* Default driver method options we always use.

0 commit comments

Comments
 (0)