Skip to content

Commit 4c2834c

Browse files
sanyam803Sanyam Vikram
andauthored
usage documentation update (#20)
Update documentation to reflect private launch scope & postures submitted currently. --------- Co-authored-by: Sanyam Vikram <sanyamv@google.com>
1 parent dca407d commit 4c2834c

1 file changed

Lines changed: 97 additions & 84 deletions

File tree

README.md

Lines changed: 97 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,48 @@
11
# analyze-code-security-scc
22

3+
34
## Description
45

5-
This Github action identifies insecure configurations in Infrastructure as Code (IaC) files for Google Cloud resources.
6-
This action requires Terraform plan files in JSON format for scanning.
6+
7+
This GitHub action identifies insecure configurations in Infrastructure as Code (IaC) files for Google Cloud resources. This action requires Terraform plan files in JSON format for scanning.
8+
79

810
Use this action to detect and remediate issues in IaC files for Google Cloud before you deploy the resources.
911

12+
1013
This action lets you:
1114
- Scan IaC template files (such as Terraform plan files).
1215
- Display issues with their severity as a SARIF Report in the GitHub Workspace after a scan completes.
1316
- Define severity-based failure criteria for passing or failing the build.
1417

15-
> [!NOTE]
16-
> This is a Security Command Center Premium tier offering for subscription customers only. You must activate the Security Command Center Premium tier in the Google Cloud organization to use this feature.
17-
1818
**This is not an officially supported Google product, and it is not covered by a
1919
Google Cloud support contract. To report bugs or request features in a Google
2020
Cloud product, please contact [Google Cloud
2121
support](https://cloud.google.com/support).**
2222

23+
> [!IMPORTANT]
24+
> This is a Security Command Center Premium tier offering for subscription customers only. You must activate the Security Command Center Premium tier in the Google Cloud organization to use this feature.
25+
>
26+
> This offering is covered by the Pre-GA Offerings Terms of the Google Cloud Terms of Service.
27+
28+
> [!CAUTION]
29+
> Don’t enter any sensitive information such as passwords and other personal identifiable information in the Terraform plan files.
30+
2331
## Prerequisites
2432

25-
- This action requires a Google Cloud service account which has the
26-
**Security Posture Shift-Left Validator** role or the **Security
27-
Posture Admin** role on the Google Cloud organization that includes
28-
the IaC resources. For more information, see [Authorization](#authorization).
2933

30-
- This action runs using Node 20. If you are using self-hosted GitHub Actions
31-
runners, you must use a [runner
32-
version](https://github.com/actions/virtual-environments) that supports this
33-
version or later.
34+
* This action requires a Google Cloud service account which has the **Security Posture Shift-Left Validator** role or the **Security Posture Admin** role on the Google Cloud organization that includes the IaC resources. For more information, see [Authorization](#authorization).
35+
36+
37+
* This action runs using Node 20. If you are using self-hosted GitHub Actions
38+
runners, you must use a [runner
39+
version](https://github.com/actions/virtual-environments) that supports this
40+
version or later.
41+
3442

3543
## Usage
3644

45+
3746
```yaml
3847
jobs:
3948
job_id:
@@ -42,108 +51,112 @@ jobs:
4251
id-token: 'write'
4352

4453
steps:
45-
- uses: 'actions/checkout@v4'
46-
- id: 'auth'
47-
uses: 'google-github-actions/auth@v2'
48-
with:
49-
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
50-
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
51-
52-
- id: 'analyze-code-security-scc'
53-
uses: 'google-github-actions/analyze-code-security-scc@v1'
54-
with:
55-
organization_id: '123456789'
56-
scan_file_ref: './tf_plan.json'
57-
iac_type: 'terraform'
58-
iac_version: '1.0.0'
59-
scan_timeout: '1m'
60-
ignore_violations: false
61-
failure_criteria: 'High:1,Medium:1,Low:1,Operator:OR'
62-
fail_silently: true
63-
64-
- if: ${{ steps.analyze-code-security-scc.outputs.iac_scan_result_sarif_path != '' }}
54+
- uses: 'actions/checkout@v4'
55+
- id: 'auth'
56+
uses: 'google-github-actions/auth@v2'
57+
with:
58+
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
59+
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
60+
61+
- id: 'analyze-code-security-scc'
62+
uses: 'google-github-actions/analyze-code-security-scc@v0'
63+
with:
64+
organization_id: '123456789'
65+
scan_file_ref: './tf_plan.json'
66+
iac_type: 'terraform'
67+
iac_version: '1.0.0'
68+
scan_timeout: '1m'
69+
ignore_violations: false
70+
failure_criteria: 'High:1,Medium:1,Low:1,Operator:or'
71+
fail_silently: false
72+
73+
- if: |-
74+
steps.analyze-code-security-scc.outputs.iac_scan_result_sarif_path != ''
6575
uses: 'actions/upload-artifact@v4'
6676
with:
6777
name: 'sarif'
6878
path: '${{ steps.analyze-code-security-scc.outputs.iac_scan_result_sarif_path }}'
6979
```
7080
81+
82+
83+
7184
## Inputs
7285
73-
- `organization_id`: (Required) The Google Cloud organization ID for the
74-
organization which includes the resources that you want to modify.
7586
76-
- `scan_file_ref`: (Required) The absolute file path, including the file name,
77-
for the IaC file in the workspace. For example: './tf_plan.json', or
78-
'./artifacts/tf_plan.json'.
87+
* `organization_id`: (Required) The Google Cloud organization ID for the organization which includes the resources that you want to modify.
88+
89+
90+
* `scan_file_ref`: (Required) The absolute file path, including the file name, for the IaC file in the workspace. For example: './tf_plan.json', or './artifacts/tf_plan.json'.
91+
92+
93+
* `iac_type`: (Required) The IaC template type. Currently only Terraform is supported.
7994

80-
- `iac_type`: (Required) The IaC template type. Currently only Terraform is
81-
supported.
8295

83-
- `iac_version`: (Required) The IaC template version. For example: '1.6.6',
84-
or '1.6.5'.
96+
* `iac_version`: (Required) The IaC template version. For example: '1.6.6', or '1.6.5'.
8597

86-
- `scan_timeout`: (Optional) The maximum time before the action stops.
87-
The time must be between '1m' and '10m'. The default is `1m`.
8898

89-
- `ignore_violations`: (Optional) Whether violations found in IaC file
90-
should be ignored when determining the build status. This input doesn’t
91-
apply to violations that are related to generating SARIF reports and
92-
determining the `iac_scan_result`. The default is `false`.
99+
* `scan_time_out`: (Optional) The maximum time before the action stops. The time must be between '1m' and '10m'. The default is `1m`.
93100

94-
- `failure_criteria`: (Optional) The failure criteria that determines the
95-
workflow build status. You can set a threshold for the number of critical,
96-
high, medium, and low severity issues and use an aggregator (either `and`
97-
or `or`) to evaluate the criteria. To determine whether a build has failed,
98-
the threshold for each severity is evaluated against the count of issues
99-
with that severity in the IaC scan results and then severity level evaluations
100-
are aggregated using `AND` or `OR` to arrive at `failure_criteria` value.
101101

102-
If the `failure_criteria` evaluates to `true`, the workflow is marked as
103-
`FAILED`. Otherwise, the workflow is marked as `SUCCESS`. The default is
104-
"Critical:1, High:1, Medium:1, Low:1, Operator:OR".
102+
* `ignore_violations`: (Optional) Whether violations found in IaC file should be ignored when determining the build status. This input doesn’t apply to violations that are related to generating SARIF reports and determining the `iac_scan_result`. The default is `false`.
103+
104+
105+
* `failure_criteria`: (Optional) The failure criteria that determines the workflow build status. You can set a threshold for the number of critical, high, medium, and low severity issues and use an aggregator (either `and` or `or`) to evaluate the criteria. To determine whether a build has failed, the threshold for each severity is evaluated against the count of issues with that severity in the IaC scan results and then severity level evaluations are aggregated using `AND` or `OR` to arrive at `failure_criteria` value.
106+
107+
108+
If the `failure_criteria` evaluates to `true`, the workflow is marked as `FAILED`. Otherwise, the workflow is marked as `SUCCESS`. The default is "Critical:1, High:1, Medium:1, Low:1, Operator:or".
109+
110+
111+
* `fail_silently`: (Optional) Whether the workflow passes when an internal error (such as an invalid credential or plugin dependency failure) occurs. Note: The action always fails when the input is invalid. The default is `false`.
105112

106-
- `fail_silently`: (Optional) If set to true, workflow will not fail in case
107-
of any internal error including invalid credentials and plugin dependency
108-
failure. Note: Action will always fail in case of any input validation
109-
failure. Default: false.
110113

111114
## Outputs
112115

113-
- `iac_scan_result`: The result of the security scan. One of:
114116

115-
1. `passed` - No violations were found or the `failure_criteria` was not
116-
satisfied.
117-
2. `failed` - The `failure_criteria` was satisfied.
118-
3. `error` - The action ran into an execution error, generally
119-
due to a misconfiguration or invalid credentials.
117+
* `iac_scan_result`: The result of the security scan. One of:
118+
1. `passed` - No violations were found or the `failure_criteria` was not satisfied.
119+
2. `failed` - The `failure_criteria` was satisfied.
120+
3. `error` - The action ran into an execution error, generally due to a misconfiguration or invalid credentials.
121+
122+
123+
* `iac_scan_result_sarif_path`: The path for the SARIF report file. This file is only available when violations are found in the scan file.
120124

121-
- `iac_scan_result_sarif_path`: The path for the SARIF report file. This
122-
file is only available when violations are found in the scan file.
123125

124126
## Authorization
125127

128+
126129
Use [google-github-actions/auth](https://github.com/google-github-actions/auth)
127130
to authenticate the action. You can use [Workload Identity Federation][wif] or
128-
traditional [Service Account Key JSON][sa] for authentication.
131+
[Service account key JSON][sa] for authentication.
132+
129133

130134
```yaml
131135
jobs:
132-
job_id:
133-
permissions:
134-
contents: 'read'
135-
id-token: 'write'
136+
job_id:
137+
permissions:
138+
contents: 'read'
139+
id-token: 'write'
136140
137-
steps:
138-
- id: 'auth'
139-
uses: 'google-github-actions/auth@v2'
140-
with:
141-
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
142-
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
143-
144-
- id: 'analyze-code-security-scc'
145-
uses: 'google-github-actions/analyze-code-security-scc@v1'
141+
142+
steps:
143+
- id: 'auth'
144+
uses: 'google-github-actions/auth@v2'
145+
with:
146+
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
147+
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'
148+
149+
150+
- id: 'analyze-code-security-scc'
151+
uses: 'google-github-actions/analyze-code-security-scc@v0'
146152
```
147153

154+
155+
## Supported asset types and policies
156+
157+
158+
For information about supported asset types and policies, see [IaC Validation - Supported assets and policies](https://www.gstatic.com/cloud_security_posture/iac_validation_supported_assets_and_policies.pdf).
159+
160+
148161
[sa]: https://cloud.google.com/iam/docs/creating-managing-service-accounts
149162
[wif]: https://cloud.google.com/iam/docs/workload-identity-federation

0 commit comments

Comments
 (0)