@agenticcli/shipguard 0.5.0 → 0.6.0

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.
@@ -1390,8 +1390,10 @@ function evaluatePattern(matcher, file, ctx) {
1390
1390
  let re;
1391
1391
  try {
1392
1392
  re = new RegExp(patternStr, internalFlagsStr);
1393
- } catch {
1394
- continue;
1393
+ } catch (err) {
1394
+ const detail = err instanceof Error ? err.message : String(err);
1395
+ console.error(`[native-v1] compile error for pattern ${JSON.stringify(patternStr)}: ${detail}`);
1396
+ throw new Error(`[native-v1] pattern compile failure for ${JSON.stringify(patternStr)} \u2014 bundle degraded (fail-closed): ${detail}`);
1395
1397
  }
1396
1398
  let match;
1397
1399
  while ((match = re.exec(file.content)) !== null) {
@@ -1420,8 +1422,10 @@ function evaluatePattern(matcher, file, ctx) {
1420
1422
  let antiRe;
1421
1423
  try {
1422
1424
  antiRe = new RegExp(antiStr, [...flagsResult.flags].join(""));
1423
- } catch {
1424
- continue;
1425
+ } catch (err) {
1426
+ const detail = err instanceof Error ? err.message : String(err);
1427
+ console.error(`[native-v1] compile error for anti-pattern ${JSON.stringify(antiStr)}: ${detail}`);
1428
+ throw new Error(`[native-v1] anti-pattern compile failure for ${JSON.stringify(antiStr)} \u2014 the rule would run without its guard (fail-closed): ${detail}`);
1425
1429
  }
1426
1430
  if (antiRe.test(windowText)) {
1427
1431
  suppressionState = "suppressed";
@@ -1708,6 +1712,19 @@ function globToRegExp2(glob) {
1708
1712
  regexStr += "$";
1709
1713
  return new RegExp(regexStr);
1710
1714
  }
1715
+ var COMPILE_CACHE_MAX = 2e4;
1716
+ var compileCache = /* @__PURE__ */ new Map();
1717
+ function compileCached(pattern, flags) {
1718
+ const key = `${flags}\0${pattern}`;
1719
+ const hit = compileCache.get(key);
1720
+ if (hit !== void 0)
1721
+ return hit;
1722
+ const compiled = RE2JS.compile(pattern, flags);
1723
+ if (compileCache.size >= COMPILE_CACHE_MAX)
1724
+ compileCache.clear();
1725
+ compileCache.set(key, compiled);
1726
+ return compiled;
1727
+ }
1711
1728
  function evaluatePattern2(matcher, file, ctx) {
1712
1729
  const flagsResult = parseFlags(matcher.flags);
1713
1730
  if (!flagsResult.ok) {
@@ -1720,7 +1737,7 @@ function evaluatePattern2(matcher, file, ctx) {
1720
1737
  const compiledAntiPatterns = [];
1721
1738
  for (const antiStr of matcher.antiPatterns) {
1722
1739
  try {
1723
- compiledAntiPatterns.push(RE2JS.compile(antiStr, re2jsFlags));
1740
+ compiledAntiPatterns.push(compileCached(antiStr, re2jsFlags));
1724
1741
  } catch (err) {
1725
1742
  console.error(`[re2js-v1] compile error for anti-pattern ${JSON.stringify(antiStr)}: ${err instanceof Error ? err.message : String(err)}`);
1726
1743
  throw new Error(`[re2js-v1] anti-pattern compile failure for ${JSON.stringify(antiStr)} \u2014 bundle degraded (fail-closed, FIX 5): ${err instanceof Error ? err.message : String(err)}`);
@@ -1729,7 +1746,7 @@ function evaluatePattern2(matcher, file, ctx) {
1729
1746
  for (const patternStr of matcher.patterns) {
1730
1747
  let compiled;
1731
1748
  try {
1732
- compiled = RE2JS.compile(patternStr, re2jsFlags);
1749
+ compiled = compileCached(patternStr, re2jsFlags);
1733
1750
  } catch (err) {
1734
1751
  console.error(`[re2js-v1] compile error for pattern ${JSON.stringify(patternStr)}: ${err instanceof Error ? err.message : String(err)}`);
1735
1752
  throw new Error(`[re2js-v1] primary pattern compile failure for ${JSON.stringify(patternStr)} \u2014 bundle degraded (fail-closed, FIX 5): ${err instanceof Error ? err.message : String(err)}`);
@@ -1863,7 +1880,7 @@ function evaluateFileRelationship2(matcher, file, ctx) {
1863
1880
  }
1864
1881
  let requiresCompiled;
1865
1882
  try {
1866
- requiresCompiled = RE2JS.compile(requiresPattern);
1883
+ requiresCompiled = compileCached(requiresPattern, 0);
1867
1884
  } catch {
1868
1885
  console.error(`[re2js-v1] requiresPattern compile error for ${JSON.stringify(requiresPattern)} \u2014 fail closed`);
1869
1886
  return [
@@ -2015,6 +2032,7 @@ export {
2015
2032
  nativeV1Executor,
2016
2033
  NATIVE_V1_ADAPTER_IMPL_HASH,
2017
2034
  NATIVE_V1_RUNTIME_ID,
2035
+ compileCached,
2018
2036
  re2jsV1Executor,
2019
2037
  re2jsTestPattern,
2020
2038
  RE2JS_V1_ADAPTER_IMPL_HASH,
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.5.0",
2
+ "version": "0.6.0",
3
3
  "packageName": "@agenticcli/shipguard",
4
4
  "license": "Elastic-2.0",
5
5
  "licenseDisplay": "ELv2",
@@ -19,9 +19,7 @@
19
19
  ],
20
20
  "freeRuleIds": [
21
21
  "hardcoded_secret",
22
- "secrets",
23
22
  "exposed_env",
24
- "auth",
25
23
  "public_admin_route",
26
24
  "auth_route_without_guard",
27
25
  "db-drop-table",
@@ -32,13 +30,10 @@
32
30
  "pkg-json-unparseable-database",
33
31
  "db-push-in-scripts",
34
32
  "db-schema-without-migration",
35
- "database",
36
- "payments",
37
33
  "payment_webhook_without_signature_check",
38
34
  "missing_idempotency",
39
35
  "missing_error_handling",
40
36
  "pkg-json-unparseable-deployment",
41
- "deployment",
42
37
  "deployment_cors_wildcard",
43
38
  "deployment_source_maps_exposed",
44
39
  "deployment_missing_x_frame_options",
@@ -54,7 +49,43 @@
54
49
  "deployment_config_cors_wildcard_origin",
55
50
  "deployment_config_debug_mode"
56
51
  ],
57
- "freeRuleCount": 35,
52
+ "freeRuleCount": 30,
53
+ "bundledCorpusRuleIds": [
54
+ "generic.auth.jwt-none-algorithm",
55
+ "generic.config.debug-endpoint-env-dump",
56
+ "generic.config.debug-mode-enabled",
57
+ "generic.cors.reflected-origin",
58
+ "generic.cors.wildcard-origin",
59
+ "generic.crypto.aes-ecb-mode",
60
+ "generic.crypto.des-rc4-3des",
61
+ "generic.crypto.math-random-token",
62
+ "generic.crypto.md5-sha1-password-hash",
63
+ "generic.crypto.static-iv",
64
+ "generic.injection.child-process-exec",
65
+ "generic.injection.eval-user-input",
66
+ "generic.injection.eval-user-input-python",
67
+ "generic.injection.shell-true",
68
+ "generic.injection.unsafe-deserialization-python",
69
+ "generic.injection.vm-runcontext",
70
+ "generic.secrets.anthropic-api-key",
71
+ "generic.secrets.aws-access-key",
72
+ "generic.secrets.azure-storage-key",
73
+ "generic.secrets.db-connection-string",
74
+ "generic.secrets.gcp-service-account-key",
75
+ "generic.secrets.github-token",
76
+ "generic.secrets.huggingface-token",
77
+ "generic.secrets.openai-api-key",
78
+ "generic.secrets.private-key-pem",
79
+ "generic.secrets.slack-token",
80
+ "generic.secrets.stripe-live-key",
81
+ "generic.tls.reject-unauthorized-disabled",
82
+ "generic.tls.verify-disabled-python",
83
+ "postgresql.auth.trust-auth-method"
84
+ ],
85
+ "bundledCorpusRuleCount": 30,
86
+ "corpusVersion": 17,
87
+ "bundleContentHash": "sha256:058228a9d82ff3c4fcdc1039c453855cdc5dac28841ab9b2e44268e680498d95",
88
+ "offlineRuleCount": 60,
58
89
  "jsonSchemaFields": [
59
90
  "findings",
60
91
  "riskScore",
@@ -69,6 +100,9 @@
69
100
  "degradedReasons",
70
101
  "creditsWarning",
71
102
  "rulesVersion",
103
+ "runId",
104
+ "treeDigest",
105
+ "cliVersion",
72
106
  "aiCodeIssues",
73
107
  "stateStatus",
74
108
  "regressionCheckSkipped",
@@ -77,7 +111,7 @@
77
111
  "coverageChanged",
78
112
  "scanIdReused"
79
113
  ],
80
- "schemaVersion": "0.5",
114
+ "schemaVersion": "0.6",
81
115
  "degradeCodes": [
82
116
  "FILE_TOO_LARGE",
83
117
  "OUTPUT_TRUNCATED",
@@ -85,7 +119,8 @@
85
119
  "PRO_RULES_UNAVAILABLE",
86
120
  "INVALID_UTF8",
87
121
  "UNREADABLE_FILE",
88
- "COMPILE_FAILURE"
122
+ "COMPILE_FAILURE",
123
+ "SYMLINK_SKIPPED"
89
124
  ],
90
125
  "severities": [
91
126
  "info",
@@ -107,5 +142,5 @@
107
142
  ],
108
143
  "installSnippet": "npx @agenticcli/shipguard scan --changed --strict --json",
109
144
  "re2Engine": true,
110
- "generatedAt": "2026-07-18T20:19:53.031Z"
145
+ "generatedAt": "2026-09-30T15:38:12.044Z"
111
146
  }