spaceforge 1.1.6__tar.gz → 1.2.0__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.
Files changed (80) hide show
  1. {spaceforge-1.1.6/spaceforge.egg-info → spaceforge-1.2.0}/PKG-INFO +2 -1
  2. spaceforge-1.2.0/linting/__init__.py +1 -0
  3. spaceforge-1.2.0/linting/spaceforge_checker.py +75 -0
  4. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/checkov/plugin.py +58 -61
  5. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/checkov/plugin.yaml +140 -73
  6. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/enviroment_manager/plugin.py +127 -114
  7. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/enviroment_manager/plugin.yaml +129 -115
  8. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/envsubst/plugin.py +25 -26
  9. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/envsubst/plugin.yaml +27 -29
  10. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/infracost/plugin.py +8 -6
  11. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/infracost/plugin.yaml +9 -6
  12. spaceforge-1.2.0/plugins/opentofu-tracing/plugin.py +449 -0
  13. spaceforge-1.2.0/plugins/opentofu-tracing/plugin.yaml +731 -0
  14. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/sops/plugin.py +26 -26
  15. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/sops/plugin.yaml +27 -29
  16. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/terrascan/plugin.py +42 -42
  17. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/terrascan/plugin.yaml +95 -46
  18. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/trivy/plugin.py +4 -4
  19. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/trivy/plugin.yaml +22 -23
  20. spaceforge-1.2.0/plugins/trufflehog/README.md +42 -0
  21. spaceforge-1.2.0/plugins/trufflehog/plugin.py +285 -0
  22. spaceforge-1.2.0/plugins/trufflehog/plugin.yaml +454 -0
  23. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/wiz/plugin.py +49 -33
  24. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/wiz/plugin.yaml +52 -36
  25. {spaceforge-1.1.6 → spaceforge-1.2.0}/pyproject.toml +16 -1
  26. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/_version_scm.py +3 -3
  27. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/cls.py +31 -3
  28. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/conftest.py +1 -0
  29. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/generator.py +4 -2
  30. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/schema.json +21 -2
  31. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/templates/binary_install.sh.j2 +1 -1
  32. spaceforge-1.2.0/spaceforge/test_cls.py +102 -0
  33. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_generator.py +6 -1
  34. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_generator_parameters.py +2 -0
  35. {spaceforge-1.1.6 → spaceforge-1.2.0/spaceforge.egg-info}/PKG-INFO +2 -1
  36. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge.egg-info/SOURCES.txt +6 -0
  37. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge.egg-info/requires.txt +1 -0
  38. {spaceforge-1.1.6 → spaceforge-1.2.0}/test.sh +19 -5
  39. spaceforge-1.2.0/validate_plugins.py +70 -0
  40. spaceforge-1.1.6/plugins/opentofu-tracing/plugin.py +0 -83
  41. spaceforge-1.1.6/plugins/opentofu-tracing/plugin.yaml +0 -149
  42. spaceforge-1.1.6/spaceforge/test_cls.py +0 -17
  43. {spaceforge-1.1.6 → spaceforge-1.2.0}/.github/workflows/ci.yml +0 -0
  44. {spaceforge-1.1.6 → spaceforge-1.2.0}/.github/workflows/release.yml +0 -0
  45. {spaceforge-1.1.6 → spaceforge-1.2.0}/.gitignore +0 -0
  46. {spaceforge-1.1.6 → spaceforge-1.2.0}/CONTRIBUTING.md +0 -0
  47. {spaceforge-1.1.6 → spaceforge-1.2.0}/LICENSE +0 -0
  48. {spaceforge-1.1.6 → spaceforge-1.2.0}/MANIFEST.in +0 -0
  49. {spaceforge-1.1.6 → spaceforge-1.2.0}/README.md +0 -0
  50. {spaceforge-1.1.6 → spaceforge-1.2.0}/go.mod +0 -0
  51. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/checkov/README.md +0 -0
  52. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/checkov/requirements.txt +0 -0
  53. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/enviroment_manager/requirements.txt +0 -0
  54. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/sops/requirements.txt +0 -0
  55. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/terrascan/README.md +0 -0
  56. {spaceforge-1.1.6 → spaceforge-1.2.0}/plugins/trivy/README.md +0 -0
  57. {spaceforge-1.1.6 → spaceforge-1.2.0}/regenerate_plugins.sh +0 -0
  58. {spaceforge-1.1.6 → spaceforge-1.2.0}/setup.cfg +0 -0
  59. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/README.md +0 -0
  60. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/__init__.py +0 -0
  61. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/__main__.py +0 -0
  62. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/_version.py +0 -0
  63. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/plugin.py +0 -0
  64. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/runner.py +0 -0
  65. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/templates/ensure_spaceforge_and_run.sh.j2 +0 -0
  66. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_generator_binaries.py +0 -0
  67. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_generator_core.py +0 -0
  68. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_generator_hooks.py +0 -0
  69. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_plugin.py +0 -0
  70. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_plugin_file_operations.py +0 -0
  71. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_plugin_hooks.py +0 -0
  72. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_plugin_inheritance.py +0 -0
  73. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_runner.py +0 -0
  74. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_runner_cli.py +0 -0
  75. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_runner_core.py +0 -0
  76. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge/test_runner_execution.py +0 -0
  77. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge.egg-info/dependency_links.txt +0 -0
  78. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge.egg-info/entry_points.txt +0 -0
  79. {spaceforge-1.1.6 → spaceforge-1.2.0}/spaceforge.egg-info/top_level.txt +0 -0
  80. {spaceforge-1.1.6 → spaceforge-1.2.0}/templates.go +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spaceforge
3
- Version: 1.1.6
3
+ Version: 1.2.0
4
4
  Summary: A Python framework for building Spacelift plugins
5
5
  Author-email: Spacelift <support@spacelift.io>
6
6
  Maintainer-email: Spacelift <support@spacelift.io>
@@ -34,6 +34,7 @@ Requires-Dist: pytest-cov; extra == "dev"
34
34
  Requires-Dist: black; extra == "dev"
35
35
  Requires-Dist: isort; extra == "dev"
36
36
  Requires-Dist: mypy; extra == "dev"
37
+ Requires-Dist: pylint; extra == "dev"
37
38
  Requires-Dist: types-PyYAML; extra == "dev"
38
39
  Requires-Dist: setuptools-scm[toml]>=6.2; extra == "dev"
39
40
  Requires-Dist: autoflake; extra == "dev"
@@ -0,0 +1 @@
1
+ """Custom linting tools for Spaceforge plugins."""
@@ -0,0 +1,75 @@
1
+ """Custom pylint checker for Spaceforge plugin conventions."""
2
+
3
+ import os
4
+ from typing import TYPE_CHECKING
5
+
6
+ from pylint.checkers import BaseChecker
7
+
8
+ if TYPE_CHECKING:
9
+ from pylint.lint import PyLinter
10
+
11
+
12
+ class SpaceforgePluginChecker(BaseChecker):
13
+ """Checker for Spaceforge plugin naming conventions."""
14
+
15
+ name = "spaceforge-plugin"
16
+ msgs = {
17
+ "E9001": (
18
+ "Plugin name '%s' should start with a capital letter",
19
+ "plugin-name-not-capitalized",
20
+ "The __plugin_name__ attribute must start with a capital letter for consistency.",
21
+ ),
22
+ "E9002": (
23
+ "Plugin class '%s' must have a docstring",
24
+ "plugin-missing-docstring",
25
+ "All plugin classes extending SpaceforgePlugin must have a docstring explaining what the plugin does.",
26
+ ),
27
+ }
28
+
29
+ def visit_classdef(self, node):
30
+ """Check class definitions that extend SpaceforgePlugin."""
31
+ # Skip test files
32
+ filename = os.path.basename(node.root().file)
33
+ if filename.startswith("test_") or filename == "conftest.py":
34
+ return
35
+
36
+ # Check if this class extends SpaceforgePlugin
37
+ if not any(
38
+ base.name == "SpaceforgePlugin"
39
+ for base in node.bases
40
+ if hasattr(base, "name")
41
+ ):
42
+ return
43
+
44
+ # Check if the plugin class has a docstring
45
+ # In astroid, docstrings are stored in the doc_node attribute
46
+ if not node.doc_node:
47
+ self.add_message(
48
+ "plugin-missing-docstring",
49
+ node=node,
50
+ args=(node.name,),
51
+ )
52
+
53
+ # Look for __plugin_name__ attribute in the class body
54
+ for item in node.body:
55
+ if (
56
+ hasattr(item, "targets")
57
+ and len(item.targets) == 1
58
+ and hasattr(item.targets[0], "name")
59
+ and item.targets[0].name == "__plugin_name__"
60
+ ):
61
+ # Get the value of __plugin_name__
62
+ if hasattr(item.value, "value") and isinstance(item.value.value, str):
63
+ plugin_name = item.value.value
64
+ if plugin_name and not plugin_name[0].isupper():
65
+ self.add_message(
66
+ "plugin-name-not-capitalized",
67
+ node=item,
68
+ args=(plugin_name,),
69
+ )
70
+ break
71
+
72
+
73
+ def register(linter: "PyLinter") -> None:
74
+ """Register the checker with pylint."""
75
+ linter.register_checker(SpaceforgePluginChecker(linter))
@@ -1,88 +1,84 @@
1
- """
2
- Checkov Security Scanner Plugin
1
+ import json
2
+ import os
3
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.
4
+ from spaceforge import Context, Parameter, Policy, SpaceforgePlugin, Variable
7
5
 
8
- ## Features
9
6
 
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
7
+ class CheckovPlugin(SpaceforgePlugin):
8
+ """
9
+ This plugin runs Checkov security scanning on Terraform/OpenTofu configurations
10
+ during the after_plan hook and reports findings with detailed resource-level
11
+ information.
15
12
 
16
- ## Configuration
13
+ ## Features
17
14
 
18
- ### Parameters
15
+ - Executes Checkov against Terraform/OpenTofu configurations
16
+ - Parses and categorizes security findings by severity (when available)
17
+ - Generates detailed Markdown reports organized by severity level
18
+ - Adds scan results to policy input for OPA policy enforcement
19
+ - Supports configurable additional arguments for filtering and customization
19
20
 
20
- - **Additional Arguments**: Optional command-line arguments to pass to Checkov
21
- (e.g., `--check HIGH,CRITICAL` or `--skip-check CKV_AWS_123`)
21
+ ## Configuration
22
22
 
23
- ### Severity Support
23
+ ### Parameters
24
24
 
25
- Severity levels (CRITICAL, HIGH, MEDIUM, LOW) are available when using Checkov
26
- with a Bridgecrew/Prisma Cloud API key. To enable severity data:
25
+ - **Additional Arguments**: Optional command-line arguments to pass to Checkov
26
+ (e.g., `--check HIGH,CRITICAL` or `--skip-check CKV_AWS_123`)
27
27
 
28
- ```
29
- --bc-api-key YOUR_API_KEY
30
- ```
28
+ ### Severity Support
31
29
 
32
- Without an API key, the plugin still works but findings are not categorized by
33
- severity in the report.
30
+ Severity levels (CRITICAL, HIGH, MEDIUM, LOW) are available when using Checkov
31
+ with a Bridgecrew/Prisma Cloud API key. To enable severity data:
34
32
 
35
- ## Usage
33
+ ```
34
+ --bc-api-key YOUR_API_KEY
35
+ ```
36
36
 
37
- The plugin automatically runs after the plan phase and:
37
+ Without an API key, the plugin still works but findings are not categorized by
38
+ severity in the report.
38
39
 
39
- 1. Scans your Terraform/OpenTofu code with Checkov
40
- 2. Reports failed security checks in a formatted Markdown report
41
- 3. Organizes findings by severity level (CRITICAL, HIGH, MEDIUM, LOW) when available
42
- 4. Provides check details, resource names, file locations, and remediation links
43
- 5. Adds comprehensive scan data to policy input for OPA evaluation
40
+ ## Usage
44
41
 
45
- ## Example OPA Policy
42
+ The plugin automatically runs after the plan phase and:
46
43
 
47
- An example Plan policy is included that denies runs based on severity thresholds.
48
- You can customize the max_critical, max_high, max_medium, and max_low values:
44
+ 1. Scans your Terraform/OpenTofu code with Checkov
45
+ 2. Reports failed security checks in a formatted Markdown report
46
+ 3. Organizes findings by severity level (CRITICAL, HIGH, MEDIUM, LOW) when available
47
+ 4. Provides check details, resource names, file locations, and remediation links
48
+ 5. Adds comprehensive scan data to policy input for OPA evaluation
49
49
 
50
- ```rego
51
- package spacelift
50
+ ## Example OPA Policy
52
51
 
53
- import rego.v1
52
+ An example Plan policy is included that denies runs based on severity thresholds.
53
+ You can customize the max_critical, max_high, max_medium, and max_low values:
54
54
 
55
- # Configure maximum allowed findings by severity
56
- max_critical := 0
57
- max_high := 0
58
- max_medium := 50
59
- max_low := 100
55
+ ```rego
56
+ package spacelift
60
57
 
61
- checkov_data := input.third_party_metadata.custom.checkov
58
+ import rego.v1
62
59
 
63
- deny contains sprintf("Found %d CRITICAL severity Checkov security checks", [checkov_data.summary.critical]) if {
64
- checkov_data.summary.critical > max_critical
65
- }
60
+ # Configure maximum allowed findings by severity
61
+ max_critical := 0
62
+ max_high := 0
63
+ max_medium := 50
64
+ max_low := 100
66
65
 
67
- deny contains sprintf("Found %d HIGH severity Checkov security checks", [checkov_data.summary.high]) if {
68
- checkov_data.summary.high > max_high
69
- }
70
- ```
71
- """
66
+ checkov_data := input.third_party_metadata.custom.checkov
72
67
 
73
- import json
74
- import os
75
-
76
- from spaceforge import Context, Parameter, Policy, SpaceforgePlugin, Variable
68
+ deny contains sprintf("Found %d CRITICAL severity Checkov security checks", [checkov_data.summary.critical]) if {
69
+ checkov_data.summary.critical > max_critical
70
+ }
77
71
 
78
- __plugin_name__ = "checkov"
79
- __author__ = "Spacelift"
80
- __version__ = "1.0.1"
81
- __labels__ = ["security", "terraform"]
72
+ deny contains sprintf("Found %d HIGH severity Checkov security checks", [checkov_data.summary.high]) if {
73
+ checkov_data.summary.high > max_high
74
+ }
75
+ ```
76
+ """
82
77
 
83
-
84
- class CheckovPlugin(SpaceforgePlugin):
85
- """Checkov security scanner plugin for Spacelift."""
78
+ __plugin_name__ = "Checkov"
79
+ __author__ = "Spacelift"
80
+ __version__ = "1.0.3"
81
+ __labels__ = ["security", "terraform"]
86
82
 
87
83
  __parameters__ = [
88
84
  Parameter(
@@ -90,6 +86,7 @@ class CheckovPlugin(SpaceforgePlugin):
90
86
  id="checkov_additional_args",
91
87
  description="Additional command-line arguments to pass to Checkov (e.g., --check HIGH,CRITICAL or --skip-check CKV_AWS_123)",
92
88
  default="",
89
+ type="string",
93
90
  required=False,
94
91
  )
95
92
  ]
@@ -1,11 +1,81 @@
1
- name: SpaceforgePlugin
2
- version: 1.0.0
3
- description: Checkov security scanner plugin for Spacelift.
4
- author: Spacelift Team
5
- labels: []
1
+ name: Checkov
2
+ version: 1.0.3
3
+ description: |-
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.
7
+
8
+ ## Features
9
+
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
+
16
+ ## Configuration
17
+
18
+ ### Parameters
19
+
20
+ - **Additional Arguments**: Optional command-line arguments to pass to Checkov
21
+ (e.g., `--check HIGH,CRITICAL` or `--skip-check CKV_AWS_123`)
22
+
23
+ ### Severity Support
24
+
25
+ Severity levels (CRITICAL, HIGH, MEDIUM, LOW) are available when using Checkov
26
+ with a Bridgecrew/Prisma Cloud API key. To enable severity data:
27
+
28
+ ```
29
+ --bc-api-key YOUR_API_KEY
30
+ ```
31
+
32
+ Without an API key, the plugin still works but findings are not categorized by
33
+ severity in the report.
34
+
35
+ ## Usage
36
+
37
+ The plugin automatically runs after the plan phase and:
38
+
39
+ 1. Scans your Terraform/OpenTofu code with Checkov
40
+ 2. Reports failed security checks in a formatted Markdown report
41
+ 3. Organizes findings by severity level (CRITICAL, HIGH, MEDIUM, LOW) when available
42
+ 4. Provides check details, resource names, file locations, and remediation links
43
+ 5. Adds comprehensive scan data to policy input for OPA evaluation
44
+
45
+ ## Example OPA Policy
46
+
47
+ An example Plan policy is included that denies runs based on severity thresholds.
48
+ You can customize the max_critical, max_high, max_medium, and max_low values:
49
+
50
+ ```rego
51
+ package spacelift
52
+
53
+ import rego.v1
54
+
55
+ # Configure maximum allowed findings by severity
56
+ max_critical := 0
57
+ max_high := 0
58
+ max_medium := 50
59
+ max_low := 100
60
+
61
+ checkov_data := input.third_party_metadata.custom.checkov
62
+
63
+ deny contains sprintf("Found %d CRITICAL severity Checkov security checks", [checkov_data.summary.critical]) if {
64
+ checkov_data.summary.critical > max_critical
65
+ }
66
+
67
+ deny contains sprintf("Found %d HIGH severity Checkov security checks", [checkov_data.summary.high]) if {
68
+ checkov_data.summary.high > max_high
69
+ }
70
+ ```
71
+ author: Spacelift
72
+ labels:
73
+ - security
74
+ - terraform
6
75
  parameters:
7
76
  - name: Additional Arguments
8
77
  description: Additional command-line arguments to pass to Checkov (e.g., --check HIGH,CRITICAL or --skip-check CKV_AWS_123)
78
+ type: string
9
79
  sensitive: false
10
80
  required: false
11
81
  default: ''
@@ -18,97 +88,93 @@ contexts:
18
88
  value_from_parameter: checkov_additional_args
19
89
  sensitive: false
20
90
  mounted_files:
21
- - path: /mnt/workspace/plugins/spaceforgeplugin/requirements.txt
91
+ - path: /mnt/workspace/plugins/checkov/requirements.txt
22
92
  content: |-
23
93
  checkov==3.2.489
24
94
  sensitive: false
25
- - path: /mnt/workspace/plugins/spaceforgeplugin/plugin.py
95
+ - path: /mnt/workspace/plugins/checkov/plugin.py
26
96
  content: |-
27
- """
28
- Checkov Security Scanner Plugin
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.
33
-
34
- ## Features
97
+ import json
98
+ import os
35
99
 
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
100
+ from spaceforge import Context, Parameter, Policy, SpaceforgePlugin, Variable
41
101
 
42
- ## Configuration
43
102
 
44
- ### Parameters
103
+ class CheckovPlugin(SpaceforgePlugin):
104
+ """
105
+ This plugin runs Checkov security scanning on Terraform/OpenTofu configurations
106
+ during the after_plan hook and reports findings with detailed resource-level
107
+ information.
45
108
 
46
- - **Additional Arguments**: Optional command-line arguments to pass to Checkov
47
- (e.g., `--check HIGH,CRITICAL` or `--skip-check CKV_AWS_123`)
109
+ ## Features
48
110
 
49
- ### Severity Support
111
+ - Executes Checkov against Terraform/OpenTofu configurations
112
+ - Parses and categorizes security findings by severity (when available)
113
+ - Generates detailed Markdown reports organized by severity level
114
+ - Adds scan results to policy input for OPA policy enforcement
115
+ - Supports configurable additional arguments for filtering and customization
50
116
 
51
- Severity levels (CRITICAL, HIGH, MEDIUM, LOW) are available when using Checkov
52
- with a Bridgecrew/Prisma Cloud API key. To enable severity data:
117
+ ## Configuration
53
118
 
54
- ```
55
- --bc-api-key YOUR_API_KEY
56
- ```
119
+ ### Parameters
57
120
 
58
- Without an API key, the plugin still works but findings are not categorized by
59
- severity in the report.
121
+ - **Additional Arguments**: Optional command-line arguments to pass to Checkov
122
+ (e.g., `--check HIGH,CRITICAL` or `--skip-check CKV_AWS_123`)
60
123
 
61
- ## Usage
124
+ ### Severity Support
62
125
 
63
- The plugin automatically runs after the plan phase and:
126
+ Severity levels (CRITICAL, HIGH, MEDIUM, LOW) are available when using Checkov
127
+ with a Bridgecrew/Prisma Cloud API key. To enable severity data:
64
128
 
65
- 1. Scans your Terraform/OpenTofu code with Checkov
66
- 2. Reports failed security checks in a formatted Markdown report
67
- 3. Organizes findings by severity level (CRITICAL, HIGH, MEDIUM, LOW) when available
68
- 4. Provides check details, resource names, file locations, and remediation links
69
- 5. Adds comprehensive scan data to policy input for OPA evaluation
129
+ ```
130
+ --bc-api-key YOUR_API_KEY
131
+ ```
70
132
 
71
- ## Example OPA Policy
133
+ Without an API key, the plugin still works but findings are not categorized by
134
+ severity in the report.
72
135
 
73
- An example Plan policy is included that denies runs based on severity thresholds.
74
- You can customize the max_critical, max_high, max_medium, and max_low values:
136
+ ## Usage
75
137
 
76
- ```rego
77
- package spacelift
138
+ The plugin automatically runs after the plan phase and:
78
139
 
79
- import rego.v1
140
+ 1. Scans your Terraform/OpenTofu code with Checkov
141
+ 2. Reports failed security checks in a formatted Markdown report
142
+ 3. Organizes findings by severity level (CRITICAL, HIGH, MEDIUM, LOW) when available
143
+ 4. Provides check details, resource names, file locations, and remediation links
144
+ 5. Adds comprehensive scan data to policy input for OPA evaluation
80
145
 
81
- # Configure maximum allowed findings by severity
82
- max_critical := 0
83
- max_high := 0
84
- max_medium := 50
85
- max_low := 100
146
+ ## Example OPA Policy
86
147
 
87
- checkov_data := input.third_party_metadata.custom.checkov
148
+ An example Plan policy is included that denies runs based on severity thresholds.
149
+ You can customize the max_critical, max_high, max_medium, and max_low values:
88
150
 
89
- deny contains sprintf("Found %d CRITICAL severity Checkov security checks", [checkov_data.summary.critical]) if {
90
- checkov_data.summary.critical > max_critical
91
- }
151
+ ```rego
152
+ package spacelift
92
153
 
93
- deny contains sprintf("Found %d HIGH severity Checkov security checks", [checkov_data.summary.high]) if {
94
- checkov_data.summary.high > max_high
95
- }
96
- ```
97
- """
154
+ import rego.v1
98
155
 
99
- import json
100
- import os
156
+ # Configure maximum allowed findings by severity
157
+ max_critical := 0
158
+ max_high := 0
159
+ max_medium := 50
160
+ max_low := 100
101
161
 
102
- from spaceforge import Context, Parameter, Policy, SpaceforgePlugin, Variable
162
+ checkov_data := input.third_party_metadata.custom.checkov
103
163
 
104
- __plugin_name__ = "checkov"
105
- __author__ = "Spacelift"
106
- __version__ = "1.0.1"
107
- __labels__ = ["security", "terraform"]
164
+ deny contains sprintf("Found %d CRITICAL severity Checkov security checks", [checkov_data.summary.critical]) if {
165
+ checkov_data.summary.critical > max_critical
166
+ }
108
167
 
168
+ deny contains sprintf("Found %d HIGH severity Checkov security checks", [checkov_data.summary.high]) if {
169
+ checkov_data.summary.high > max_high
170
+ }
171
+ ```
172
+ """
109
173
 
110
- class CheckovPlugin(SpaceforgePlugin):
111
- """Checkov security scanner plugin for Spacelift."""
174
+ __plugin_name__ = "Checkov"
175
+ __author__ = "Spacelift"
176
+ __version__ = "1.0.3"
177
+ __labels__ = ["security", "terraform"]
112
178
 
113
179
  __parameters__ = [
114
180
  Parameter(
@@ -116,6 +182,7 @@ contexts:
116
182
  id="checkov_additional_args",
117
183
  description="Additional command-line arguments to pass to Checkov (e.g., --check HIGH,CRITICAL or --skip-check CKV_AWS_123)",
118
184
  default="",
185
+ type="string",
119
186
  required=False,
120
187
  )
121
188
  ]
@@ -371,13 +438,13 @@ contexts:
371
438
  self.logger.error(f"Plugin failed: {e}")
372
439
  exit(1)
373
440
  sensitive: false
374
- - path: /mnt/workspace/plugins/spaceforgeplugin/after_plan.sh
441
+ - path: /mnt/workspace/plugins/checkov/after_plan.sh
375
442
  content: |-
376
443
  #!/bin/sh
377
444
 
378
445
  set -e
379
446
 
380
- cd /mnt/workspace/plugins/spaceforgeplugin
447
+ cd /mnt/workspace/plugins/checkov
381
448
 
382
449
  if [ ! -d "./venv" ]; then
383
450
  python -m venv --system-site-packages ./venv
@@ -394,13 +461,13 @@ contexts:
394
461
  fi
395
462
 
396
463
  cd /mnt/workspace/source/$TF_VAR_spacelift_project_root
397
- python -m spaceforge run --plugin-file /mnt/workspace/plugins/spaceforgeplugin/plugin.py after_plan
464
+ python -m spaceforge run --plugin-file /mnt/workspace/plugins/checkov/plugin.py after_plan
398
465
  sensitive: false
399
466
  hooks:
400
467
  before_init:
401
- - mkdir -p /mnt/workspace/plugins/spaceforgeplugin
468
+ - mkdir -p /mnt/workspace/plugins/checkov
402
469
  after_plan:
403
- - chmod +x /mnt/workspace/plugins/spaceforgeplugin/after_plan.sh && /mnt/workspace/plugins/spaceforgeplugin/after_plan.sh
470
+ - chmod +x /mnt/workspace/plugins/checkov/after_plan.sh && /mnt/workspace/plugins/checkov/after_plan.sh
404
471
  policies:
405
472
  - name_prefix: checkov
406
473
  type: PLAN