Skip to content

Commit 676ca27

Browse files
committed
chore: validate apiBaseUrl
1 parent 430f427 commit 676ca27

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/server.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,13 @@ export class Server {
239239
// Validate API client credentials
240240
if (this.userConfig.apiClientId && this.userConfig.apiClientSecret) {
241241
try {
242+
if (!this.userConfig.apiBaseUrl.startsWith("https://")) {
243+
const message =
244+
"Failed to validate MongoDB Atlas the credentials from the config: API URL must be HTTPS";
245+
console.error(message);
246+
throw new Error(message);
247+
}
248+
242249
await this.session.apiClient.validateAccessToken();
243250
} catch (error) {
244251
if (this.userConfig.connectionString === undefined) {

0 commit comments

Comments
 (0)