mongodb-redact 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.esm-wrapper.mjs +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/redact-connection-string.d.ts +2 -0
- package/dist/redact-connection-string.d.ts.map +1 -0
- package/dist/redact-connection-string.js +8 -0
- package/dist/redact-connection-string.js.map +1 -0
- package/dist/regexes.d.ts +1 -1
- package/dist/regexes.d.ts.map +1 -1
- package/dist/regexes.js +1 -4
- package/dist/regexes.js.map +1 -1
- package/dist/secrets.d.ts.map +1 -1
- package/dist/secrets.js +2 -1
- package/dist/secrets.js.map +1 -1
- package/dist/should-redact-command.d.ts +2 -0
- package/dist/should-redact-command.d.ts.map +1 -0
- package/dist/should-redact-command.js +9 -0
- package/dist/should-redact-command.js.map +1 -0
- package/package.json +3 -2
package/dist/.esm-wrapper.mjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Secret } from './secrets';
|
|
2
2
|
export declare function redact<T>(message: T, secrets?: Secret[] | undefined): T;
|
|
3
|
+
export { shouldRedactCommand } from './should-redact-command';
|
|
4
|
+
export { redactConnectionString } from './redact-connection-string';
|
|
3
5
|
export default redact;
|
|
4
6
|
export type { Secret } from './secrets';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,wBAAgB,MAAM,CAAC,CAAC,EACtB,OAAO,EAAE,CAAC,EACV,OAAO,GAAE,MAAM,EAAE,GAAG,SAAqB,GACxC,CAAC,CAsCH;AAED,eAAe,MAAM,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,wBAAgB,MAAM,CAAC,CAAC,EACtB,OAAO,EAAE,CAAC,EACV,OAAO,GAAE,MAAM,EAAE,GAAG,SAAqB,GACxC,CAAC,CAsCH;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,eAAe,MAAM,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.redactConnectionString = exports.shouldRedactCommand = void 0;
|
|
3
4
|
exports.redact = redact;
|
|
4
5
|
const regexes_1 = require("./regexes");
|
|
5
6
|
const utils_1 = require("./utils");
|
|
@@ -26,5 +27,9 @@ function redact(message, secrets = undefined) {
|
|
|
26
27
|
}
|
|
27
28
|
return message;
|
|
28
29
|
}
|
|
30
|
+
var should_redact_command_1 = require("./should-redact-command");
|
|
31
|
+
Object.defineProperty(exports, "shouldRedactCommand", { enumerable: true, get: function () { return should_redact_command_1.shouldRedactCommand; } });
|
|
32
|
+
var redact_connection_string_1 = require("./redact-connection-string");
|
|
33
|
+
Object.defineProperty(exports, "redactConnectionString", { enumerable: true, get: function () { return redact_connection_string_1.redactConnectionString; } });
|
|
29
34
|
exports.default = redact;
|
|
30
35
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
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sB,OAAA;AAE/B,kBAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact-connection-string.d.ts","sourceRoot":"","sources":["../src/redact-connection-string.ts"],"names":[],"mappings":"AAEA,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.redactConnectionString = redactConnectionString;
|
|
4
|
+
const mongodb_connection_string_url_1 = require("mongodb-connection-string-url");
|
|
5
|
+
function redactConnectionString(uri) {
|
|
6
|
+
return (0, mongodb_connection_string_url_1.redactConnectionString)(uri);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=redact-connection-string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact-connection-string.js","sourceRoot":"","sources":["../src/redact-connection-string.ts"],"names":[],"mappings":";;AAEA,wDAEC;AAJD,iFAAqG;AAErG,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,IAAA,sDAA0B,EAAC,GAAG,CAAC,CAAC;AACzC,CAAC"}
|
package/dist/regexes.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const regexes: readonly [readonly [RegExp, "$1$2$4<base64>$5"], readonly [RegExp, "<certificate>"], readonly [RegExp, "<private key>"], readonly [RegExp, "$1$2/<user>/"], readonly [RegExp, "$1$2\\<user>\\"], readonly [RegExp, "$1<email>$6"], readonly [RegExp, "<
|
|
1
|
+
export declare const regexes: readonly [readonly [RegExp, "$1$2$4<base64>$5"], readonly [RegExp, "<certificate>"], readonly [RegExp, "<private key>"], readonly [RegExp, "$1$2/<user>/"], readonly [RegExp, "$1$2\\<user>\\"], readonly [RegExp, "$1<email>$6"], readonly [RegExp, "<mongodb uri>"], readonly [RegExp, "<ip address>"], readonly [RegExp, "<url>"], readonly [RegExp, "#schema/<namespace>"]];
|
|
2
2
|
//# sourceMappingURL=regexes.d.ts.map
|
package/dist/regexes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regexes.d.ts","sourceRoot":"","sources":["../src/regexes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"regexes.d.ts","sourceRoot":"","sources":["../src/regexes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,iXA8CV,CAAC"}
|
package/dist/regexes.js
CHANGED
|
@@ -23,6 +23,7 @@ exports.regexes = [
|
|
|
23
23
|
/(^|[ \t\r\n\v\f"'`])([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]{1,64}@[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(["'`]?)){1,500})/gim,
|
|
24
24
|
'$1<email>$6',
|
|
25
25
|
],
|
|
26
|
+
[/mongodb(?:\+srv)?:\/\/\S+/gim, '<mongodb uri>'],
|
|
26
27
|
[
|
|
27
28
|
/((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])/gm,
|
|
28
29
|
'<ip address>',
|
|
@@ -31,10 +32,6 @@ exports.regexes = [
|
|
|
31
32
|
/(http(s)?:\/\/)(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}(\.[a-z]{2,6})?\b([-a-zA-Z0-9@:%_+.~#?&/=]*)/gim,
|
|
32
33
|
'<url>',
|
|
33
34
|
],
|
|
34
|
-
[
|
|
35
|
-
/(mongodb:\/\/)(www\.)?[-a-zA-Z0-9@:%._+~#=,]{2,256}(\.[a-z]{2,6})?\b([-a-zA-Z0-9@:%_+.~#?&/=]*)/gim,
|
|
36
|
-
'<mongodb uri>',
|
|
37
|
-
],
|
|
38
35
|
[/#schema\/\w+\.\w+/, '#schema/<namespace>'],
|
|
39
36
|
];
|
|
40
37
|
//# sourceMappingURL=regexes.js.map
|
package/dist/regexes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regexes.js","sourceRoot":"","sources":["../src/regexes.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG;IACrB;QACE,4EAA4E;QAC5E,kBAAkB;KACnB;IAGD,CAAC,0DAA0D,EAAE,eAAe,CAAC;IAC7E;QACE,kEAAkE;QAClE,eAAe;KAChB;IAGD;QACE,uHAAuH;QACvH,cAAc;KACf;IACD;QACE,uHAAuH;QACvH,gBAAgB;KACjB;IAGD;QACE,0KAA0K;QAC1K,aAAa;KACd;IAGD;QACE,iFAAiF;QACjF,cAAc;KACf;IAGD;QACE,oGAAoG;QACpG,OAAO;KACR;IAGD
|
|
1
|
+
{"version":3,"file":"regexes.js","sourceRoot":"","sources":["../src/regexes.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG;IACrB;QACE,4EAA4E;QAC5E,kBAAkB;KACnB;IAGD,CAAC,0DAA0D,EAAE,eAAe,CAAC;IAC7E;QACE,kEAAkE;QAClE,eAAe;KAChB;IAGD;QACE,uHAAuH;QACvH,cAAc;KACf;IACD;QACE,uHAAuH;QACvH,gBAAgB;KACjB;IAGD;QACE,0KAA0K;QAC1K,aAAa;KACd;IAGD,CAAC,8BAA8B,EAAE,eAAe,CAAC;IAGjD;QACE,iFAAiF;QACjF,cAAc;KACf;IAGD;QACE,oGAAoG;QACpG,OAAO;KACR;IAGD,CAAC,mBAAmB,EAAE,qBAAqB,CAAC;CACpC,CAAC"}
|
package/dist/secrets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../src/secrets.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,6FASd,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,MAAM,EAAE,GAChB,CAAC,
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../src/secrets.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,6FASd,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,MAAM,EAAE,GAChB,CAAC,CAiBH"}
|
package/dist/secrets.js
CHANGED
|
@@ -22,7 +22,8 @@ function redactSecretsOnString(content, secrets) {
|
|
|
22
22
|
if (!exports.SECRET_KIND.includes(kind)) {
|
|
23
23
|
throw new Error(`Unknown secret kind ${kind}. Valid types: ${exports.SECRET_KIND.join(', ')}`);
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const escapedValue = (0, regexp_escape_1.default)(value);
|
|
26
|
+
const regex = new RegExp(`(?<!\\w)${escapedValue}(?!\\w)`, 'g');
|
|
26
27
|
result = result.replace(regex, `<${kind}>`);
|
|
27
28
|
}
|
|
28
29
|
return result;
|
package/dist/secrets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../src/secrets.ts"],"names":[],"mappings":";;;;;;AAsBA,
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../src/secrets.ts"],"names":[],"mappings":";;;;;;AAsBA,sDAoBC;AAxCD,kEAAmC;AAEtB,QAAA,WAAW,GAAG;IACzB,QAAQ;IACR,aAAa;IACb,MAAM;IACN,UAAU;IACV,OAAO;IACP,IAAI;IACJ,KAAK;IACL,aAAa;CACL,CAAC;AASX,SAAgB,qBAAqB,CACnC,OAAU,EACV,OAAiB;IAEjB,IAAI,MAAM,GAAG,OAAO,CAAC;IACrB,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,OAAO,EAAE,CAAC;QACtC,IAAI,CAAC,mBAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CACb,uBAAuB,IAAI,kBAAkB,mBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACtE,CAAC;QACJ,CAAC;QAID,MAAM,YAAY,GAAG,IAAA,uBAAM,EAAC,KAAK,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,WAAW,YAAY,SAAS,EAAE,GAAG,CAAC,CAAC;QAChE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,IAAI,GAAG,CAAM,CAAC;IACnD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"should-redact-command.d.ts","sourceRoot":"","sources":["../src/should-redact-command.ts"],"names":[],"mappings":"AAuBA,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAG1D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldRedactCommand = shouldRedactCommand;
|
|
4
|
+
const HIDDEN_COMMANDS = String.raw `\b(createUser|auth|updateUser|changeUserPassword|connect|Mongo)\b`;
|
|
5
|
+
function shouldRedactCommand(input) {
|
|
6
|
+
const hiddenCommands = new RegExp(HIDDEN_COMMANDS, 'g');
|
|
7
|
+
return hiddenCommands.test(input);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=should-redact-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"should-redact-command.js","sourceRoot":"","sources":["../src/should-redact-command.ts"],"names":[],"mappings":";;AAuBA,kDAGC;AApBD,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA,mEAAmE,CAAC;AAiBtG,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IACxD,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"email": "compass@mongodb.com"
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/mongodb-js/devtools-shared",
|
|
16
|
-
"version": "1.
|
|
16
|
+
"version": "1.3.0",
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
19
|
"url": "https://github.com/mongodb-js/devtools-shared.git"
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
"typescript": "^5.0.4"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
+
"mongodb-connection-string-url": "^3.0.1 || ^7.0.0",
|
|
74
75
|
"regexp.escape": "^2.0.1"
|
|
75
76
|
},
|
|
76
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "b029fbfa4ad92a2486a78c021ff33a66a274a77a"
|
|
77
78
|
}
|