@jurislm/coolify-plugin 4.0.27 → 4.0.29

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coolify-plugin",
3
- "version": "4.0.27",
3
+ "version": "4.0.29",
4
4
  "description": "Fallback Codex metadata for local stdio Coolify tools.",
5
5
  "author": {
6
6
  "name": "JurisLM",
package/dist/client.js CHANGED
@@ -1,6 +1,145 @@
1
+ import { isAlias, isScalar, parseDocument, stringify, visit } from "yaml";
1
2
  import { CoolifyApiError, redactErrorText } from "./errors.js";
2
3
  const sensitiveKey = /(^value$|real_?value|private_?key|api_?key|user_?key|webhook_?url|token|secret|password|authorization|cookie)/iu;
4
+ const composeKey = /^(docker_compose(_pr)?(_raw)?|configuration)$/u;
5
+ const composeSecretName = /(password|passwd|secret|token|private|credential|api_?key|access_?key|root_?user|authorization|cookie)/iu;
6
+ const composeSecretSegment = /(^|[_.-])(key|pass|pwd|auth)($|[_.-])/iu;
7
+ const interpolation = /^\$\{?[A-Za-z_][A-Za-z0-9_]*\}?$/u;
8
+ const urlCredential = /([a-z][a-z0-9+.-]{0,31}:\/\/[^\s:/@]{0,256}):([^\s/?#]{1,256})@/giu;
9
+ const queryParameter = /([?&])([^=&#?\s"']{1,64})=([^&#\s"']+)/gu;
10
+ const querySecretSegments = new Set(["password", "passwd", "pass", "pwd", "secret", "token", "auth", "sig", "signature", "credential", "credentials", "apikey", "key"]);
11
+ const querySecretName = /(password|passwd|secret|token|api_?key|access_?key)/iu;
12
+ const flagValue = /^(true|false|yes|no|on|off|enabled|disabled|none)$/iu;
13
+ const assignment = /^([\w.-]+)=([\s\S]*)$/u;
14
+ const base64Text = /^[A-Za-z0-9+/]+={0,2}$/u;
15
+ function isComposeSecret(name, value) {
16
+ if (!composeSecretName.test(name) && !composeSecretSegment.test(name))
17
+ return false;
18
+ const text = typeof value === "string" ? value : typeof value === "number" ? String(value) : "";
19
+ return text.trim() !== "" && !interpolation.test(text) && !flagValue.test(text.trim());
20
+ }
21
+ function redactUrlCredentials(text) {
22
+ return text
23
+ .replace(urlCredential, (match, prefix, password) => interpolation.test(password) ? match : `${prefix}:[REDACTED]@`)
24
+ .replace(queryParameter, (match, separator, name, value) => value !== "[REDACTED]" && isQuerySecret(name) ? `${separator}${name}=[REDACTED]` : match);
25
+ }
26
+ function isQuerySecret(name) {
27
+ return querySecretName.test(name) || name.toLowerCase().split(/[_.-]/u).some((segment) => querySecretSegments.has(segment));
28
+ }
29
+ const commandKey = /^(command|entrypoint|test)$/u;
30
+ const secretFlagName = /(requirepass|masterauth)/iu;
31
+ const portValue = /^[\d.:[\]]+(\/(tcp|udp|sctp))?$/iu;
32
+ const envOption = /(^|\s)(-e|--env)(=|\s+)(?:"([A-Za-z_][\w.]{0,127})=([^"\n]{0,4096})"|'([A-Za-z_][\w.]{0,127})=([^'\n]{0,4096})'|([A-Za-z_][\w.]{0,127})=("[^"\n]{0,4096}"|'[^'\n]{0,4096}'|[^\s"']*))/gu;
33
+ const flagEquals = /(^|\s)(--?[A-Za-z][\w-]{0,63})=("[^"\n]{0,4096}"|'[^'\n]{0,4096}'|[^\s"']+)/gu;
34
+ const flagSpace = /(^|\s)(--?[A-Za-z][\w-]{0,63})(\s+)("[^"\n]{0,4096}"|'[^'\n]{0,4096}'|[^\s"'-][^\s"']*)/gu;
35
+ function unquote(value) {
36
+ return value.replace(/^(["'])([\s\S]*)\1$/u, "$2");
37
+ }
38
+ function quoteOf(value) {
39
+ return value.startsWith("\"") || value.startsWith("'") ? value[0] : "";
40
+ }
41
+ function isSecretFlag(flag) {
42
+ if (flag === "-p")
43
+ return true;
44
+ if (!flag.startsWith("--"))
45
+ return false;
46
+ const name = flag.slice(2).replace(/-/gu, "_");
47
+ return composeSecretName.test(name) || composeSecretSegment.test(name) || secretFlagName.test(name);
48
+ }
49
+ function isSecretFlagValue(flag, value) {
50
+ const bare = unquote(value);
51
+ if (bare === "" || bare === "[REDACTED]" || interpolation.test(bare) || flagValue.test(bare))
52
+ return false;
53
+ return flag !== "-p" || !portValue.test(bare);
54
+ }
55
+ function redactCommandLine(text) {
56
+ return text
57
+ .replace(envOption, (match, lead, flag, separator, doubleKey, _doubleValue, singleKey, _singleValue, key, value) => {
58
+ if (doubleKey !== undefined)
59
+ return isComposeSecret(doubleKey, _doubleValue) ? `${lead}${flag}${separator}"${doubleKey}=[REDACTED]"` : match;
60
+ if (singleKey !== undefined)
61
+ return isComposeSecret(singleKey, _singleValue) ? `${lead}${flag}${separator}'${singleKey}=[REDACTED]'` : match;
62
+ if (key === undefined || value === undefined)
63
+ return match;
64
+ const quote = quoteOf(value);
65
+ return isComposeSecret(key, unquote(value)) ? `${lead}${flag}${separator}${key}=${quote}[REDACTED]${quote}` : match;
66
+ })
67
+ .replace(flagEquals, (match, lead, flag, value) => isSecretFlag(flag) && isSecretFlagValue(flag, value) ? `${lead}${flag}=${quoteOf(value)}[REDACTED]${quoteOf(value)}` : match)
68
+ .replace(flagSpace, (match, lead, flag, space, value) => isSecretFlag(flag) && isSecretFlagValue(flag, value) ? `${lead}${flag}${space}${quoteOf(value)}[REDACTED]${quoteOf(value)}` : match);
69
+ }
70
+ function redactCommand(value) {
71
+ if (typeof value === "string")
72
+ return redactCommandLine(value);
73
+ if (!Array.isArray(value))
74
+ return value;
75
+ return value.map((token, index) => {
76
+ if (typeof token !== "string")
77
+ return token;
78
+ const flag = value[index - 1];
79
+ return typeof flag === "string" && !flag.includes("=") && isSecretFlag(flag) && isSecretFlagValue(flag, token) ? "[REDACTED]" : redactCommandLine(token);
80
+ });
81
+ }
82
+ const composeAliasLimit = 100;
83
+ function redactComposeValue(value) {
84
+ if (Array.isArray(value))
85
+ return value.map(redactComposeValue);
86
+ if (value && typeof value === "object") {
87
+ return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, isComposeSecret(key, child) ? "[REDACTED]" : redactComposeValue(commandKey.test(key) ? redactCommand(child) : child)]));
88
+ }
89
+ if (typeof value !== "string")
90
+ return value;
91
+ const match = assignment.exec(value);
92
+ return match && isComposeSecret(match[1], match[2]) ? `${match[1]}=[REDACTED]` : redactUrlCredentials(value);
93
+ }
94
+ function redactComposeYaml(text) {
95
+ if (text.trim() === "" || text === "[REDACTED]")
96
+ return text;
97
+ const document = parseDocument(text, { schema: "failsafe", merge: true });
98
+ if (document.errors.length > 0)
99
+ return "[REDACTED]";
100
+ let parsed;
101
+ let rendered;
102
+ try {
103
+ const secrets = [];
104
+ visit(document, {
105
+ Pair(_key, pair) {
106
+ const key = isAlias(pair.key) ? pair.key.resolve(document) : pair.key;
107
+ const value = isAlias(pair.value) ? pair.value.resolve(document) : pair.value;
108
+ if (isScalar(key) && isScalar(value) && isComposeSecret(String(key.value), value.value))
109
+ secrets.push(value);
110
+ },
111
+ });
112
+ for (const node of secrets)
113
+ node.value = "[REDACTED]";
114
+ parsed = document.toJS({ maxAliasCount: composeAliasLimit });
115
+ rendered = stringify(redactComposeValue(parsed), { lineWidth: 0 });
116
+ }
117
+ catch {
118
+ return "[REDACTED]";
119
+ }
120
+ return text.endsWith("\n") ? rendered : rendered.replace(/\n$/u, "");
121
+ }
122
+ function decodeBase64Text(text) {
123
+ if (text.length % 4 !== 0 || !base64Text.test(text))
124
+ return undefined;
125
+ const bytes = Buffer.from(text, "base64");
126
+ if (bytes.toString("base64") !== text)
127
+ return undefined;
128
+ try {
129
+ const decoded = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
130
+ return /[\n:]/u.test(decoded) ? decoded : undefined;
131
+ }
132
+ catch {
133
+ return undefined;
134
+ }
135
+ }
136
+ function redactComposeText(text) {
137
+ const decoded = decodeBase64Text(text);
138
+ return decoded === undefined ? redactComposeYaml(text) : Buffer.from(redactComposeYaml(decoded), "utf8").toString("base64");
139
+ }
3
140
  export function redactSensitive(value) {
141
+ if (typeof value === "string")
142
+ return redactUrlCredentials(value);
4
143
  if (Array.isArray(value))
5
144
  return value.map(redactSensitive);
6
145
  if (!value || typeof value !== "object")
@@ -8,7 +147,7 @@ export function redactSensitive(value) {
8
147
  const binary = value.encoding === "base64" && typeof value.contentType === "string" && typeof value.value === "string";
9
148
  return Object.fromEntries(Object.entries(value).map(([key, child]) => [
10
149
  key,
11
- sensitiveKey.test(key) && !(binary && key === "value") ? "[REDACTED]" : redactSensitive(child),
150
+ sensitiveKey.test(key) && !(binary && key === "value") ? "[REDACTED]" : composeKey.test(key) && typeof child === "string" ? redactComposeText(child) : key === "custom_docker_run_options" && typeof child === "string" ? redactUrlCredentials(redactCommandLine(child)) : redactSensitive(child),
12
151
  ]));
13
152
  }
14
153
  function pathValue(value, name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jurislm/coolify-plugin",
3
- "version": "4.0.27",
3
+ "version": "4.0.29",
4
4
  "description": "Portable local stdio MCP plugin for Coolify",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -47,6 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@modelcontextprotocol/sdk": "1.30.0",
50
+ "yaml": "2.9.1",
50
51
  "zod": "4.6.5"
51
52
  },
52
53
  "devDependencies": {
@@ -57,8 +58,7 @@
57
58
  "json-schema-to-zod": "2.8.1",
58
59
  "openapi-typescript": "7.13.0",
59
60
  "typescript": "5.9.3",
60
- "typescript-eslint": "8.70.1",
61
- "yaml": "2.9.1"
61
+ "typescript-eslint": "8.70.1"
62
62
  },
63
63
  "packageManager": "bun@1.3.14"
64
64
  }
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "coolify-plugin",
4
- "version": "4.0.27",
4
+ "version": "4.0.29",
5
5
  "description": "Portable Coolify MCP plugin with local stdio tools generated from the official OpenAPI contract.",
6
6
  "author": {
7
7
  "name": "JurisLM",