Socket
Socket
Sign inDemoInstall

mongodb-connection-string-url

Package Overview
Dependencies
8
Maintainers
28
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.4.1 to 2.4.2

9

lib/index.js

@@ -8,3 +8,7 @@ "use strict";

const DUMMY_HOSTNAME = '__this_is_a_placeholder__';
const HOSTS_REGEX = new RegExp(String.raw `^(?<protocol>mongodb(?:\+srv|)):\/\/(?:(?<username>[^:]*)(?::(?<password>[^@]*))?@)?(?<hosts>(?!:)[^\/?@]+)(?<rest>.*)`);
function connectionStringHasValidScheme(connectionString) {
return (connectionString.startsWith('mongodb://') ||
connectionString.startsWith('mongodb+srv://'));
}
const HOSTS_REGEX = new RegExp(String.raw `^(?<protocol>mongodb(?:\+srv|)):\/\/(?:(?<username>[^:]*)(?::(?<password>[^@]*))?@)?(?<hosts>(?!:)[^\/?@]*)(?<rest>.*)`);
class CaseInsensitiveMap extends Map {

@@ -81,2 +85,5 @@ delete(name) {

var _a;
if (!connectionStringHasValidScheme(uri)) {
throw new MongoParseError('Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"');
}
const match = uri.match(HOSTS_REGEX);

@@ -83,0 +90,0 @@ if (!match) {

2

package.json
{
"name": "mongodb-connection-string-url",
"version": "2.4.1",
"version": "2.4.2",
"description": "MongoDB connection strings, based on the WhatWG URL API",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc