@mongodb-js/oidc-plugin
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -272,4 +272,12 @@ "use strict"; | ||
async openBrowser(options) { | ||
// Consistency check: options.url is a valid URL. | ||
// Consistency check: options.url is a valid URL and does not contain | ||
// characters that would have special semantics when passed to a | ||
// child process spawned with `shell: true`. | ||
// That might not be true for the URL we got from the IdP, but since we | ||
// wrap it in our own redirect first anyway, we can guarantee that the | ||
// URL has this format. | ||
new URL(options.url); | ||
if (!/^[a-zA-Z0-9%/:;_.,=@-]+$/.test(options.url)) { | ||
throw new types_1.MongoDBOIDCError(`Unexpected format for internally generated URL: '${options.url}'`); | ||
} | ||
this.logger.emit('mongodb-oidc-plugin:open-browser', { | ||
@@ -604,8 +612,10 @@ customOpener: !!this.options.openBrowser, | ||
const newAuthAttempt = this.initiateAuthAttempt(state, driverAbortSignal); | ||
state.currentAuthAttempt = newAuthAttempt; | ||
newAuthAttempt.finally(() => { | ||
try { | ||
state.currentAuthAttempt = newAuthAttempt; | ||
return await newAuthAttempt; | ||
} | ||
finally { | ||
if (state.currentAuthAttempt === newAuthAttempt) | ||
state.currentAuthAttempt = null; | ||
}); | ||
return newAuthAttempt; | ||
} | ||
} | ||
@@ -612,0 +622,0 @@ } |
@@ -16,3 +16,3 @@ { | ||
"homepage": "https://github.com/mongodb-js/oidc-plugin", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"repository": { | ||
@@ -56,3 +56,3 @@ "type": "git", | ||
"@microsoft/api-extractor": "^7.34.4", | ||
"@mongodb-js/mocha-config-compass": "^0.10.0", | ||
"@mongodb-js/mocha-config-compass": "^1.2.0", | ||
"@mongodb-js/oidc-mock-provider": "^0.3.0", | ||
@@ -59,0 +59,0 @@ "@mongodb-js/prettier-config-compass": "^0.5.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
159917
2191