@codacy/tools-checkov-3 0.16.0 → 0.17.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.
Files changed (2) hide show
  1. package/dist/index.js +29 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -12451,10 +12451,10 @@ async function listDirSafe(dir) {
12451
12451
  async function pathExists(p) {
12452
12452
  return import_promises.default.access(p).then(() => true).catch(() => false);
12453
12453
  }
12454
- function buildEnv(ctx) {
12455
- if (ctx.runner !== "container") return void 0;
12454
+ function buildEnv() {
12456
12455
  const env = {
12457
- RENDER_EDGES_DUPLICATE_ITER_COUNT: "50"
12456
+ RENDER_EDGES_DUPLICATE_ITER_COUNT: "50",
12457
+ CKV_SKIP_PACKAGE_UPDATE_CHECK: "true"
12458
12458
  };
12459
12459
  if (process.env.http_proxy) {
12460
12460
  env.http_proxy = process.env.http_proxy;
@@ -12687,19 +12687,28 @@ var adapter = {
12687
12687
  }
12688
12688
  const absoluteFiles = ctx.targetFiles.map((f) => import_path.default.resolve(ctx.repositoryRoot, f));
12689
12689
  const fileChunks = (0, import_tooling.chunkFilesForArgv)(absoluteFiles);
12690
- const env = buildEnv(ctx);
12690
+ const env = buildEnv();
12691
12691
  const frameworks = [];
12692
+ let scannedCount = 0;
12692
12693
  try {
12693
12694
  for (const chunk of fileChunks) {
12695
+ if (ctx.signal?.aborted) break;
12694
12696
  const fileArgs = [];
12695
12697
  for (const file of chunk) {
12696
12698
  fileArgs.push("-f", file);
12697
12699
  }
12698
- const { stdout, stderr, exitCode } = await (0, import_tooling.spawnTool)(command, [...baseArgs, ...fileArgs], {
12700
+ const spawned = await (0, import_tooling.spawnTool)(command, [...baseArgs, ...fileArgs], {
12699
12701
  cwd: ctx.repositoryRoot,
12700
12702
  env,
12701
- logger: ctx.logger
12703
+ logger: ctx.logger,
12704
+ signal: ctx.signal
12705
+ }).catch((err) => {
12706
+ if (ctx.signal?.aborted) return null;
12707
+ throw err;
12702
12708
  });
12709
+ if (spawned === null) break;
12710
+ const { stdout, stderr, exitCode } = spawned;
12711
+ scannedCount += chunk.length;
12703
12712
  if (exitCode > 1) {
12704
12713
  errors.push({
12705
12714
  toolId: TOOL_ID,
@@ -12753,6 +12762,20 @@ var adapter = {
12753
12762
  frameworks.push(parsed);
12754
12763
  }
12755
12764
  }
12765
+ if (ctx.signal?.aborted) {
12766
+ errors.push({
12767
+ toolId: TOOL_ID,
12768
+ phase: "toolInvoke",
12769
+ kind: "Timeout",
12770
+ message: `checkov timed out; returning partial results for ${scannedCount}/${ctx.targetFiles.length} files`,
12771
+ level: "error"
12772
+ });
12773
+ ctx.logger.warn("checkov timed out; returning partial results", {
12774
+ toolId: TOOL_ID,
12775
+ scannedFiles: scannedCount,
12776
+ totalFiles: ctx.targetFiles.length
12777
+ });
12778
+ }
12756
12779
  const enabledPatterns = new Set(codacyConfig.patterns.map((p) => p.patternId));
12757
12780
  const targetFilesSet = new Set(ctx.targetFiles);
12758
12781
  const linesCache = /* @__PURE__ */ new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/tools-checkov-3",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Checkov adapter — CLI-mode IaC security scanner",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "dist"
9
9
  ],
10
10
  "dependencies": {
11
- "@codacy/tooling": "0.16.0"
11
+ "@codacy/tooling": "0.17.0"
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Codacy <support@codacy.com> (https://www.codacy.com)",