@codacy/tools-checkov-3 0.18.0 → 0.19.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 CHANGED
@@ -19,7 +19,7 @@ Infrastructure-as-Code security scanner using the [Checkov](https://www.checkov.
19
19
  | Tool ID | `Checkov` |
20
20
  | Codacy UUID | `13af9d89-1ce5-4fec-a168-765c3e7b26b3` |
21
21
  | Strategy | CLI |
22
- | Languages | JSON, YAML, Terraform |
22
+ | Languages | JSON, YAML, Terraform, Dockerfile |
23
23
  | Binary | `checkov` (Python package) |
24
24
  | File patterns | `**/*.tf`, `**/*.yaml`, `**/*.yml`, `**/*.json`, `**/Dockerfile` |
25
25
  | Pattern count | ~1,358 |
@@ -68,9 +68,16 @@ pnpm test
68
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.
69
69
  - **Config files**: Looks for `.checkov.yaml` or `.checkov.yml`. When local config is active, passes `--config-file <path>`.
70
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.
71
+ - **Preset mappings (`src/pattern-mappings.json`)**: gates 1,278 of the 1,358 patterns on a detected IaC framework, so `init --auto` doesn't enable AWS resource policy in a repo with no infrastructure. Measured effect: a repo with only a `package.json` went from 1,225 enabled Checkov patterns to 80.
72
+
73
+ The gate is **per IaC framework, not per cloud**, because a cloud resource can be declared several ways — the same bucket is an `aws_s3_bucket` in Terraform, an `AWS::S3::Bucket` in CloudFormation and a `resources:` block under Serverless. `filterAutoPatterns` enables a framework pattern when **any** of its keys was detected, so the same prefix is listed under several keys to mean "AWS resources, however they are declared". That OR is what makes gating safe here; an earlier revision left all ~1,091 cloud-provider checks universal precisely because gating them on `.tf` alone would have dropped every cloud check for a CloudFormation-only repo.
74
+ - `"lang:Terraform"` maps `CKV_TF_` plus every cloud-provider family (`CKV_AWS_`, `CKV_AZURE_`, `CKV_GCP_`, and the 10 smaller clouds). No file signal is needed: `.tf` **is** the `Terraform` language, so `lang:Terraform` already means "this repo has Terraform".
75
+ - `cloudformation` and `serverless-framework` also claim `CKV_AWS_`/`CKV2_AWS_`; `bicep` also claims `CKV_AZURE_`/`CKV2_AZURE_`. Detected by file signal (`samconfig.*`, a root `template.yaml`, a `cloudformation/` directory, `serverless.yml`, `*.bicep`).
76
+ - `kubernetes` and `helm` both claim `CKV_K8S_`/`CKV2_K8S_`/`CKV_ARGO_` — a chart's templates render to manifests, so either is evidence. Detected from `kustomization.yaml` / `Chart.yaml`.
77
+ - `ansible` claims `CKV_ANSIBLE_`/`CKV2_ANSIBLE_`, from `ansible.cfg` or the `roles/<name>/tasks/main.yml` layout.
78
+ - **Still universal (80 patterns), each for a stated reason:**
79
+ - `CKV_SECRET_` (18) and `CKV_BCW_` (1) by design — secret scanning must not be suppressed by any framework gate.
80
+ - `CKV_OPENAPI_` (21) — an OpenAPI/AsyncAPI document identifies itself by its `openapi:`/`swagger:` key, which a path-only signal cannot see. Needs the content probe.
81
+ - The VCS governance families `CKV_GITHUB_` (26), `CKV_GIT_` (7), `CKV_GLB_` (4), `CKV_GITLAB_`, `CKV_BITBUCKET_`, `CKV2_ADO_` (1 each). These are **unresolved, not deferred**: their titles read as platform/API settings (Checkov's `github_configuration` framework, which reads API data and cannot fire on a filesystem scan), while an earlier reading of this file recorded them as governance resources managed through each platform's _Terraform provider_ — in which case they belong under `lang:Terraform`. The two readings imply opposite fixes (prune vs. gate), so they are left untouched until checked against Checkov's own framework declarations.
82
+ - **Known gap:** a bare Kubernetes manifest (`k8s/deployment.yaml`) or a bare CloudFormation template is still not detected — only the conventional shells around them are. Both declare themselves in their content, so closing this needs a bounded content probe (`apiVersion:`, `AWSTemplateFormatVersion`), which is not implemented.
83
+ - **Known gap (upstream):** most patterns carry `languages: ["JSON", "YAML", "Terraform"]`, which is the _tool-level fallback_ Codacy's API returns for a pattern with no per-pattern languages — not a claim about the check. It over-declares (JSON is why Checkov is selected almost everywhere) and under-declares (only 6 of 28 `CKV_DOCKER_` checks list `Dockerfile`, so 22 are dropped by the language filter in a Dockerfile-only repo). The durable fix is in the cloud tool definition; see `todo-checkov-languages.md`.
package/dist/index.js CHANGED
@@ -12367,25 +12367,62 @@ var patterns_default = [
12367
12367
 
12368
12368
  // src/pattern-mappings.json
12369
12369
  var pattern_mappings_default = {
12370
- Dockerfile: {
12370
+ "lang:Dockerfile": {
12371
12371
  prefixes: ["Checkov_CKV_DOCKER_", "Checkov_CKV2_DOCKER_"]
12372
12372
  },
12373
- Terraform: {
12374
- prefixes: ["Checkov_CKV_TF_"]
12375
- },
12376
- "GitHub Actions": {
12373
+ "lang:Terraform": {
12374
+ prefixes: [
12375
+ "Checkov_CKV_TF_",
12376
+ "Checkov_CKV_AWS_",
12377
+ "Checkov_CKV2_AWS_",
12378
+ "Checkov_CKV_AZURE_",
12379
+ "Checkov_CKV2_AZURE_",
12380
+ "Checkov_CKV_GCP_",
12381
+ "Checkov_CKV2_GCP_",
12382
+ "Checkov_CKV_ALI_",
12383
+ "Checkov_CKV_OCI_",
12384
+ "Checkov_CKV2_OCI_",
12385
+ "Checkov_CKV2_IBM_",
12386
+ "Checkov_CKV_NCP_",
12387
+ "Checkov_CKV_YC_",
12388
+ "Checkov_CKV_TC_",
12389
+ "Checkov_CKV_PAN_",
12390
+ "Checkov_CKV_LIN_",
12391
+ "Checkov_CKV_DIO_",
12392
+ "Checkov_CKV_OPENSTACK_"
12393
+ ]
12394
+ },
12395
+ cloudformation: {
12396
+ prefixes: ["Checkov_CKV_AWS_", "Checkov_CKV2_AWS_"]
12397
+ },
12398
+ "serverless-framework": {
12399
+ prefixes: ["Checkov_CKV_AWS_", "Checkov_CKV2_AWS_"]
12400
+ },
12401
+ bicep: {
12402
+ prefixes: ["Checkov_CKV_AZURE_", "Checkov_CKV2_AZURE_"]
12403
+ },
12404
+ kubernetes: {
12405
+ prefixes: ["Checkov_CKV_K8S_", "Checkov_CKV2_K8S_", "Checkov_CKV_ARGO_"]
12406
+ },
12407
+ helm: {
12408
+ prefixes: ["Checkov_CKV_K8S_", "Checkov_CKV2_K8S_", "Checkov_CKV_ARGO_"]
12409
+ },
12410
+ ansible: {
12411
+ prefixes: ["Checkov_CKV_ANSIBLE_", "Checkov_CKV2_ANSIBLE_"]
12412
+ },
12413
+ "github-actions": {
12377
12414
  prefixes: ["Checkov_CKV_GHA_", "Checkov_CKV2_GHA_"]
12378
12415
  },
12379
- CircleCI: {
12416
+ circleci: {
12380
12417
  prefixes: ["Checkov_CKV_CIRCLECIPIPELINES_"]
12381
12418
  },
12382
- "GitLab CI": {
12419
+ "gitlab-ci": {
12383
12420
  prefixes: ["Checkov_CKV_GITLABCI_"]
12384
12421
  },
12385
- "Bitbucket Pipelines": {
12422
+ "bitbucket-pipelines": {
12386
12423
  prefixes: ["Checkov_CKV_BITBUCKETPIPELINES_"]
12387
12424
  },
12388
- "Azure Pipelines": {
12425
+ "azure-pipelines": {
12389
12426
  prefixes: ["Checkov_CKV_AZUREPIPELINES_"]
12390
12427
  }
12391
12428
  };
@@ -12395,7 +12432,13 @@ var descriptor = {
12395
12432
  id: "Checkov",
12396
12433
  displayName: "Checkov",
12397
12434
  preferredVersion: "3.2.508",
12398
- languages: ["JSON", "YAML", "Terraform"],
12435
+ // `Dockerfile` is not in the tool-level language list Codacy's API reports, but
12436
+ // Checkov ships 28 `CKV_DOCKER_` checks and `filePatterns` already routes
12437
+ // Dockerfiles here. Without it, a Dockerfile-only repo detects only the
12438
+ // `Dockerfile` language, the language gate finds no overlap, and Checkov is not
12439
+ // selected at all — so the entire Docker ruleset is dropped from exactly the
12440
+ // repo it was written for.
12441
+ languages: ["JSON", "YAML", "Terraform", "Dockerfile"],
12399
12442
  filePatterns: ["**/*.tf", "**/*.yaml", "**/*.yml", "**/*.json", "**/Dockerfile"],
12400
12443
  supportedOS: ["linux", "darwin", "win32"],
12401
12444
  supportedArch: ["x64", "arm64"],
package/dist/metadata.js CHANGED
@@ -26,25 +26,62 @@ module.exports = __toCommonJS(metadata_exports);
26
26
 
27
27
  // src/pattern-mappings.json
28
28
  var pattern_mappings_default = {
29
- Dockerfile: {
29
+ "lang:Dockerfile": {
30
30
  prefixes: ["Checkov_CKV_DOCKER_", "Checkov_CKV2_DOCKER_"]
31
31
  },
32
- Terraform: {
33
- prefixes: ["Checkov_CKV_TF_"]
32
+ "lang:Terraform": {
33
+ prefixes: [
34
+ "Checkov_CKV_TF_",
35
+ "Checkov_CKV_AWS_",
36
+ "Checkov_CKV2_AWS_",
37
+ "Checkov_CKV_AZURE_",
38
+ "Checkov_CKV2_AZURE_",
39
+ "Checkov_CKV_GCP_",
40
+ "Checkov_CKV2_GCP_",
41
+ "Checkov_CKV_ALI_",
42
+ "Checkov_CKV_OCI_",
43
+ "Checkov_CKV2_OCI_",
44
+ "Checkov_CKV2_IBM_",
45
+ "Checkov_CKV_NCP_",
46
+ "Checkov_CKV_YC_",
47
+ "Checkov_CKV_TC_",
48
+ "Checkov_CKV_PAN_",
49
+ "Checkov_CKV_LIN_",
50
+ "Checkov_CKV_DIO_",
51
+ "Checkov_CKV_OPENSTACK_"
52
+ ]
34
53
  },
35
- "GitHub Actions": {
54
+ cloudformation: {
55
+ prefixes: ["Checkov_CKV_AWS_", "Checkov_CKV2_AWS_"]
56
+ },
57
+ "serverless-framework": {
58
+ prefixes: ["Checkov_CKV_AWS_", "Checkov_CKV2_AWS_"]
59
+ },
60
+ bicep: {
61
+ prefixes: ["Checkov_CKV_AZURE_", "Checkov_CKV2_AZURE_"]
62
+ },
63
+ kubernetes: {
64
+ prefixes: ["Checkov_CKV_K8S_", "Checkov_CKV2_K8S_", "Checkov_CKV_ARGO_"]
65
+ },
66
+ helm: {
67
+ prefixes: ["Checkov_CKV_K8S_", "Checkov_CKV2_K8S_", "Checkov_CKV_ARGO_"]
68
+ },
69
+ ansible: {
70
+ prefixes: ["Checkov_CKV_ANSIBLE_", "Checkov_CKV2_ANSIBLE_"]
71
+ },
72
+ "github-actions": {
36
73
  prefixes: ["Checkov_CKV_GHA_", "Checkov_CKV2_GHA_"]
37
74
  },
38
- CircleCI: {
75
+ circleci: {
39
76
  prefixes: ["Checkov_CKV_CIRCLECIPIPELINES_"]
40
77
  },
41
- "GitLab CI": {
78
+ "gitlab-ci": {
42
79
  prefixes: ["Checkov_CKV_GITLABCI_"]
43
80
  },
44
- "Bitbucket Pipelines": {
81
+ "bitbucket-pipelines": {
45
82
  prefixes: ["Checkov_CKV_BITBUCKETPIPELINES_"]
46
83
  },
47
- "Azure Pipelines": {
84
+ "azure-pipelines": {
48
85
  prefixes: ["Checkov_CKV_AZUREPIPELINES_"]
49
86
  }
50
87
  };
@@ -54,7 +91,13 @@ var descriptor = {
54
91
  id: "Checkov",
55
92
  displayName: "Checkov",
56
93
  preferredVersion: "3.2.508",
57
- languages: ["JSON", "YAML", "Terraform"],
94
+ // `Dockerfile` is not in the tool-level language list Codacy's API reports, but
95
+ // Checkov ships 28 `CKV_DOCKER_` checks and `filePatterns` already routes
96
+ // Dockerfiles here. Without it, a Dockerfile-only repo detects only the
97
+ // `Dockerfile` language, the language gate finds no overlap, and Checkov is not
98
+ // selected at all — so the entire Docker ruleset is dropped from exactly the
99
+ // repo it was written for.
100
+ languages: ["JSON", "YAML", "Terraform", "Dockerfile"],
58
101
  filePatterns: ["**/*.tf", "**/*.yaml", "**/*.yml", "**/*.json", "**/Dockerfile"],
59
102
  supportedOS: ["linux", "darwin", "win32"],
60
103
  supportedArch: ["x64", "arm64"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/tools-checkov-3",
3
- "version": "0.18.0",
3
+ "version": "0.19.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.18.0"
11
+ "@codacy/tooling": "0.19.0"
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Codacy <support@codacy.com> (https://www.codacy.com)",