spaceforge 1.1.6__tar.gz → 1.1.7__tar.gz
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.
- {spaceforge-1.1.6/spaceforge.egg-info → spaceforge-1.1.7}/PKG-INFO +1 -1
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/checkov/plugin.py +58 -60
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/checkov/plugin.yaml +141 -72
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/enviroment_manager/plugin.py +126 -114
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/enviroment_manager/plugin.yaml +126 -114
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/envsubst/plugin.py +26 -26
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/envsubst/plugin.yaml +28 -28
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/infracost/plugin.py +7 -6
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/infracost/plugin.yaml +7 -6
- spaceforge-1.1.7/plugins/opentofu-tracing/plugin.py +443 -0
- spaceforge-1.1.7/plugins/opentofu-tracing/plugin.yaml +719 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/sops/plugin.py +27 -25
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/sops/plugin.yaml +28 -26
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/terrascan/plugin.py +40 -40
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/terrascan/plugin.yaml +93 -43
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/trivy/plugin.py +1 -1
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/trivy/plugin.yaml +17 -17
- spaceforge-1.1.7/plugins/trufflehog/README.md +42 -0
- spaceforge-1.1.7/plugins/trufflehog/plugin.py +285 -0
- spaceforge-1.1.7/plugins/trufflehog/plugin.yaml +454 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/wiz/plugin.py +48 -32
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/wiz/plugin.yaml +49 -33
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/_version_scm.py +3 -3
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/generator.py +4 -2
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/templates/binary_install.sh.j2 +1 -1
- {spaceforge-1.1.6 → spaceforge-1.1.7/spaceforge.egg-info}/PKG-INFO +1 -1
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge.egg-info/SOURCES.txt +3 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/test.sh +4 -4
- spaceforge-1.1.6/plugins/opentofu-tracing/plugin.py +0 -83
- spaceforge-1.1.6/plugins/opentofu-tracing/plugin.yaml +0 -149
- {spaceforge-1.1.6 → spaceforge-1.1.7}/.github/workflows/ci.yml +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/.github/workflows/release.yml +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/.gitignore +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/CONTRIBUTING.md +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/LICENSE +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/MANIFEST.in +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/README.md +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/go.mod +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/checkov/README.md +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/checkov/requirements.txt +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/enviroment_manager/requirements.txt +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/sops/requirements.txt +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/terrascan/README.md +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/plugins/trivy/README.md +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/pyproject.toml +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/regenerate_plugins.sh +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/setup.cfg +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/README.md +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/__init__.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/__main__.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/_version.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/cls.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/conftest.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/plugin.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/runner.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/schema.json +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/templates/ensure_spaceforge_and_run.sh.j2 +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_cls.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_generator.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_generator_binaries.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_generator_core.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_generator_hooks.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_generator_parameters.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_plugin.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_plugin_file_operations.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_plugin_hooks.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_plugin_inheritance.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_runner.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_runner_cli.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_runner_core.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge/test_runner_execution.py +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge.egg-info/dependency_links.txt +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge.egg-info/entry_points.txt +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge.egg-info/requires.txt +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/spaceforge.egg-info/top_level.txt +0 -0
- {spaceforge-1.1.6 → spaceforge-1.1.7}/templates.go +0 -0
|
@@ -1,88 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
This plugin runs Checkov security scanning on Terraform/OpenTofu configurations
|
|
5
|
-
during the after_plan hook and reports findings with detailed resource-level
|
|
6
|
-
information.
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
7
3
|
|
|
8
|
-
|
|
4
|
+
from spaceforge import Context, Parameter, Policy, SpaceforgePlugin, Variable
|
|
9
5
|
|
|
10
|
-
- Executes Checkov against Terraform/OpenTofu configurations
|
|
11
|
-
- Parses and categorizes security findings by severity (when available)
|
|
12
|
-
- Generates detailed Markdown reports organized by severity level
|
|
13
|
-
- Adds scan results to policy input for OPA policy enforcement
|
|
14
|
-
- Supports configurable additional arguments for filtering and customization
|
|
15
6
|
|
|
16
|
-
|
|
7
|
+
class CheckovPlugin(SpaceforgePlugin):
|
|
8
|
+
"""
|
|
9
|
+
Checkov Security Scanner Plugin
|
|
17
10
|
|
|
18
|
-
|
|
11
|
+
This plugin runs Checkov security scanning on Terraform/OpenTofu configurations
|
|
12
|
+
during the after_plan hook and reports findings with detailed resource-level
|
|
13
|
+
information.
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
(e.g., `--check HIGH,CRITICAL` or `--skip-check CKV_AWS_123`)
|
|
15
|
+
## Features
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
- Executes Checkov against Terraform/OpenTofu configurations
|
|
18
|
+
- Parses and categorizes security findings by severity (when available)
|
|
19
|
+
- Generates detailed Markdown reports organized by severity level
|
|
20
|
+
- Adds scan results to policy input for OPA policy enforcement
|
|
21
|
+
- Supports configurable additional arguments for filtering and customization
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
with a Bridgecrew/Prisma Cloud API key. To enable severity data:
|
|
23
|
+
## Configuration
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
--bc-api-key YOUR_API_KEY
|
|
30
|
-
```
|
|
25
|
+
### Parameters
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
- **Additional Arguments**: Optional command-line arguments to pass to Checkov
|
|
28
|
+
(e.g., `--check HIGH,CRITICAL` or `--skip-check CKV_AWS_123`)
|
|
34
29
|
|
|
35
|
-
|
|
30
|
+
### Severity Support
|
|
36
31
|
|
|
37
|
-
|
|
32
|
+
Severity levels (CRITICAL, HIGH, MEDIUM, LOW) are available when using Checkov
|
|
33
|
+
with a Bridgecrew/Prisma Cloud API key. To enable severity data:
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
4. Provides check details, resource names, file locations, and remediation links
|
|
43
|
-
5. Adds comprehensive scan data to policy input for OPA evaluation
|
|
35
|
+
```
|
|
36
|
+
--bc-api-key YOUR_API_KEY
|
|
37
|
+
```
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
Without an API key, the plugin still works but findings are not categorized by
|
|
40
|
+
severity in the report.
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
You can customize the max_critical, max_high, max_medium, and max_low values:
|
|
42
|
+
## Usage
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
package spacelift
|
|
44
|
+
The plugin automatically runs after the plan phase and:
|
|
52
45
|
|
|
53
|
-
|
|
46
|
+
1. Scans your Terraform/OpenTofu code with Checkov
|
|
47
|
+
2. Reports failed security checks in a formatted Markdown report
|
|
48
|
+
3. Organizes findings by severity level (CRITICAL, HIGH, MEDIUM, LOW) when available
|
|
49
|
+
4. Provides check details, resource names, file locations, and remediation links
|
|
50
|
+
5. Adds comprehensive scan data to policy input for OPA evaluation
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
max_critical := 0
|
|
57
|
-
max_high := 0
|
|
58
|
-
max_medium := 50
|
|
59
|
-
max_low := 100
|
|
52
|
+
## Example OPA Policy
|
|
60
53
|
|
|
61
|
-
|
|
54
|
+
An example Plan policy is included that denies runs based on severity thresholds.
|
|
55
|
+
You can customize the max_critical, max_high, max_medium, and max_low values:
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
57
|
+
```rego
|
|
58
|
+
package spacelift
|
|
66
59
|
|
|
67
|
-
|
|
68
|
-
checkov_data.summary.high > max_high
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
"""
|
|
60
|
+
import rego.v1
|
|
72
61
|
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
# Configure maximum allowed findings by severity
|
|
63
|
+
max_critical := 0
|
|
64
|
+
max_high := 0
|
|
65
|
+
max_medium := 50
|
|
66
|
+
max_low := 100
|
|
75
67
|
|
|
76
|
-
|
|
68
|
+
checkov_data := input.third_party_metadata.custom.checkov
|
|
77
69
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
__labels__ = ["security", "terraform"]
|
|
70
|
+
deny contains sprintf("Found %d CRITICAL severity Checkov security checks", [checkov_data.summary.critical]) if {
|
|
71
|
+
checkov_data.summary.critical > max_critical
|
|
72
|
+
}
|
|
82
73
|
|
|
74
|
+
deny contains sprintf("Found %d HIGH severity Checkov security checks", [checkov_data.summary.high]) if {
|
|
75
|
+
checkov_data.summary.high > max_high
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
"""
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
__plugin_name__ = "checkov"
|
|
81
|
+
__author__ = "Spacelift"
|
|
82
|
+
__version__ = "1.0.2"
|
|
83
|
+
__labels__ = ["security", "terraform"]
|
|
86
84
|
|
|
87
85
|
__parameters__ = [
|
|
88
86
|
Parameter(
|
|
@@ -1,8 +1,79 @@
|
|
|
1
|
-
name:
|
|
2
|
-
version: 1.0.
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
name: checkov
|
|
2
|
+
version: 1.0.2
|
|
3
|
+
description: |-
|
|
4
|
+
Checkov Security Scanner Plugin
|
|
5
|
+
|
|
6
|
+
This plugin runs Checkov security scanning on Terraform/OpenTofu configurations
|
|
7
|
+
during the after_plan hook and reports findings with detailed resource-level
|
|
8
|
+
information.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- Executes Checkov against Terraform/OpenTofu configurations
|
|
13
|
+
- Parses and categorizes security findings by severity (when available)
|
|
14
|
+
- Generates detailed Markdown reports organized by severity level
|
|
15
|
+
- Adds scan results to policy input for OPA policy enforcement
|
|
16
|
+
- Supports configurable additional arguments for filtering and customization
|
|
17
|
+
|
|
18
|
+
## Configuration
|
|
19
|
+
|
|
20
|
+
### Parameters
|
|
21
|
+
|
|
22
|
+
- **Additional Arguments**: Optional command-line arguments to pass to Checkov
|
|
23
|
+
(e.g., `--check HIGH,CRITICAL` or `--skip-check CKV_AWS_123`)
|
|
24
|
+
|
|
25
|
+
### Severity Support
|
|
26
|
+
|
|
27
|
+
Severity levels (CRITICAL, HIGH, MEDIUM, LOW) are available when using Checkov
|
|
28
|
+
with a Bridgecrew/Prisma Cloud API key. To enable severity data:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
--bc-api-key YOUR_API_KEY
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Without an API key, the plugin still works but findings are not categorized by
|
|
35
|
+
severity in the report.
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
The plugin automatically runs after the plan phase and:
|
|
40
|
+
|
|
41
|
+
1. Scans your Terraform/OpenTofu code with Checkov
|
|
42
|
+
2. Reports failed security checks in a formatted Markdown report
|
|
43
|
+
3. Organizes findings by severity level (CRITICAL, HIGH, MEDIUM, LOW) when available
|
|
44
|
+
4. Provides check details, resource names, file locations, and remediation links
|
|
45
|
+
5. Adds comprehensive scan data to policy input for OPA evaluation
|
|
46
|
+
|
|
47
|
+
## Example OPA Policy
|
|
48
|
+
|
|
49
|
+
An example Plan policy is included that denies runs based on severity thresholds.
|
|
50
|
+
You can customize the max_critical, max_high, max_medium, and max_low values:
|
|
51
|
+
|
|
52
|
+
```rego
|
|
53
|
+
package spacelift
|
|
54
|
+
|
|
55
|
+
import rego.v1
|
|
56
|
+
|
|
57
|
+
# Configure maximum allowed findings by severity
|
|
58
|
+
max_critical := 0
|
|
59
|
+
max_high := 0
|
|
60
|
+
max_medium := 50
|
|
61
|
+
max_low := 100
|
|
62
|
+
|
|
63
|
+
checkov_data := input.third_party_metadata.custom.checkov
|
|
64
|
+
|
|
65
|
+
deny contains sprintf("Found %d CRITICAL severity Checkov security checks", [checkov_data.summary.critical]) if {
|
|
66
|
+
checkov_data.summary.critical > max_critical
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
deny contains sprintf("Found %d HIGH severity Checkov security checks", [checkov_data.summary.high]) if {
|
|
70
|
+
checkov_data.summary.high > max_high
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
author: Spacelift
|
|
74
|
+
labels:
|
|
75
|
+
- security
|
|
76
|
+
- terraform
|
|
6
77
|
parameters:
|
|
7
78
|
- name: Additional Arguments
|
|
8
79
|
description: Additional command-line arguments to pass to Checkov (e.g., --check HIGH,CRITICAL or --skip-check CKV_AWS_123)
|
|
@@ -18,97 +89,95 @@ contexts:
|
|
|
18
89
|
value_from_parameter: checkov_additional_args
|
|
19
90
|
sensitive: false
|
|
20
91
|
mounted_files:
|
|
21
|
-
- path: /mnt/workspace/plugins/
|
|
92
|
+
- path: /mnt/workspace/plugins/checkov/requirements.txt
|
|
22
93
|
content: |-
|
|
23
94
|
checkov==3.2.489
|
|
24
95
|
sensitive: false
|
|
25
|
-
- path: /mnt/workspace/plugins/
|
|
96
|
+
- path: /mnt/workspace/plugins/checkov/plugin.py
|
|
26
97
|
content: |-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
This plugin runs Checkov security scanning on Terraform/OpenTofu configurations
|
|
31
|
-
during the after_plan hook and reports findings with detailed resource-level
|
|
32
|
-
information.
|
|
98
|
+
import json
|
|
99
|
+
import os
|
|
33
100
|
|
|
34
|
-
|
|
101
|
+
from spaceforge import Context, Parameter, Policy, SpaceforgePlugin, Variable
|
|
35
102
|
|
|
36
|
-
- Executes Checkov against Terraform/OpenTofu configurations
|
|
37
|
-
- Parses and categorizes security findings by severity (when available)
|
|
38
|
-
- Generates detailed Markdown reports organized by severity level
|
|
39
|
-
- Adds scan results to policy input for OPA policy enforcement
|
|
40
|
-
- Supports configurable additional arguments for filtering and customization
|
|
41
103
|
|
|
42
|
-
|
|
104
|
+
class CheckovPlugin(SpaceforgePlugin):
|
|
105
|
+
"""
|
|
106
|
+
Checkov Security Scanner Plugin
|
|
43
107
|
|
|
44
|
-
|
|
108
|
+
This plugin runs Checkov security scanning on Terraform/OpenTofu configurations
|
|
109
|
+
during the after_plan hook and reports findings with detailed resource-level
|
|
110
|
+
information.
|
|
45
111
|
|
|
46
|
-
|
|
47
|
-
(e.g., `--check HIGH,CRITICAL` or `--skip-check CKV_AWS_123`)
|
|
112
|
+
## Features
|
|
48
113
|
|
|
49
|
-
|
|
114
|
+
- Executes Checkov against Terraform/OpenTofu configurations
|
|
115
|
+
- Parses and categorizes security findings by severity (when available)
|
|
116
|
+
- Generates detailed Markdown reports organized by severity level
|
|
117
|
+
- Adds scan results to policy input for OPA policy enforcement
|
|
118
|
+
- Supports configurable additional arguments for filtering and customization
|
|
50
119
|
|
|
51
|
-
|
|
52
|
-
with a Bridgecrew/Prisma Cloud API key. To enable severity data:
|
|
120
|
+
## Configuration
|
|
53
121
|
|
|
54
|
-
|
|
55
|
-
--bc-api-key YOUR_API_KEY
|
|
56
|
-
```
|
|
122
|
+
### Parameters
|
|
57
123
|
|
|
58
|
-
|
|
59
|
-
|
|
124
|
+
- **Additional Arguments**: Optional command-line arguments to pass to Checkov
|
|
125
|
+
(e.g., `--check HIGH,CRITICAL` or `--skip-check CKV_AWS_123`)
|
|
60
126
|
|
|
61
|
-
|
|
127
|
+
### Severity Support
|
|
62
128
|
|
|
63
|
-
|
|
129
|
+
Severity levels (CRITICAL, HIGH, MEDIUM, LOW) are available when using Checkov
|
|
130
|
+
with a Bridgecrew/Prisma Cloud API key. To enable severity data:
|
|
64
131
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
4. Provides check details, resource names, file locations, and remediation links
|
|
69
|
-
5. Adds comprehensive scan data to policy input for OPA evaluation
|
|
132
|
+
```
|
|
133
|
+
--bc-api-key YOUR_API_KEY
|
|
134
|
+
```
|
|
70
135
|
|
|
71
|
-
|
|
136
|
+
Without an API key, the plugin still works but findings are not categorized by
|
|
137
|
+
severity in the report.
|
|
72
138
|
|
|
73
|
-
|
|
74
|
-
You can customize the max_critical, max_high, max_medium, and max_low values:
|
|
139
|
+
## Usage
|
|
75
140
|
|
|
76
|
-
|
|
77
|
-
package spacelift
|
|
141
|
+
The plugin automatically runs after the plan phase and:
|
|
78
142
|
|
|
79
|
-
|
|
143
|
+
1. Scans your Terraform/OpenTofu code with Checkov
|
|
144
|
+
2. Reports failed security checks in a formatted Markdown report
|
|
145
|
+
3. Organizes findings by severity level (CRITICAL, HIGH, MEDIUM, LOW) when available
|
|
146
|
+
4. Provides check details, resource names, file locations, and remediation links
|
|
147
|
+
5. Adds comprehensive scan data to policy input for OPA evaluation
|
|
80
148
|
|
|
81
|
-
|
|
82
|
-
max_critical := 0
|
|
83
|
-
max_high := 0
|
|
84
|
-
max_medium := 50
|
|
85
|
-
max_low := 100
|
|
149
|
+
## Example OPA Policy
|
|
86
150
|
|
|
87
|
-
|
|
151
|
+
An example Plan policy is included that denies runs based on severity thresholds.
|
|
152
|
+
You can customize the max_critical, max_high, max_medium, and max_low values:
|
|
88
153
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
154
|
+
```rego
|
|
155
|
+
package spacelift
|
|
92
156
|
|
|
93
|
-
|
|
94
|
-
checkov_data.summary.high > max_high
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
"""
|
|
157
|
+
import rego.v1
|
|
98
158
|
|
|
99
|
-
|
|
100
|
-
|
|
159
|
+
# Configure maximum allowed findings by severity
|
|
160
|
+
max_critical := 0
|
|
161
|
+
max_high := 0
|
|
162
|
+
max_medium := 50
|
|
163
|
+
max_low := 100
|
|
101
164
|
|
|
102
|
-
|
|
165
|
+
checkov_data := input.third_party_metadata.custom.checkov
|
|
103
166
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
__labels__ = ["security", "terraform"]
|
|
167
|
+
deny contains sprintf("Found %d CRITICAL severity Checkov security checks", [checkov_data.summary.critical]) if {
|
|
168
|
+
checkov_data.summary.critical > max_critical
|
|
169
|
+
}
|
|
108
170
|
|
|
171
|
+
deny contains sprintf("Found %d HIGH severity Checkov security checks", [checkov_data.summary.high]) if {
|
|
172
|
+
checkov_data.summary.high > max_high
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
"""
|
|
109
176
|
|
|
110
|
-
|
|
111
|
-
|
|
177
|
+
__plugin_name__ = "checkov"
|
|
178
|
+
__author__ = "Spacelift"
|
|
179
|
+
__version__ = "1.0.2"
|
|
180
|
+
__labels__ = ["security", "terraform"]
|
|
112
181
|
|
|
113
182
|
__parameters__ = [
|
|
114
183
|
Parameter(
|
|
@@ -371,13 +440,13 @@ contexts:
|
|
|
371
440
|
self.logger.error(f"Plugin failed: {e}")
|
|
372
441
|
exit(1)
|
|
373
442
|
sensitive: false
|
|
374
|
-
- path: /mnt/workspace/plugins/
|
|
443
|
+
- path: /mnt/workspace/plugins/checkov/after_plan.sh
|
|
375
444
|
content: |-
|
|
376
445
|
#!/bin/sh
|
|
377
446
|
|
|
378
447
|
set -e
|
|
379
448
|
|
|
380
|
-
cd /mnt/workspace/plugins/
|
|
449
|
+
cd /mnt/workspace/plugins/checkov
|
|
381
450
|
|
|
382
451
|
if [ ! -d "./venv" ]; then
|
|
383
452
|
python -m venv --system-site-packages ./venv
|
|
@@ -394,13 +463,13 @@ contexts:
|
|
|
394
463
|
fi
|
|
395
464
|
|
|
396
465
|
cd /mnt/workspace/source/$TF_VAR_spacelift_project_root
|
|
397
|
-
python -m spaceforge run --plugin-file /mnt/workspace/plugins/
|
|
466
|
+
python -m spaceforge run --plugin-file /mnt/workspace/plugins/checkov/plugin.py after_plan
|
|
398
467
|
sensitive: false
|
|
399
468
|
hooks:
|
|
400
469
|
before_init:
|
|
401
|
-
- mkdir -p /mnt/workspace/plugins/
|
|
470
|
+
- mkdir -p /mnt/workspace/plugins/checkov
|
|
402
471
|
after_plan:
|
|
403
|
-
- chmod +x /mnt/workspace/plugins/
|
|
472
|
+
- chmod +x /mnt/workspace/plugins/checkov/after_plan.sh && /mnt/workspace/plugins/checkov/after_plan.sh
|
|
404
473
|
policies:
|
|
405
474
|
- name_prefix: checkov
|
|
406
475
|
type: PLAN
|