@codacy/tools-checkov-3 0.14.0 → 0.16.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.
- package/README.md +17 -10
- package/dist/index.js +186 -105
- package/dist/metadata.js +24 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @codacy/tools-checkov-3
|
|
2
2
|
|
|
3
3
|
## Table of Contents
|
|
4
|
+
|
|
4
5
|
- [Overview](#overview)
|
|
5
6
|
- [Updating patterns](#updating-patterns)
|
|
6
7
|
- [Updating the Checkov version](#updating-the-checkov-version)
|
|
@@ -13,16 +14,16 @@
|
|
|
13
14
|
|
|
14
15
|
Infrastructure-as-Code security scanner using the [Checkov](https://www.checkov.io/) binary. Scans Terraform, CloudFormation, Kubernetes, Dockerfile, and many other IaC frameworks for security misconfigurations. Uses the CLI execution strategy with Python/pip installation into an isolated virtual environment.
|
|
15
16
|
|
|
16
|
-
| Property
|
|
17
|
-
|
|
18
|
-
| Tool ID
|
|
19
|
-
| Codacy UUID
|
|
20
|
-
| Strategy
|
|
21
|
-
| Languages
|
|
22
|
-
| Binary
|
|
23
|
-
| File patterns
|
|
24
|
-
| Pattern count
|
|
25
|
-
| Pattern ID format | `Checkov_{check_id}` (e.g. `Checkov_CKV_AWS_41`)
|
|
17
|
+
| Property | Value |
|
|
18
|
+
| ----------------- | ---------------------------------------------------------------- |
|
|
19
|
+
| Tool ID | `Checkov` |
|
|
20
|
+
| Codacy UUID | `13af9d89-1ce5-4fec-a168-765c3e7b26b3` |
|
|
21
|
+
| Strategy | CLI |
|
|
22
|
+
| Languages | JSON, YAML, Terraform |
|
|
23
|
+
| Binary | `checkov` (Python package) |
|
|
24
|
+
| File patterns | `**/*.tf`, `**/*.yaml`, `**/*.yml`, `**/*.json`, `**/Dockerfile` |
|
|
25
|
+
| Pattern count | ~1,358 |
|
|
26
|
+
| Pattern ID format | `Checkov_{check_id}` (e.g. `Checkov_CKV_AWS_41`) |
|
|
26
27
|
|
|
27
28
|
## Updating patterns
|
|
28
29
|
|
|
@@ -67,3 +68,9 @@ pnpm test
|
|
|
67
68
|
- **Pattern filtering**: Uses `--check CKV_xxx,CKV_yyy,...` to run only specific checks. The `Checkov_` prefix is stripped from pattern IDs to get the raw check ID.
|
|
68
69
|
- **Config files**: Looks for `.checkov.yaml` or `.checkov.yml`. When local config is active, passes `--config-file <path>`.
|
|
69
70
|
- **Parsing errors**: Checkov reports `parsing_errors` in its JSON output, which are surfaced as `AnalysisError` objects with `kind: "ParsingError"`.
|
|
71
|
+
- **Preset mappings (`src/pattern-mappings.json`)**: gates 54 of the 1,358 patterns on a detected preset (Dockerfile, Terraform, GitHub Actions, CircleCI, GitLab CI, Bitbucket Pipelines, Azure Pipelines), so `init --auto` doesn't enable e.g. GitHub Actions checks in a repo with no `.github/workflows/`. The remaining 1,304 patterns stay universal (enabled everywhere) until their detection story is solved — this is deliberately conservative rather than approximate:
|
|
72
|
+
- `"Terraform"` maps **only** `CKV_TF_` (2 patterns — Terraform module-source hygiene, e.g. "use a commit hash"). The much larger cloud-provider families (`CKV_AWS_` 384, `CKV_AZURE_` 247, `CKV_GCP_` 124, and 12 smaller clouds — ~1,091 patterns total) are **not** Terraform-specific: Checkov evaluates the same resource-policy checks against CloudFormation/ARM/Bicep/Serverless Framework templates too (plain YAML/JSON, no `.tf` file involved) — confirmed by Codacy's own pattern metadata, where every single pattern carries the identical `languages: ["JSON", "YAML", "Terraform"]`. Gating them on `.tf` presence would silently drop all cloud checks for a CloudFormation/ARM/Serverless-only repo — a real false negative, not just noise the old universal behavior already had. They stay universal until discovery can recognize those other IaC formats too.
|
|
73
|
+
- Each CI platform also has a **second**, easily-confused prefix family for that platform's repo/org governance settings as managed via its own Terraform provider (e.g. `CKV_GIT_`/`CKV_GITHUB_` vs. the mapped `CKV_GHA_`; `CKV_GLB_`/`CKV_GITLAB_` vs. the mapped `CKV_GITLABCI_`). Those governance patterns need Terraform-provider-content parsing, not file presence, so they're intentionally left out of the mapping (40 patterns, universal for now).
|
|
74
|
+
- `CKV_K8S_`/`CKV2_K8S_`/`CKV_ARGO_` (121 patterns) are also left out — a bare Kubernetes manifest needs YAML content-sniffing (`apiVersion`/`kind`), not just a `.yaml` extension.
|
|
75
|
+
- `CKV_ANSIBLE_`/`CKV2_ANSIBLE_` (12) and `CKV_OPENAPI_` (21) are left out too — there's no Ansible-playbook or OpenAPI/AsyncAPI-spec detector in `discover()` at all yet.
|
|
76
|
+
- `CKV_SECRET_` (18) and `CKV_BCW_` (1) are excluded from every preset by design and stay universal — secret-scanning shouldn't be suppressed by any framework gate.
|
package/dist/index.js
CHANGED
|
@@ -12366,7 +12366,29 @@ var patterns_default = [
|
|
|
12366
12366
|
];
|
|
12367
12367
|
|
|
12368
12368
|
// src/pattern-mappings.json
|
|
12369
|
-
var pattern_mappings_default = {
|
|
12369
|
+
var pattern_mappings_default = {
|
|
12370
|
+
Dockerfile: {
|
|
12371
|
+
prefixes: ["Checkov_CKV_DOCKER_", "Checkov_CKV2_DOCKER_"]
|
|
12372
|
+
},
|
|
12373
|
+
Terraform: {
|
|
12374
|
+
prefixes: ["Checkov_CKV_TF_"]
|
|
12375
|
+
},
|
|
12376
|
+
"GitHub Actions": {
|
|
12377
|
+
prefixes: ["Checkov_CKV_GHA_", "Checkov_CKV2_GHA_"]
|
|
12378
|
+
},
|
|
12379
|
+
CircleCI: {
|
|
12380
|
+
prefixes: ["Checkov_CKV_CIRCLECIPIPELINES_"]
|
|
12381
|
+
},
|
|
12382
|
+
"GitLab CI": {
|
|
12383
|
+
prefixes: ["Checkov_CKV_GITLABCI_"]
|
|
12384
|
+
},
|
|
12385
|
+
"Bitbucket Pipelines": {
|
|
12386
|
+
prefixes: ["Checkov_CKV_BITBUCKETPIPELINES_"]
|
|
12387
|
+
},
|
|
12388
|
+
"Azure Pipelines": {
|
|
12389
|
+
prefixes: ["Checkov_CKV_AZUREPIPELINES_"]
|
|
12390
|
+
}
|
|
12391
|
+
};
|
|
12370
12392
|
|
|
12371
12393
|
// src/metadata.ts
|
|
12372
12394
|
var descriptor = {
|
|
@@ -12375,7 +12397,7 @@ var descriptor = {
|
|
|
12375
12397
|
preferredVersion: "3.2.508",
|
|
12376
12398
|
languages: ["JSON", "YAML", "Terraform"],
|
|
12377
12399
|
filePatterns: ["**/*.tf", "**/*.yaml", "**/*.yml", "**/*.json", "**/Dockerfile"],
|
|
12378
|
-
supportedOS: ["linux", "darwin"],
|
|
12400
|
+
supportedOS: ["linux", "darwin", "win32"],
|
|
12379
12401
|
supportedArch: ["x64", "arm64"],
|
|
12380
12402
|
supportedRunners: ["local", "container"],
|
|
12381
12403
|
frameworkMappings: pattern_mappings_default
|
|
@@ -12399,16 +12421,35 @@ var CONFIG_FILE_CANDIDATES = [".checkov.yaml", ".checkov.yml"];
|
|
|
12399
12421
|
var PIP_PACKAGE = "checkov==3.2.508";
|
|
12400
12422
|
var BINARY = "checkov";
|
|
12401
12423
|
var VERSION_REGEX = /(\d+\.\d+\.\d+)/;
|
|
12402
|
-
|
|
12424
|
+
var PYTHON_VERSION_RANGE = ">=3.9.0 <3.14.0";
|
|
12425
|
+
var MODULE_ARGS = ["-m", "checkov.main"];
|
|
12426
|
+
async function resolveCheckovInvocation(ctx) {
|
|
12403
12427
|
const venvDir = (0, import_tooling.getVenvDir)(ctx.globalDir, TOOL_ID);
|
|
12428
|
+
const venvPython = (0, import_tooling.getVenvPaths)(venvDir).python;
|
|
12429
|
+
if (await pathExists(venvPython)) {
|
|
12430
|
+
return { command: venvPython, prefixArgs: MODULE_ARGS };
|
|
12431
|
+
}
|
|
12432
|
+
return { command: BINARY, prefixArgs: [] };
|
|
12433
|
+
}
|
|
12434
|
+
async function probeCheckovVersion(command, prefixArgs, logger) {
|
|
12404
12435
|
try {
|
|
12405
|
-
const
|
|
12406
|
-
|
|
12407
|
-
|
|
12408
|
-
|
|
12436
|
+
const { stdout, stderr, exitCode } = await (0, import_tooling.spawnTool)(command, [...prefixArgs, "--version"], {
|
|
12437
|
+
cwd: process.cwd(),
|
|
12438
|
+
timeoutMs: 6e4,
|
|
12439
|
+
logger
|
|
12440
|
+
});
|
|
12441
|
+
if (exitCode !== 0) return null;
|
|
12442
|
+
const match = (stdout || stderr).match(VERSION_REGEX);
|
|
12443
|
+
return match ? match[1] : null;
|
|
12409
12444
|
} catch {
|
|
12445
|
+
return null;
|
|
12410
12446
|
}
|
|
12411
|
-
|
|
12447
|
+
}
|
|
12448
|
+
async function listDirSafe(dir) {
|
|
12449
|
+
return import_promises.default.readdir(dir).catch(() => []);
|
|
12450
|
+
}
|
|
12451
|
+
async function pathExists(p) {
|
|
12452
|
+
return import_promises.default.access(p).then(() => true).catch(() => false);
|
|
12412
12453
|
}
|
|
12413
12454
|
function buildEnv(ctx) {
|
|
12414
12455
|
if (ctx.runner !== "container") return void 0;
|
|
@@ -12434,25 +12475,25 @@ var adapter = {
|
|
|
12434
12475
|
prerequisites: [
|
|
12435
12476
|
{
|
|
12436
12477
|
name: "Python",
|
|
12437
|
-
versionRange:
|
|
12478
|
+
versionRange: PYTHON_VERSION_RANGE,
|
|
12438
12479
|
preferredVersion: "3.12.0",
|
|
12439
12480
|
checkCommand: "python3 --version"
|
|
12440
12481
|
}
|
|
12441
12482
|
],
|
|
12442
12483
|
/**
|
|
12443
|
-
* Checks whether
|
|
12484
|
+
* Checks whether checkov is present and runnable.
|
|
12444
12485
|
*
|
|
12445
12486
|
* Checks in order:
|
|
12446
|
-
* 1. Codacy-managed venv
|
|
12447
|
-
* 2. Global PATH
|
|
12487
|
+
* 1. Codacy-managed venv — `<venv>/python -m checkov.main --version` -> "codacy"
|
|
12488
|
+
* 2. Global PATH — `checkov --version` -> "global"
|
|
12448
12489
|
*
|
|
12449
|
-
*
|
|
12450
|
-
*
|
|
12451
|
-
*
|
|
12490
|
+
* checkov is always invoked as a module (see {@link MODULE_ARGS}); its wheel
|
|
12491
|
+
* ships no console-script, so on Windows there is no `checkov.exe` to probe.
|
|
12492
|
+
* Returns `available: false` (rather than throwing) if checkov cannot be run.
|
|
12452
12493
|
*/
|
|
12453
12494
|
async checkAvailability(ctx) {
|
|
12454
12495
|
ctx.logger.debug("Checking availability", { toolId: TOOL_ID });
|
|
12455
|
-
const pythonInfo = await (0, import_tooling.findPython)(
|
|
12496
|
+
const pythonInfo = await (0, import_tooling.findPython)(PYTHON_VERSION_RANGE, ctx.logger).catch(() => null);
|
|
12456
12497
|
const dependencies = pythonInfo ? [
|
|
12457
12498
|
{
|
|
12458
12499
|
name: "Python",
|
|
@@ -12462,46 +12503,36 @@ var adapter = {
|
|
|
12462
12503
|
}
|
|
12463
12504
|
] : [{ name: "Python", available: false, reason: "Python 3 not found" }];
|
|
12464
12505
|
const venvDir = (0, import_tooling.getVenvDir)(ctx.globalDir, TOOL_ID);
|
|
12465
|
-
|
|
12466
|
-
|
|
12467
|
-
|
|
12468
|
-
|
|
12469
|
-
|
|
12470
|
-
|
|
12471
|
-
|
|
12472
|
-
|
|
12473
|
-
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
}
|
|
12506
|
+
const venvPython = (0, import_tooling.getVenvPaths)(venvDir).python;
|
|
12507
|
+
const venvPythonExists = await pathExists(venvPython);
|
|
12508
|
+
if (venvPythonExists) {
|
|
12509
|
+
const version = await probeCheckovVersion(venvPython, MODULE_ARGS, ctx.logger);
|
|
12510
|
+
if (version) {
|
|
12511
|
+
ctx.logger.debug("Checkov found in codacy venv", { toolId: TOOL_ID, version });
|
|
12512
|
+
return {
|
|
12513
|
+
available: true,
|
|
12514
|
+
version,
|
|
12515
|
+
path: venvPython,
|
|
12516
|
+
installation: "codacy",
|
|
12517
|
+
dependencies
|
|
12518
|
+
};
|
|
12479
12519
|
}
|
|
12480
|
-
} catch {
|
|
12481
12520
|
}
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
|
|
12485
|
-
|
|
12486
|
-
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
|
|
12490
|
-
|
|
12491
|
-
return {
|
|
12492
|
-
available: true,
|
|
12493
|
-
version: match[1],
|
|
12494
|
-
installation: "global",
|
|
12495
|
-
dependencies
|
|
12496
|
-
};
|
|
12497
|
-
}
|
|
12498
|
-
}
|
|
12499
|
-
} catch {
|
|
12521
|
+
const globalVersion = await probeCheckovVersion(BINARY, [], ctx.logger);
|
|
12522
|
+
if (globalVersion) {
|
|
12523
|
+
ctx.logger.debug("Checkov found on global PATH", { toolId: TOOL_ID, version: globalVersion });
|
|
12524
|
+
return {
|
|
12525
|
+
available: true,
|
|
12526
|
+
version: globalVersion,
|
|
12527
|
+
installation: "global",
|
|
12528
|
+
dependencies
|
|
12529
|
+
};
|
|
12500
12530
|
}
|
|
12501
|
-
|
|
12531
|
+
const reason = venvPythonExists ? `checkov could not be run via '${venvPython} -m checkov.main --version' (see debug logs); it may not be installed in the venv or the venv's Python may be incompatible` : "checkov not found in the Codacy venv or on PATH";
|
|
12532
|
+
ctx.logger.debug("Checkov not found", { toolId: TOOL_ID, venvPython, venvPythonExists });
|
|
12502
12533
|
return {
|
|
12503
12534
|
available: false,
|
|
12504
|
-
reason
|
|
12535
|
+
reason,
|
|
12505
12536
|
installHint: "pip install checkov # or\ncodacy-analysis analyze . --install-dependencies # auto-install",
|
|
12506
12537
|
dependencies
|
|
12507
12538
|
};
|
|
@@ -12515,7 +12546,7 @@ var adapter = {
|
|
|
12515
12546
|
*/
|
|
12516
12547
|
async install(ctx) {
|
|
12517
12548
|
ctx.logger.info("Starting install", { toolId: TOOL_ID });
|
|
12518
|
-
const pythonInfo = await (0, import_tooling.ensurePython)(ctx.globalDir,
|
|
12549
|
+
const pythonInfo = await (0, import_tooling.ensurePython)(ctx.globalDir, PYTHON_VERSION_RANGE, ctx.logger);
|
|
12519
12550
|
if (!pythonInfo) {
|
|
12520
12551
|
return {
|
|
12521
12552
|
success: false,
|
|
@@ -12523,24 +12554,50 @@ var adapter = {
|
|
|
12523
12554
|
toolId: TOOL_ID,
|
|
12524
12555
|
phase: "toolInstall",
|
|
12525
12556
|
kind: "MissingPrerequisite",
|
|
12526
|
-
message: "Python 3 could not be found or downloaded.
|
|
12557
|
+
message: "Python (>=3.9.0 <3.14.0) could not be found or downloaded. Checkov 3.2.x does not support Python 3.14+.",
|
|
12527
12558
|
level: "error"
|
|
12528
12559
|
}
|
|
12529
12560
|
};
|
|
12530
12561
|
}
|
|
12531
12562
|
const venvDir = (0, import_tooling.getVenvDir)(ctx.globalDir, TOOL_ID);
|
|
12532
|
-
|
|
12533
|
-
|
|
12563
|
+
const venvPython = (0, import_tooling.getVenvPaths)(venvDir).python;
|
|
12564
|
+
const installIntoVenv = async () => {
|
|
12534
12565
|
const venv = await (0, import_tooling.ensureVenv)(pythonInfo.path, venvDir, ctx.logger);
|
|
12535
12566
|
ctx.logger.info(
|
|
12536
12567
|
`Installing ${PIP_PACKAGE} (this may take several minutes due to ~200 transitive dependencies)...`
|
|
12537
12568
|
);
|
|
12538
12569
|
await (0, import_tooling.pipInstall)(venv, [PIP_PACKAGE], ctx.logger);
|
|
12539
|
-
|
|
12540
|
-
|
|
12570
|
+
return probeCheckovVersion(venv.python, MODULE_ARGS, ctx.logger);
|
|
12571
|
+
};
|
|
12572
|
+
try {
|
|
12573
|
+
ctx.logger.info(`Creating venv for Checkov at ${venvDir}...`);
|
|
12574
|
+
let version = await installIntoVenv();
|
|
12575
|
+
if (!version) {
|
|
12576
|
+
ctx.logger.warn(
|
|
12577
|
+
`Checkov installed but 'python -m checkov.main' did not run; rebuilding the venv`,
|
|
12578
|
+
{ venvDir, binDirContents: await listDirSafe((0, import_tooling.getVenvPaths)(venvDir).binDir) }
|
|
12579
|
+
);
|
|
12580
|
+
await import_promises.default.rm(venvDir, { recursive: true, force: true }).catch(() => {
|
|
12581
|
+
});
|
|
12582
|
+
version = await installIntoVenv();
|
|
12583
|
+
}
|
|
12584
|
+
if (!version) {
|
|
12585
|
+
const contents = await listDirSafe((0, import_tooling.getVenvPaths)(venvDir).binDir);
|
|
12586
|
+
return {
|
|
12587
|
+
success: false,
|
|
12588
|
+
error: {
|
|
12589
|
+
toolId: TOOL_ID,
|
|
12590
|
+
phase: "toolInstall",
|
|
12591
|
+
kind: "InstallError",
|
|
12592
|
+
message: `Checkov install completed but 'python -m checkov.main --version' did not run in the venv (bin dir contains: ${contents.join(", ") || "nothing"}). The venv's Python may be incompatible with Checkov 3.2.x.`,
|
|
12593
|
+
level: "error"
|
|
12594
|
+
}
|
|
12595
|
+
};
|
|
12596
|
+
}
|
|
12597
|
+
ctx.logger.info(`Installed Checkov ${version} to ${venvPython}`);
|
|
12541
12598
|
return {
|
|
12542
12599
|
success: true,
|
|
12543
|
-
installedPath,
|
|
12600
|
+
installedPath: venvPython,
|
|
12544
12601
|
installedVersion: adapter.preferredVersion
|
|
12545
12602
|
};
|
|
12546
12603
|
} catch (err) {
|
|
@@ -12615,54 +12672,87 @@ var adapter = {
|
|
|
12615
12672
|
if (ctx.targetFiles.length === 0) {
|
|
12616
12673
|
return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, 0);
|
|
12617
12674
|
}
|
|
12618
|
-
let
|
|
12675
|
+
let command;
|
|
12676
|
+
let prefixArgs;
|
|
12619
12677
|
try {
|
|
12620
|
-
|
|
12678
|
+
({ command, prefixArgs } = await resolveCheckovInvocation(ctx));
|
|
12621
12679
|
} catch {
|
|
12622
|
-
|
|
12680
|
+
command = BINARY;
|
|
12681
|
+
prefixArgs = [];
|
|
12623
12682
|
}
|
|
12624
|
-
const
|
|
12683
|
+
const baseArgs = [...prefixArgs, "-o", "json", "--quiet"];
|
|
12625
12684
|
const useLocal = codacyConfig.useLocalConfigurationFile && codacyConfig.localConfigurationFile;
|
|
12626
12685
|
if (useLocal) {
|
|
12627
|
-
|
|
12628
|
-
}
|
|
12629
|
-
for (const file of ctx.targetFiles) {
|
|
12630
|
-
args.push("-f", import_path.default.resolve(ctx.repositoryRoot, file));
|
|
12686
|
+
baseArgs.push("--config-file", codacyConfig.localConfigurationFile);
|
|
12631
12687
|
}
|
|
12688
|
+
const absoluteFiles = ctx.targetFiles.map((f) => import_path.default.resolve(ctx.repositoryRoot, f));
|
|
12689
|
+
const fileChunks = (0, import_tooling.chunkFilesForArgv)(absoluteFiles);
|
|
12632
12690
|
const env = buildEnv(ctx);
|
|
12691
|
+
const frameworks = [];
|
|
12633
12692
|
try {
|
|
12634
|
-
const
|
|
12635
|
-
|
|
12636
|
-
|
|
12637
|
-
|
|
12638
|
-
|
|
12639
|
-
|
|
12640
|
-
|
|
12641
|
-
|
|
12642
|
-
|
|
12643
|
-
kind: "NonZeroExit",
|
|
12644
|
-
message: `checkov exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`,
|
|
12645
|
-
level: "error"
|
|
12646
|
-
});
|
|
12647
|
-
return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
12648
|
-
}
|
|
12649
|
-
if (!stdout.trim()) {
|
|
12650
|
-
return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
12651
|
-
}
|
|
12652
|
-
let parsed;
|
|
12653
|
-
try {
|
|
12654
|
-
parsed = JSON.parse(stdout);
|
|
12655
|
-
} catch (err) {
|
|
12656
|
-
errors.push({
|
|
12657
|
-
toolId: TOOL_ID,
|
|
12658
|
-
phase: "outputParse",
|
|
12659
|
-
kind: "MalformedOutput",
|
|
12660
|
-
message: `Failed to parse checkov JSON output: ${err instanceof Error ? err.message : String(err)}`,
|
|
12661
|
-
level: "error"
|
|
12693
|
+
for (const chunk of fileChunks) {
|
|
12694
|
+
const fileArgs = [];
|
|
12695
|
+
for (const file of chunk) {
|
|
12696
|
+
fileArgs.push("-f", file);
|
|
12697
|
+
}
|
|
12698
|
+
const { stdout, stderr, exitCode } = await (0, import_tooling.spawnTool)(command, [...baseArgs, ...fileArgs], {
|
|
12699
|
+
cwd: ctx.repositoryRoot,
|
|
12700
|
+
env,
|
|
12701
|
+
logger: ctx.logger
|
|
12662
12702
|
});
|
|
12663
|
-
|
|
12703
|
+
if (exitCode > 1) {
|
|
12704
|
+
errors.push({
|
|
12705
|
+
toolId: TOOL_ID,
|
|
12706
|
+
phase: "toolInvoke",
|
|
12707
|
+
kind: "NonZeroExit",
|
|
12708
|
+
message: `checkov exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`,
|
|
12709
|
+
level: "error"
|
|
12710
|
+
});
|
|
12711
|
+
return (0, import_tooling.buildResult)(
|
|
12712
|
+
TOOL_ID,
|
|
12713
|
+
startedAt,
|
|
12714
|
+
/* @__PURE__ */ new Date(),
|
|
12715
|
+
issues,
|
|
12716
|
+
errors,
|
|
12717
|
+
ctx.targetFiles.length
|
|
12718
|
+
);
|
|
12719
|
+
}
|
|
12720
|
+
if (stderr && stderr.trim()) {
|
|
12721
|
+
errors.push({
|
|
12722
|
+
toolId: TOOL_ID,
|
|
12723
|
+
phase: "toolInvoke",
|
|
12724
|
+
kind: "StderrWarning",
|
|
12725
|
+
message: `checkov stderr: ${stderr.trim()}`,
|
|
12726
|
+
level: "warning"
|
|
12727
|
+
});
|
|
12728
|
+
}
|
|
12729
|
+
if (!stdout.trim()) continue;
|
|
12730
|
+
let parsed;
|
|
12731
|
+
try {
|
|
12732
|
+
parsed = JSON.parse(stdout);
|
|
12733
|
+
} catch (err) {
|
|
12734
|
+
errors.push({
|
|
12735
|
+
toolId: TOOL_ID,
|
|
12736
|
+
phase: "outputParse",
|
|
12737
|
+
kind: "MalformedOutput",
|
|
12738
|
+
message: `Failed to parse checkov JSON output: ${err instanceof Error ? err.message : String(err)}`,
|
|
12739
|
+
level: "error"
|
|
12740
|
+
});
|
|
12741
|
+
return (0, import_tooling.buildResult)(
|
|
12742
|
+
TOOL_ID,
|
|
12743
|
+
startedAt,
|
|
12744
|
+
/* @__PURE__ */ new Date(),
|
|
12745
|
+
issues,
|
|
12746
|
+
errors,
|
|
12747
|
+
ctx.targetFiles.length
|
|
12748
|
+
);
|
|
12749
|
+
}
|
|
12750
|
+
if (Array.isArray(parsed)) {
|
|
12751
|
+
frameworks.push(...parsed);
|
|
12752
|
+
} else {
|
|
12753
|
+
frameworks.push(parsed);
|
|
12754
|
+
}
|
|
12664
12755
|
}
|
|
12665
|
-
const frameworks = Array.isArray(parsed) ? parsed : [parsed];
|
|
12666
12756
|
const enabledPatterns = new Set(codacyConfig.patterns.map((p) => p.patternId));
|
|
12667
12757
|
const targetFilesSet = new Set(ctx.targetFiles);
|
|
12668
12758
|
const linesCache = /* @__PURE__ */ new Map();
|
|
@@ -12716,15 +12806,6 @@ var adapter = {
|
|
|
12716
12806
|
issues.push(issue);
|
|
12717
12807
|
}
|
|
12718
12808
|
}
|
|
12719
|
-
if (stderr && stderr.trim()) {
|
|
12720
|
-
errors.push({
|
|
12721
|
-
toolId: TOOL_ID,
|
|
12722
|
-
phase: "toolInvoke",
|
|
12723
|
-
kind: "StderrWarning",
|
|
12724
|
-
message: `checkov stderr: ${stderr.trim()}`,
|
|
12725
|
-
level: "warning"
|
|
12726
|
-
});
|
|
12727
|
-
}
|
|
12728
12809
|
} catch (err) {
|
|
12729
12810
|
errors.push({
|
|
12730
12811
|
toolId: TOOL_ID,
|
package/dist/metadata.js
CHANGED
|
@@ -25,7 +25,29 @@ __export(metadata_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(metadata_exports);
|
|
26
26
|
|
|
27
27
|
// src/pattern-mappings.json
|
|
28
|
-
var pattern_mappings_default = {
|
|
28
|
+
var pattern_mappings_default = {
|
|
29
|
+
Dockerfile: {
|
|
30
|
+
prefixes: ["Checkov_CKV_DOCKER_", "Checkov_CKV2_DOCKER_"]
|
|
31
|
+
},
|
|
32
|
+
Terraform: {
|
|
33
|
+
prefixes: ["Checkov_CKV_TF_"]
|
|
34
|
+
},
|
|
35
|
+
"GitHub Actions": {
|
|
36
|
+
prefixes: ["Checkov_CKV_GHA_", "Checkov_CKV2_GHA_"]
|
|
37
|
+
},
|
|
38
|
+
CircleCI: {
|
|
39
|
+
prefixes: ["Checkov_CKV_CIRCLECIPIPELINES_"]
|
|
40
|
+
},
|
|
41
|
+
"GitLab CI": {
|
|
42
|
+
prefixes: ["Checkov_CKV_GITLABCI_"]
|
|
43
|
+
},
|
|
44
|
+
"Bitbucket Pipelines": {
|
|
45
|
+
prefixes: ["Checkov_CKV_BITBUCKETPIPELINES_"]
|
|
46
|
+
},
|
|
47
|
+
"Azure Pipelines": {
|
|
48
|
+
prefixes: ["Checkov_CKV_AZUREPIPELINES_"]
|
|
49
|
+
}
|
|
50
|
+
};
|
|
29
51
|
|
|
30
52
|
// src/metadata.ts
|
|
31
53
|
var descriptor = {
|
|
@@ -34,7 +56,7 @@ var descriptor = {
|
|
|
34
56
|
preferredVersion: "3.2.508",
|
|
35
57
|
languages: ["JSON", "YAML", "Terraform"],
|
|
36
58
|
filePatterns: ["**/*.tf", "**/*.yaml", "**/*.yml", "**/*.json", "**/Dockerfile"],
|
|
37
|
-
supportedOS: ["linux", "darwin"],
|
|
59
|
+
supportedOS: ["linux", "darwin", "win32"],
|
|
38
60
|
supportedArch: ["x64", "arm64"],
|
|
39
61
|
supportedRunners: ["local", "container"],
|
|
40
62
|
frameworkMappings: pattern_mappings_default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codacy/tools-checkov-3",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.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.
|
|
11
|
+
"@codacy/tooling": "0.16.0"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"author": "Codacy <support@codacy.com> (https://www.codacy.com)",
|