nofax 0.2.9 → 0.2.11

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.11",
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.11' },
78
78
  { instructions: SERVER_INSTRUCTIONS }
79
79
  );
80
80
 
package/src/protocol.mjs CHANGED
@@ -19,6 +19,74 @@ 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
+ /-----BEGIN ([A-Z0-9 ]*PRIVATE KEY(?: BLOCK)?)-----[\s\S]*?(?:-----END \1-----|$)/g,
27
+ (_match, label) => `-----BEGIN ${label}-----\n[REDACTED]\n-----END ${label}-----`
28
+ );
29
+
30
+ redacted = redacted.replace(
31
+ /\b([A-Za-z][A-Za-z0-9+.-]{1,31}:\/\/)([^\s\/@:]*):([^\s\/@]+)@/g,
32
+ '$1$2:[REDACTED]@'
33
+ );
34
+
35
+ redacted = redacted.replace(
36
+ /(^|[\r\n])([ \t]*)((?:proxy[-_])?authorization)(\s*:\s*)[^\r\n]*/gim,
37
+ '$1$2$3$4[REDACTED]'
38
+ );
39
+
40
+ redacted = redacted.replace(
41
+ /\b((?:proxy[-_])?authorization)(\s*[:=]\s*)(bearer|basic)(\s+)([^\s"'`,;&]+)/gi,
42
+ '$1$2$3$4[REDACTED]'
43
+ );
44
+
45
+ redacted = redacted.replace(
46
+ /\b(set-cookie|cookie)(\s*:\s*)[^\r\n]*/gi,
47
+ '$1$2[REDACTED]'
48
+ );
49
+
50
+ redacted = redacted.replace(
51
+ /([?&])([A-Za-z][A-Za-z0-9_-]{0,63})=([^&\s"'`,;]+)/g,
52
+ (match, prefix, key) => isSecretKey(key)
53
+ ? `${prefix}${key}=[REDACTED]`
54
+ : match
55
+ );
56
+
57
+ redacted = redacted.replace(
58
+ /(["'])([A-Za-z][A-Za-z0-9_-]{0,63})\1(\s*[:=]\s*)(["'])(.*?)\4/g,
59
+ (match, keyQuote, key, separator, valueQuote) => isSecretKey(key)
60
+ ? `${keyQuote}${key}${keyQuote}${separator}${valueQuote}[REDACTED]${valueQuote}`
61
+ : match
62
+ );
63
+
64
+ redacted = redacted.replace(
65
+ /([A-Za-z][A-Za-z0-9_-]{0,63})(\s*[:=]\s*)(["'])(.*?)\3/g,
66
+ (match, key, separator, valueQuote) => isSecretKey(key)
67
+ ? `${key}${separator}${valueQuote}[REDACTED]${valueQuote}`
68
+ : match
69
+ );
70
+
71
+ redacted = redacted.replace(
72
+ /([A-Za-z][A-Za-z0-9_-]{0,63})(\s*[:=]\s*)([^\s"'`,;&]+)/g,
73
+ (match, key, separator, rawValue) => {
74
+ if (!isSecretKey(key)) return match;
75
+ if (/authorization$/i.test(normalizeSecretKeyName(key)) && /^(?:bearer|basic)$/i.test(rawValue)) return match;
76
+ return `${key}${separator}[REDACTED]`;
77
+ }
78
+ );
79
+
80
+ redacted = redacted.replace(
81
+ /--([A-Za-z][A-Za-z0-9_-]{0,63})(\s+)(["'](?:.*?)["']|[^\s"'`,;&]+)/g,
82
+ (match, key, separator) => isSecretKey(key)
83
+ ? `--${key}${separator}[REDACTED]`
84
+ : match
85
+ );
86
+
87
+ return redacted;
88
+ }
89
+
22
90
  function randomBase64Url(bytes) {
23
91
  return randomBytes(bytes).toString('base64url');
24
92
  }
@@ -36,8 +104,9 @@ export function createPhoneTopic() {
36
104
  }
37
105
 
38
106
  function boundString(value) {
39
- if (value.length <= MAX_STRING) return value;
40
- return `${value.slice(0, MAX_STRING)}…[truncated]`;
107
+ const redacted = redactSecretText(value);
108
+ const bounded = redacted.length <= MAX_STRING ? redacted : redacted.slice(0, MAX_STRING);
109
+ return value.length <= MAX_STRING ? bounded : `${bounded}…[truncated]`;
41
110
  }
42
111
 
43
112
  export function redactAndBound(value, options = {}) {