-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into go2rego-azure-1
- Loading branch information
Showing
86 changed files
with
1,751 additions
and
1,118 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
avd_docs/github/branchprotections/AVD-GIT-0004/Terraform.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
Require signed commits | ||
|
||
```hcl | ||
resource "github_branch_protection" "good_example" { | ||
repository_id = "example" | ||
pattern = "main" | ||
require_signed_commits = true | ||
} | ||
``` | ||
|
||
#### Remediation Links | ||
- https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_protection | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
GitHub branch protection should be set to require signed commits. | ||
|
||
You can do this by setting the <code>require_signed_commits</code> attribute to 'true'. | ||
|
||
|
||
### Impact | ||
<!-- Add Impact here --> | ||
|
||
<!-- DO NOT CHANGE --> | ||
{{ remediationActions }} | ||
|
||
### Links | ||
- https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_protection#require_signed_commits | ||
|
||
- https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification | ||
|
||
- https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#require-signed-commits | ||
|
||
|
18 changes: 18 additions & 0 deletions
18
avd_docs/github/environmentsecrets/AVD-GIT-0002/Terraform.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
Do not store plaintext values in your code but rather populate the encrypted_value using fields from a resource, data source or variable. | ||
|
||
```hcl | ||
resource "github_actions_environment_secret" "good_example" { | ||
repository = "my repository name" | ||
environment = "my environment" | ||
secret_name = "my secret name" | ||
encrypted_value = var.some_encrypted_secret_string | ||
} | ||
``` | ||
|
||
#### Remediation Links | ||
- https://registry.terraform.io/providers/integrations/github/latest/docs/resources/actions_environment_secret | ||
|
||
- https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
For the purposes of security, the contents of the plaintext_value field have been marked as sensitive to Terraform, but this does not hide it from state files. State should be treated as sensitive always. | ||
|
||
|
||
### Impact | ||
<!-- Add Impact here --> | ||
|
||
<!-- DO NOT CHANGE --> | ||
{{ remediationActions }} | ||
|
||
### Links | ||
- https://registry.terraform.io/providers/integrations/github/latest/docs/resources/actions_environment_secret | ||
|
||
- https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
checks/cloud/github/actions/no_plain_text_action_secrets.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# METADATA | ||
# title: Ensure plaintext value is not used for GitHub Action Environment Secret. | ||
# description: | | ||
# For the purposes of security, the contents of the plaintext_value field have been marked as sensitive to Terraform, but this does not hide it from state files. State should be treated as sensitive always. | ||
# scope: package | ||
# schemas: | ||
# - input: schema["cloud"] | ||
# related_resources: | ||
# - https://registry.terraform.io/providers/integrations/github/latest/docs/resources/actions_environment_secret | ||
# - https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions | ||
# custom: | ||
# id: AVD-GIT-0002 | ||
# avd_id: AVD-GIT-0002 | ||
# provider: github | ||
# service: environmentsecrets | ||
# severity: HIGH | ||
# short_code: no-plain-text-action-secrets | ||
# recommended_action: Do not store plaintext values in your code but rather populate the encrypted_value using fields from a resource, data source or variable. | ||
# input: | ||
# selector: | ||
# - type: cloud | ||
# subtypes: | ||
# - service: environmentsecrets | ||
# provider: github | ||
# terraform: | ||
# links: | ||
# - https://registry.terraform.io/providers/integrations/github/latest/docs/resources/actions_environment_secret | ||
# - https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions | ||
# good_examples: checks/cloud/github/actions/no_plain_text_action_secrets.tf.go | ||
# bad_examples: checks/cloud/github/actions/no_plain_text_action_secrets.tf.go | ||
package builtin.github.actions.github0002 | ||
|
||
import rego.v1 | ||
|
||
deny contains res if { | ||
some secret in input.github.environmentsecrets | ||
secret.plaintextvalue.value != "" | ||
res := result.new("Secret has plain text value", secret.plaintextvalue) | ||
} |
61 changes: 0 additions & 61 deletions
61
checks/cloud/github/actions/no_plain_text_action_secrets_test.go
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
checks/cloud/github/actions/no_plain_text_action_secrets_test.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package builtin.github.actions.github0002_test | ||
|
||
import rego.v1 | ||
|
||
import data.builtin.github.actions.github0002 as check | ||
import data.lib.test | ||
|
||
test_allow_secret_without_plain_text if { | ||
inp := {"github": {"environmentsecrets": [{"plaintextvalue": {"value": ""}}]}} | ||
|
||
res := check.deny with input as inp | ||
res == set() | ||
} | ||
|
||
test_deny_secret_with_plain_text if { | ||
inp := {"github": {"environmentsecrets": [{"plaintextvalue": {"value": "secret"}}]}} | ||
|
||
res := check.deny with input as inp | ||
count(res) == 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.