nofax 0.2.9 → 0.2.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nofax",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "mcpName": "io.github.AKzar1el/nofax",
5
5
  "description": "Human-in-the-loop approvals and notifications for AI coding agents via CLI, MCP, and agent hooks.",
6
6
  "type": "module",
@@ -74,7 +74,7 @@ const LIST_PENDING_OUTPUT_SCHEMA = z.object({
74
74
 
75
75
  export function buildMcpServer({ handlers = createMcpToolHandlers() } = {}) {
76
76
  const server = new McpServer(
77
- { name: 'nofax', version: '0.2.9' },
77
+ { name: 'nofax', version: '0.2.10' },
78
78
  { instructions: SERVER_INSTRUCTIONS }
79
79
  );
80
80
 
package/src/protocol.mjs CHANGED
@@ -19,6 +19,54 @@ function isSecretKey(key) {
19
19
  return SECRET_KEY.test(normalizeSecretKeyName(key));
20
20
  }
21
21
 
22
+ function redactSecretText(value) {
23
+ let redacted = value;
24
+
25
+ redacted = redacted.replace(
26
+ /\b((?:proxy[-_])?authorization)(\s*[:=]\s*)(bearer|basic)(\s+)([^\s"'`,;&]+)/gi,
27
+ '$1$2$3$4[REDACTED]'
28
+ );
29
+
30
+ redacted = redacted.replace(
31
+ /([?&])([A-Za-z][A-Za-z0-9_-]{0,63})=([^&\s"'`,;]+)/g,
32
+ (match, prefix, key) => isSecretKey(key)
33
+ ? `${prefix}${key}=[REDACTED]`
34
+ : match
35
+ );
36
+
37
+ redacted = redacted.replace(
38
+ /(["'])([A-Za-z][A-Za-z0-9_-]{0,63})\1(\s*[:=]\s*)(["'])(.*?)\4/g,
39
+ (match, keyQuote, key, separator, valueQuote) => isSecretKey(key)
40
+ ? `${keyQuote}${key}${keyQuote}${separator}${valueQuote}[REDACTED]${valueQuote}`
41
+ : match
42
+ );
43
+
44
+ redacted = redacted.replace(
45
+ /([A-Za-z][A-Za-z0-9_-]{0,63})(\s*[:=]\s*)(["'])(.*?)\3/g,
46
+ (match, key, separator, valueQuote) => isSecretKey(key)
47
+ ? `${key}${separator}${valueQuote}[REDACTED]${valueQuote}`
48
+ : match
49
+ );
50
+
51
+ redacted = redacted.replace(
52
+ /([A-Za-z][A-Za-z0-9_-]{0,63})(\s*[:=]\s*)([^\s"'`,;&]+)/g,
53
+ (match, key, separator, rawValue) => {
54
+ if (!isSecretKey(key)) return match;
55
+ if (/authorization$/i.test(normalizeSecretKeyName(key)) && /^(?:bearer|basic)$/i.test(rawValue)) return match;
56
+ return `${key}${separator}[REDACTED]`;
57
+ }
58
+ );
59
+
60
+ redacted = redacted.replace(
61
+ /--([A-Za-z][A-Za-z0-9_-]{0,63})(\s+)(["'](?:.*?)["']|[^\s"'`,;&]+)/g,
62
+ (match, key, separator) => isSecretKey(key)
63
+ ? `--${key}${separator}[REDACTED]`
64
+ : match
65
+ );
66
+
67
+ return redacted;
68
+ }
69
+
22
70
  function randomBase64Url(bytes) {
23
71
  return randomBytes(bytes).toString('base64url');
24
72
  }
@@ -36,8 +84,9 @@ export function createPhoneTopic() {
36
84
  }
37
85
 
38
86
  function boundString(value) {
39
- if (value.length <= MAX_STRING) return value;
40
- return `${value.slice(0, MAX_STRING)}…[truncated]`;
87
+ const bounded = value.length <= MAX_STRING ? value : value.slice(0, MAX_STRING);
88
+ const redacted = redactSecretText(bounded);
89
+ return value.length <= MAX_STRING ? redacted : `${redacted}…[truncated]`;
41
90
  }
42
91
 
43
92
  export function redactAndBound(value, options = {}) {