Skip to content

feat(deps): bump oidc-plugin to 2.0.0 MONGOSH-2194 #2500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
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
1,376 changes: 824 additions & 552 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/arg-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"mongodb-connection-string-url": "^3.0.1"
},
"devDependencies": {
"@mongodb-js/devtools-connect": "^3.4.1",
"@mongodb-js/devtools-connect": "^3.9.2",
"@mongodb-js/eslint-config-mongosh": "^1.0.0",
"@mongodb-js/prettier-config-devtools": "^1.0.1",
"@mongodb-js/tsconfig-mongosh": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli-repl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
}
},
"dependencies": {
"@mongodb-js/devtools-proxy-support": "^0.4.2",
"@mongodb-js/devtools-proxy-support": "^0.5.1",
"@mongosh/arg-parser": "^3.14.0",
"@mongosh/autocomplete": "^3.18.0",
"@mongosh/editor": "^3.18.0",
Expand Down
17 changes: 16 additions & 1 deletion packages/cli-repl/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ const config = {

module.exports = merge(baseWebpackConfig, config);

function moduleExportNeedsIdentityPreserved(pkg, key) {
// This provides special-casing for the `allowInsecureRequests`
// exports of the openid-client package. While the specific object
// identity of exported functions is generally not important, and
// wrappers can freely be applied, in this specific case the
// openid-client package *does* check whether the `execute` array
// passed to `.discover()` contains the `allowInsecureRequests`
// function, and aligns behavior based on that (in addition to just
// calling the function, as one would expect).
return pkg === 'openid-client' && key === 'allowInsecureRequests';
}

// Helper to create a module that lazily loads the actual target package
// when it is being encountered. This is useful for snapshotting, where some
// packages either cannot be snapshotted or perform initialization during
Expand Down Expand Up @@ -150,7 +162,10 @@ function makeLazyForwardModule(pkg) {
.join(', ')} } = Reflect;\n`;
let i = 0;
for (const key of Object.keys(moduleContents)) {
if (typeof moduleContents[key] === 'function') {
if (
typeof moduleContents[key] === 'function' &&
!moduleExportNeedsIdentityPreserved(pkg, key)
) {
source += `module.exports[${S(key)}] = new Proxy(function() {}, {
${proxyProps
.map(
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"dependencies": {
"@mongosh/cli-repl": "2.5.6",
"@mongosh/service-provider-core": "3.3.5",
"@mongodb-js/oidc-plugin": "^1.1.8",
"@mongodb-js/oidc-plugin": "^2.0.1",
"strip-ansi": "^6.0.0"
},
"devDependencies": {
"mongodb-log-writer": "^2.3.1",
"@mongodb-js/eslint-config-mongosh": "^1.0.0",
"@mongodb-js/oidc-mock-provider": "^0.10.2",
"@mongodb-js/oidc-mock-provider": "^0.11.3",
"@mongodb-js/prettier-config-devtools": "^1.0.1",
"@mongodb-js/tsconfig-mongosh": "^1.0.0",
"@types/chai-as-promised": "^7.1.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e-tests/test/e2e-oidc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ describe('OIDC auth e2e', function () {
await shell.waitForSuccessfulExit();

shell.assertContainsOutput('BEGIN OIDC TOKEN DUMP');
shell.assertContainsOutput('"tokenType": "Bearer"');
shell.assertContainsOutput('"tokenType": "bearer"');
shell.assertContainsOutput('"alg": "RS256"');
shell.assertContainsOutput('"sub": "testuser"');
shell.assertNotContainsOutput('"signature":');
Expand All @@ -522,7 +522,7 @@ describe('OIDC auth e2e', function () {
await shell.waitForSuccessfulExit();

shell.assertContainsOutput('BEGIN OIDC TOKEN DUMP');
shell.assertContainsOutput('"tokenType": "Bearer"');
shell.assertContainsOutput('"tokenType": "bearer"');
shell.assertContainsOutput('"alg": "RS256"');
shell.assertContainsOutput('"sub": "testuser"');
shell.assertContainsOutput('"signature":');
Expand Down
2 changes: 1 addition & 1 deletion packages/logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"dependencies": {
"@mongodb-js/device-id": "^0.2.1",
"@mongodb-js/devtools-connect": "^3.4.1",
"@mongodb-js/devtools-connect": "^3.9.2",
"@mongosh/errors": "2.4.2",
"@mongosh/history": "2.4.8",
"@mongosh/types": "3.10.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/service-provider-node-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
}
},
"dependencies": {
"@mongodb-js/devtools-connect": "^3.4.1",
"@mongodb-js/oidc-plugin": "^1.1.8",
"@mongodb-js/devtools-connect": "^3.9.2",
"@mongodb-js/oidc-plugin": "^2.0.1",
"@mongosh/errors": "2.4.2",
"@mongosh/service-provider-core": "3.3.5",
"@mongosh/types": "3.10.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,7 @@ describe('NodeDriverServiceProvider', function () {
).to.deep.equal({
oidc: { ...cloneableOidcOptions },
...productInfo,
__skipPingOnConnect: false,
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,17 @@ export type DropDatabaseResult = {
/**
* Default driver options we always use.
*/
const DEFAULT_DRIVER_OPTIONS: MongoClientOptions = Object.freeze({});
const DEFAULT_DRIVER_OPTIONS: MongoClientOptions = Object.freeze({
// In COMPASS-9455 / https://github.com/mongodb-js/devtools-shared/pull/557,
// we turned on the driver-internal `__skipPingOnConnect` option on by default
// for devtools-connect usage, turning off an extra `ping` rountrip when auth
// options have been provided. In mongosh, we do require this ping check,
// because we only print a warning rather than throwing an exception
// if a follow-up ping fails (e.g. in load-balanced mode). So setting this
// flag to `false` here restores mongosh's existing behavior, and we can
// revisit this in the next major version of mongosh.
__skipPingOnConnect: false,
} as MongoClientOptions);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nbbeeken fyi


/**
* Default driver method options we always use.
Expand Down
2 changes: 1 addition & 1 deletion packages/snippet-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"unitTestsOnly": true
},
"dependencies": {
"@mongodb-js/devtools-proxy-support": "^0.4.2",
"@mongodb-js/devtools-proxy-support": "^0.5.1",
"@mongosh/errors": "2.4.2",
"@mongosh/shell-api": "^3.18.0",
"@mongosh/types": "3.10.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"unitTestsOnly": true
},
"dependencies": {
"@mongodb-js/devtools-connect": "^3.4.1"
"@mongodb-js/devtools-connect": "^3.9.2"
},
"devDependencies": {
"@mongodb-js/eslint-config-mongosh": "^1.0.0",
Expand Down
Loading