@code-sentinel-cli/code-sentinel-cli 4.0.10 → 4.0.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.
Files changed (43) hide show
  1. package/dist/bin.js +958 -182
  2. package/dist/builtin-rules/static/flutter/android-cleartext-traffic.rule.js +1 -0
  3. package/dist/builtin-rules/static/flutter/android-debug-certificate-risk.rule.js +1 -0
  4. package/dist/builtin-rules/static/flutter/android-exported-component.rule.js +1 -0
  5. package/dist/builtin-rules/static/flutter/android-manifest-hardening.rule.js +1 -0
  6. package/dist/builtin-rules/static/flutter/android-minsdk-low.rule.js +1 -0
  7. package/dist/builtin-rules/static/flutter/android-release-debuggable.rule.js +1 -0
  8. package/dist/builtin-rules/static/flutter/android-sensitive-permissions.rule.js +1 -0
  9. package/dist/builtin-rules/static/flutter/bad-certificate-callback.rule.js +1 -0
  10. package/dist/builtin-rules/static/flutter/biometric-without-crypto-object.rule.js +1 -0
  11. package/dist/builtin-rules/static/flutter/cleartext-http-endpoint.rule.js +1 -0
  12. package/dist/builtin-rules/static/flutter/debug-tooling-release-risk.rule.js +12 -3
  13. package/dist/builtin-rules/static/flutter/device-fingerprint-collection.rule.js +1 -0
  14. package/dist/builtin-rules/static/flutter/dynamic-archive-risk.rule.js +1 -0
  15. package/dist/builtin-rules/static/flutter/exported-content-provider-leak.rule.js +1 -0
  16. package/dist/builtin-rules/static/flutter/hardcoded-crypto-key.rule.js +1 -0
  17. package/dist/builtin-rules/static/flutter/hardcoded-oauth-client-secret.rule.js +1 -0
  18. package/dist/builtin-rules/static/flutter/hive-sensitive-storage.rule.js +1 -0
  19. package/dist/builtin-rules/static/flutter/insecure-deep-link.rule.js +1 -0
  20. package/dist/builtin-rules/static/flutter/ios-ats-exception.rule.js +1 -0
  21. package/dist/builtin-rules/static/flutter/ios-pasteboard-leak.rule.js +1 -0
  22. package/dist/builtin-rules/static/flutter/ios-privacy-hardening.rule.js +1 -0
  23. package/dist/builtin-rules/static/flutter/missing-enforced-update.rule.js +1 -0
  24. package/dist/builtin-rules/static/flutter/oauth-missing-pkce.rule.js +1 -0
  25. package/dist/builtin-rules/static/flutter/packaged-env-risk.rule.js +1 -0
  26. package/dist/builtin-rules/static/flutter/sensitive-log-leak.rule.js +1 -0
  27. package/dist/builtin-rules/static/flutter/token-insecure-storage.rule.js +1 -0
  28. package/dist/builtin-rules/static/flutter/tracking-sdk-init.rule.js +1 -0
  29. package/dist/builtin-rules/static/flutter/weak-mobile-crypto-algorithm.rule.js +1 -0
  30. package/dist/builtin-rules/static/flutter/weak-prng-mobile.rule.js +1 -0
  31. package/dist/builtin-rules/static/flutter/webview-bridge-guard.rule.js +1 -0
  32. package/dist/builtin-rules/static/general/dockerfile-dependency-confusion.rule.js +5 -4
  33. package/dist/builtin-rules/static/general/dockerfile-no-root-user.rule.js +1 -0
  34. package/dist/builtin-rules/static/general/no-empty-encryption-key.rule.js +16 -1
  35. package/dist/builtin-rules/static/general/no-hardcoded-secret.rule.js +15 -8
  36. package/dist/builtin-rules/static/general/no-insecure-external-link.rule.js +1 -0
  37. package/dist/builtin-rules/static/general/no-insecure-password-submission.rule.js +34 -2
  38. package/dist/builtin-rules/static/general/sensitive-exception-response.rule.js +1 -0
  39. package/dist/builtin-rules/static/general/sensitive-output-exposure.rule.js +1 -0
  40. package/dist/builtin-rules/static/spring-boot/no-devtools-in-production.rule.js +1 -0
  41. package/dist/index.js +958 -182
  42. package/node_modules/@code-sentinel/parsers/index.js +28 -0
  43. package/package.json +1 -1
@@ -269,6 +269,20 @@ var isLoopback = (host) => {
269
269
  const h = host.toLowerCase();
270
270
  return h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h === "::1";
271
271
  };
272
+ var UNREFERENCABLE_BASE_IMAGE = /* @__PURE__ */ new Set(["scratch"]);
273
+ var baseImageReference = (instruction) => instruction.trim().replace(/^FROM\s+/i, "").split(/\s+/).find((w) => w.length > 0 && !w.startsWith("--")) ?? "";
274
+ var FLOATING_TAG_RE = /(?:^|\.)[xX*]$|^\*$/;
275
+ var unpinnedBaseImageReason = (reference) => {
276
+ const image = reference.trim();
277
+ if (!image || UNREFERENCABLE_BASE_IMAGE.has(image.toLowerCase())) return null;
278
+ if (image.includes("@")) return null;
279
+ const lastSlash = image.lastIndexOf("/");
280
+ const lastColon = image.lastIndexOf(":");
281
+ const hasTag = lastColon > lastSlash;
282
+ const tag = hasTag ? image.slice(lastColon + 1) : "";
283
+ if (hasTag && tag && tag !== "latest" && !FLOATING_TAG_RE.test(tag)) return null;
284
+ return hasTag && tag === "latest" ? `Base image \`${image}\` d\xF9ng tag \`latest\` \u2014 kh\xF4ng c\xF3 version r\xE0ng bu\u1ED9c, tag n\xE0y c\xF3 th\u1EC3 b\u1ECB \u0111\u1ED5i n\u1ED9i dung b\u1EA5t k\u1EF3 l\xFAc n\xE0o (CWE-427).` : `Base image \`${image}\` kh\xF4ng c\xF3 tag/digest \u2014 m\u1EB7c \u0111\u1ECBnh l\xE0 \`latest\`, ai \u0111\xF3 c\xF3 quy\u1EC1n \u0111\u1EA9y l\xEAn registry \u0111\u1EC1u thay \u0111\u01B0\u1EE3c image n\xE0y (CWE-427).`;
285
+ };
272
286
  var auditDockerfileDependencyConfusion = (content, filePath) => {
273
287
  const lines = content.split("\n");
274
288
  const hits = [];
@@ -302,6 +316,20 @@ var auditDockerfileDependencyConfusion = (content, filePath) => {
302
316
  line: i + 1,
303
317
  reason: "Dockerfile c\u1EA5u h\xECnh kho th\u01B0 vi\u1EC7n (registry) qua giao th\u1EE9c HTTP kh\xF4ng m\xE3 h\xF3a (cleartext) \u2014 CWE-319."
304
318
  });
319
+ continue;
320
+ }
321
+ if (/^FROM\s+\S/i.test(trimmed)) {
322
+ const reason = unpinnedBaseImageReason(baseImageReference(trimmed));
323
+ if (reason) {
324
+ hits.push({
325
+ file: filePath,
326
+ line: i + 1,
327
+ reason,
328
+ severity: "warning",
329
+ confidence: 75,
330
+ suggestion: "Ghim base image b\u1EB1ng digest b\u1EA5t bi\u1EBFn (`image@sha256:\u2026`) ho\u1EB7c \xEDt nh\u1EA5t m\u1ED9t tag c\u1EE5 th\u1EC3 kh\xF4ng ph\u1EA3i `latest`; v\u1EDBi registry n\u1ED9i b\u1ED9, b\u1EADt immutability/tag protection."
331
+ });
332
+ }
305
333
  }
306
334
  }
307
335
  return hits;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-sentinel-cli/code-sentinel-cli",
3
- "version": "4.0.10",
3
+ "version": "4.0.11",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "AI-assisted code review CLI for Angular, Spring Boot, and Flutter projects.",