@softeria/ms-365-mcp-server 0.166.0 → 0.166.1
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/lib/log-redactor.js +23 -6
- package/package.json +1 -1
package/dist/lib/log-redactor.js
CHANGED
|
@@ -22,13 +22,30 @@ const REDACTIONS = [
|
|
|
22
22
|
{
|
|
23
23
|
pattern: /([?&]code=)[^&\s"']+/gi,
|
|
24
24
|
replacement: "$1[REDACTED]"
|
|
25
|
-
},
|
|
26
|
-
// Email addresses / UPNs
|
|
27
|
-
{
|
|
28
|
-
pattern: /[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,
|
|
29
|
-
replacement: "[REDACTED_EMAIL]"
|
|
30
25
|
}
|
|
31
26
|
];
|
|
27
|
+
const EMAIL_LOCAL_CHAR = /[A-Za-z0-9._%+-]/;
|
|
28
|
+
const EMAIL_DOMAIN = /[A-Za-z0-9.-]+\.[A-Za-z]{2,}/y;
|
|
29
|
+
function redactEmails(input) {
|
|
30
|
+
let at = input.indexOf("@");
|
|
31
|
+
if (at === -1) return input;
|
|
32
|
+
let out = "";
|
|
33
|
+
let copied = 0;
|
|
34
|
+
while (at !== -1) {
|
|
35
|
+
let start = at;
|
|
36
|
+
while (start > copied && EMAIL_LOCAL_CHAR.test(input[start - 1])) start--;
|
|
37
|
+
EMAIL_DOMAIN.lastIndex = at + 1;
|
|
38
|
+
const domain = start < at ? EMAIL_DOMAIN.exec(input) : null;
|
|
39
|
+
if (domain) {
|
|
40
|
+
out += input.slice(copied, start) + "[REDACTED_EMAIL]";
|
|
41
|
+
copied = at + 1 + domain[0].length;
|
|
42
|
+
at = input.indexOf("@", copied);
|
|
43
|
+
} else {
|
|
44
|
+
at = input.indexOf("@", at + 1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return out + input.slice(copied);
|
|
48
|
+
}
|
|
32
49
|
function redactionEnabled() {
|
|
33
50
|
const raw = process.env.MS365_MCP_REDACT_PII;
|
|
34
51
|
if (raw === void 0) return true;
|
|
@@ -39,7 +56,7 @@ function redactSensitive(input) {
|
|
|
39
56
|
for (const { pattern, replacement } of REDACTIONS) {
|
|
40
57
|
out = out.replace(pattern, replacement);
|
|
41
58
|
}
|
|
42
|
-
return out;
|
|
59
|
+
return redactEmails(out);
|
|
43
60
|
}
|
|
44
61
|
export {
|
|
45
62
|
redactSensitive,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softeria/ms-365-mcp-server",
|
|
3
3
|
"mcpName": "io.github.Softeria/ms-365-mcp-server",
|
|
4
|
-
"version": "0.166.
|
|
4
|
+
"version": "0.166.1",
|
|
5
5
|
"description": " A Model Context Protocol (MCP) server for interacting with Microsoft 365 and Office services through the Graph API",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|