@synopackageland/cli 0.53.3 → 0.53.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.53.4 (2026-11-10)
4
+
5
+ - Recognize ELF, Mach-O and PE content in public UI scans, so compiled CGI string pools do not trigger source-syntax `credential-literal` false positives. Text-file rules stay unchanged; executable content still fails private-key, known token, environment-file and source-map checks. Known token signatures in executables no longer require word boundaries between pooled constants.
6
+
3
7
  ## 0.53.3 (2026-11-10)
4
8
 
5
9
  - Accept exact released Portal ingress resource contracts when inspecting an approval baseline, including daemon and identity gateway SPKs built before their Portal `www` registration was introduced. Current SPKs still require the current resource contract; extra workers, duplicate registrations, changed file paths and invalid payload or executor pins still fail inspection.
package/README.md CHANGED
@@ -706,6 +706,11 @@ For same-origin App URLs, see [DSM path ingress](docs/path-ingress.md).
706
706
 
707
707
  ### CLI release checks
708
708
 
709
+ Public UI scans distinguish ELF, Mach-O and PE content from text, including
710
+ compiled CGI files. Executables retain private-key and known token checks;
711
+ source-syntax credential checks apply to text. See the
712
+ [public UI scan policy](docs/release-checks.md#public-ui-scans) for coverage and limits.
713
+
709
714
  `pnpm run gates` runs basic checks and is the default for release packaging and CI.
710
715
  Use `pnpm run gates:full` only when explicitly requested. See
711
716
  [release entry points and checks](docs/release-checks.md) for the complete inventory.
@@ -49,7 +49,7 @@ async function scanPayload(payloadPath, wanted, findings) {
49
49
  chunks.push(chunk);
50
50
  });
51
51
  entry.on("end", () => { if (keep)
52
- file.text = Buffer.concat(chunks).toString("utf8"); });
52
+ file.content = Buffer.concat(chunks); });
53
53
  files.push(file);
54
54
  },
55
55
  });
@@ -84,9 +84,9 @@ function checkEntryPath(path, type, linkpath, findings) {
84
84
  function ownSections(files) {
85
85
  const sections = new Set();
86
86
  for (const file of files) {
87
- if (!/(^|\/)texts\/[^/]+\/strings$/.test(file.path) || file.text === undefined)
87
+ if (!/(^|\/)texts\/[^/]+\/strings$/.test(file.path) || file.content === undefined)
88
88
  continue;
89
- for (const match of file.text.matchAll(/^\s*\[([^\]]+)\]\s*$/gm))
89
+ for (const match of file.content.toString("utf8").matchAll(/^\s*\[([^\]]+)\]\s*$/gm))
90
90
  sections.add(match[1]);
91
91
  }
92
92
  return sections;
@@ -99,7 +99,7 @@ function ownSections(files) {
99
99
  function checkUiConfig(file, sections, findings) {
100
100
  let config;
101
101
  try {
102
- config = JSON.parse(file.text ?? "");
102
+ config = JSON.parse(file.content?.toString("utf8") ?? "");
103
103
  }
104
104
  catch { /* reported below */ }
105
105
  if (typeof config !== "object" || config === null || Array.isArray(config)) {
@@ -165,16 +165,16 @@ export async function checkPayload(payloadPath, info, findings, policy = {}) {
165
165
  checkElf(files, info.arch, findings);
166
166
  const ui = files.filter(file => file.path.startsWith("ui/"));
167
167
  for (const file of ui) {
168
- if (file.text === undefined) {
168
+ if (file.content === undefined) {
169
169
  findings.add("SPK_UI_UNSAFE", "Public UI file exceeds the 64 MiB scan limit.", at(file.path));
170
170
  continue;
171
171
  }
172
- const problems = applyUiIgnores(uiFileProblems(file.path.slice(3), file.text), policy.ignores ?? [], policy.moduleVersion);
172
+ const problems = applyUiIgnores(uiFileProblems(file.path.slice(3), file.content), policy.ignores ?? [], policy.moduleVersion);
173
173
  for (const problem of problems) {
174
174
  if (policy.sourceMaps === false && ["source-map-file", "sourceMappingURL"].includes(problem.pattern))
175
175
  continue;
176
176
  findings.add(problem.ignored ? "SPK_UI_SECRET_IGNORED" : "SPK_UI_UNSAFE", `Public UI pattern: ${problem.pattern}${problem.ignored ? `; reason: ${problem.ignored}` : "; remove it before packaging"}.`, at(file.path));
177
177
  }
178
178
  }
179
- return publicUiReport(ui.filter(file => file.text !== undefined).map(file => ({ file: file.path, content: file.text })));
179
+ return publicUiReport(ui.filter(file => file.content !== undefined).map(file => ({ file: file.path, content: file.content.toString("utf8") })));
180
180
  }
@@ -22,7 +22,7 @@ export declare function minifyUi(content: string, file: string): string;
22
22
  export declare function uiFiles(root: string): string[];
23
23
  /** Run before computing content addresses or mobile asset inventories. */
24
24
  export declare function minifyUiTree(root: string, skip?: string[]): void;
25
- export declare function uiFileProblems(file: string, content: string): UiProblem[];
25
+ export declare function uiFileProblems(file: string, input: string | Buffer): UiProblem[];
26
26
  export declare function logicalUiFile(file: string, moduleVersion?: string): string;
27
27
  export declare function applyUiIgnores(problems: UiProblem[], ignores: UiSecretIgnore[], moduleVersion?: string): UiProblem[];
28
28
  export declare function scanUiTree(root: string, ignores?: UiSecretIgnore[], moduleVersion?: string): UiProblem[];
@@ -78,6 +78,25 @@ const SECRET_PATTERNS = [
78
78
  ["aws-access-key", /\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/],
79
79
  ["aws-secret-key", /(?:["']?aws_secret_access_key["']?)\s*[:=]\s*["']?[A-Za-z0-9/+=]{40}(?![A-Za-z0-9/+=])/i],
80
80
  ];
81
+ // Linker string pools need not put word boundaries between constants. Keep the
82
+ // known token signatures/lengths, but do not require text word boundaries there.
83
+ const BINARY_SECRET_PATTERNS = SECRET_PATTERNS.map(([name, pattern]) => [name, new RegExp(pattern.source.replaceAll("\\b", ""), pattern.flags)]);
84
+ const MACH_O_MAGICS = new Set([
85
+ 0xfeedface, 0xcefaedfe, 0xfeedfacf, 0xcffaedfe,
86
+ 0xcafebabe, 0xbebafeca, 0xcafebabf, 0xbfbafeca,
87
+ ]);
88
+ /** Content-based format detection, independent of filename or executable mode. */
89
+ function isExecutable(bytes) {
90
+ if (bytes.length < 4)
91
+ return false;
92
+ const magic = bytes.readUInt32BE(0);
93
+ if (magic === 0x7f454c46 || MACH_O_MAGICS.has(magic))
94
+ return true;
95
+ if (bytes.length < 64 || bytes[0] !== 0x4d || bytes[1] !== 0x5a)
96
+ return false;
97
+ const pe = bytes.readUInt32LE(60);
98
+ return pe >= 64 && pe <= bytes.length - 4 && bytes.readUInt32LE(pe) === 0x00004550;
99
+ }
81
100
  // Common field captions are public text, not embedded credential defaults.
82
101
  // Only object captions are recognized; password="Password" still fails.
83
102
  const PASSWORD_CAPTIONS = new Set([
@@ -98,7 +117,9 @@ function credentialLiteral(content) {
98
117
  }
99
118
  return /(?:^|[^\w$"'`])(?:password|secret)\s*=\s*(?:"[^"\r\n]+"|'[^'\r\n]+'|`[^`$\r\n]+`|\d+(?:\.\d+)?\b)|["'`](?:password|secret)=[^"'`\s]+/i.test(content);
100
119
  }
101
- export function uiFileProblems(file, content) {
120
+ export function uiFileProblems(file, input) {
121
+ const executable = Buffer.isBuffer(input) && isExecutable(input);
122
+ const content = typeof input === "string" ? input : input.toString(executable ? "latin1" : "utf8");
102
123
  const found = [];
103
124
  const name = basename(file).toLowerCase();
104
125
  if (name === ".env" || name.startsWith(".env."))
@@ -107,13 +128,14 @@ export function uiFileProblems(file, content) {
107
128
  found.push({ file, pattern: "source-map-file" });
108
129
  if (SOURCE_MAP_COMMENT.test(content))
109
130
  found.push({ file, pattern: "sourceMappingURL" });
110
- for (const [pattern, match] of SECRET_PATTERNS)
131
+ for (const [pattern, match] of executable ? BINARY_SECRET_PATTERNS : SECRET_PATTERNS)
111
132
  if (match.test(content))
112
133
  found.push({ file, pattern });
113
- if (credentialLiteral(content))
134
+ // Source syntax has no reliable meaning in machine code or pooled constants.
135
+ if (!executable && credentialLiteral(content))
114
136
  found.push({ file, pattern: "credential-literal" });
115
137
  // Unquoted values in environment/config/HTML text; JS variable assignments are not literals.
116
- if (!isUiBundle(file) && /(?:^|[^\w$])(?:password|secret)\s*=\s*[^\s"'`<>{};,]+/i.test(content))
138
+ if (!executable && !isUiBundle(file) && /(?:^|[^\w$])(?:password|secret)\s*=\s*[^\s"'`<>{};,]+/i.test(content))
117
139
  if (!found.some(item => item.pattern === "credential-literal"))
118
140
  found.push({ file, pattern: "credential-literal" });
119
141
  return found;
@@ -131,7 +153,7 @@ export function applyUiIgnores(problems, ignores, moduleVersion) {
131
153
  });
132
154
  }
133
155
  export function scanUiTree(root, ignores = [], moduleVersion) {
134
- const problems = uiFiles(root).flatMap(file => uiFileProblems(file, readFileSync(join(root, file), "utf8")));
156
+ const problems = uiFiles(root).flatMap(file => uiFileProblems(file, readFileSync(join(root, file))));
135
157
  return applyUiIgnores(problems, ignores, moduleVersion);
136
158
  }
137
159
  export function enforcePublicUi(root, ignores = [], moduleVersion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.53.3",
3
+ "version": "0.53.4",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {