Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bucket policy for ec2 instance #7724

Closed
wants to merge 4 commits into from
Closed

add bucket policy for ec2 instance #7724

wants to merge 4 commits into from

Conversation

ASTRobinson
Copy link
Contributor

work in progress

@github-actions github-actions bot added the environments-repository Used to exclude PRs from this repo in our Slack PR update label Sep 10, 2024
Copy link
Contributor

Trivy Scan Success

Show Output ```hcl

Trivy will check the following folders:
terraform/environments/panda-cyber-appsec-lab


Running Trivy in terraform/environments/panda-cyber-appsec-lab
2024-09-10T15:53:36Z INFO [db] Need to update DB
2024-09-10T15:53:36Z INFO [db] Downloading DB... repository="ghcr.io/aquasecurity/trivy-db:2"
2024-09-10T15:53:38Z INFO [vuln] Vulnerability scanning is enabled
2024-09-10T15:53:38Z INFO [misconfig] Misconfiguration scanning is enabled
2024-09-10T15:53:38Z INFO Need to update the built-in policies
2024-09-10T15:53:38Z INFO Downloading the built-in policies...
74.86 KiB / 74.86 KiB [-----------------------------------------------------------] 100.00% ? p/s 0s2024-09-10T15:53:39Z INFO [secret] Secret scanning is enabled
2024-09-10T15:53:39Z INFO [secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-09-10T15:53:39Z INFO [secret] Please see also https://aquasecurity.github.io/trivy/v0.55/docs/scanner/secret#recommendation for faster secret detection
2024-09-10T15:53:39Z INFO [terraform scanner] Scanning root module file_path="."
2024-09-10T15:53:39Z WARN [terraform parser] Variable values was not found in the environment or variable files. Evaluating may not work correctly. module="root" variables="networking"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T15:53:40Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T15:53:40Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-public-egress-sgr" range="ec2.tf:73"
2024-09-10T15:53:40Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:322"
2024-09-10T15:53:40Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:339"
2024-09-10T15:53:40Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-public-ingress-acl" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:323"
2024-09-10T15:53:40Z INFO [terraform executor] Ignore finding rule="aws-s3-enable-bucket-encryption" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T15:53:40Z INFO [terraform executor] Ignore finding rule="aws-s3-enable-versioning" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T15:53:40Z INFO [terraform executor] Ignore finding rule="aws-s3-encryption-customer-key" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:150-160"
2024-09-10T15:53:40Z INFO Number of language-specific files num=0
2024-09-10T15:53:40Z INFO Detected config files num=6
trivy_exitcode=0

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:
terraform/environments/panda-cyber-appsec-lab

*****************************

Running Checkov in terraform/environments/panda-cyber-appsec-lab
Excluding the following checks: CKV_GIT_1,CKV_AWS_126,CKV2_AWS_38,CKV2_AWS_39
2024-09-10 15:53:43,250 [MainThread  ] [WARNI]  Failed to download module github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595:None (for external modules, the --download-external-modules flag is required)
2024-09-10 15:53:43,250 [MainThread  ] [WARNI]  Failed to download module github.com/terraform-aws-modules/terraform-aws-vpc//modules/vpc-endpoints?ref=25322b6b6be69db6cca7f167d7b0e5327156a595:None (for external modules, the --download-external-modules flag is required)
2024-09-10 15:53:43,250 [MainThread  ] [WARNI]  Failed to download module github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9:None (for external modules, the --download-external-modules flag is required)
terraform scan results:

Passed checks: 55, Failed checks: 0, Skipped checks: 4


checkov_exitcode=0

CTFLint Scan Failed

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:
terraform/environments/panda-cyber-appsec-lab

*****************************

Running tflint in terraform/environments/panda-cyber-appsec-lab
Excluding the following checks: terraform_unused_declarations
2 issue(s) found:

Warning: [Fixable] Interpolation-only expressions are deprecated in Terraform v0.12.14 (terraform_deprecated_interpolation)

  on terraform/environments/panda-cyber-appsec-lab/ec2.tf line 117:
 117:           "${module.s3-bucket.bucket_arn}",

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.5.0/docs/rules/terraform_deprecated_interpolation.md

Warning: [Fixable] Interpolation-only expressions are deprecated in Terraform v0.12.14 (terraform_deprecated_interpolation)

  on terraform/environments/panda-cyber-appsec-lab/ec2.tf line 215:
 215:       "${module.s3-bucket.bucket_arn}",

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.5.0/docs/rules/terraform_deprecated_interpolation.md

tflint_exitcode=2

Trivy Scan Success

Show Output
*****************************

Trivy will check the following folders:
terraform/environments/panda-cyber-appsec-lab

*****************************

Running Trivy in terraform/environments/panda-cyber-appsec-lab
2024-09-10T15:53:36Z	INFO	[db] Need to update DB
2024-09-10T15:53:36Z	INFO	[db] Downloading DB...	repository="ghcr.io/aquasecurity/trivy-db:2"
2024-09-10T15:53:38Z	INFO	[vuln] Vulnerability scanning is enabled
2024-09-10T15:53:38Z	INFO	[misconfig] Misconfiguration scanning is enabled
2024-09-10T15:53:38Z	INFO	Need to update the built-in policies
2024-09-10T15:53:38Z	INFO	Downloading the built-in policies...
74.86 KiB / 74.86 KiB [-----------------------------------------------------------] 100.00% ? p/s 0s2024-09-10T15:53:39Z	INFO	[secret] Secret scanning is enabled
2024-09-10T15:53:39Z	INFO	[secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-09-10T15:53:39Z	INFO	[secret] Please see also https://aquasecurity.github.io/trivy/v0.55/docs/scanner/secret#recommendation for faster secret detection
2024-09-10T15:53:39Z	INFO	[terraform scanner] Scanning root module	file_path="."
2024-09-10T15:53:39Z	WARN	[terraform parser] Variable values was not found in the environment or variable files. Evaluating may not work correctly.	module="root" variables="networking"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T15:53:40Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T15:53:40Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-public-egress-sgr" range="ec2.tf:73"
2024-09-10T15:53:40Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:322"
2024-09-10T15:53:40Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:339"
2024-09-10T15:53:40Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-public-ingress-acl" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:323"
2024-09-10T15:53:40Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-enable-bucket-encryption" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T15:53:40Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-enable-versioning" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T15:53:40Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-encryption-customer-key" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:150-160"
2024-09-10T15:53:40Z	INFO	Number of language-specific files	num=0
2024-09-10T15:53:40Z	INFO	Detected config files	num=6
trivy_exitcode=0

@ASTRobinson ASTRobinson had a problem deploying to panda-cyber-appsec-lab-development September 10, 2024 16:03 — with GitHub Actions Error
Copy link
Contributor

Trivy Scan Success

Show Output ```hcl

Trivy will check the following folders:
terraform/environments/panda-cyber-appsec-lab


Running Trivy in terraform/environments/panda-cyber-appsec-lab
2024-09-10T16:04:12Z INFO [db] Need to update DB
2024-09-10T16:04:12Z INFO [db] Downloading DB... repository="ghcr.io/aquasecurity/trivy-db:2"
2024-09-10T16:04:14Z INFO [vuln] Vulnerability scanning is enabled
2024-09-10T16:04:14Z INFO [misconfig] Misconfiguration scanning is enabled
2024-09-10T16:04:14Z INFO Need to update the built-in policies
2024-09-10T16:04:14Z INFO Downloading the built-in policies...
74.86 KiB / 74.86 KiB [-----------------------------------------------------------] 100.00% ? p/s 0s2024-09-10T16:04:14Z INFO [secret] Secret scanning is enabled
2024-09-10T16:04:14Z INFO [secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-09-10T16:04:14Z INFO [secret] Please see also https://aquasecurity.github.io/trivy/v0.55/docs/scanner/secret#recommendation for faster secret detection
2024-09-10T16:04:15Z INFO [terraform scanner] Scanning root module file_path="."
2024-09-10T16:04:15Z WARN [terraform parser] Variable values was not found in the environment or variable files. Evaluating may not work correctly. module="root" variables="networking"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T16:04:16Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T16:04:16Z INFO [terraform executor] Ignore finding rule="aws-s3-enable-bucket-encryption" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T16:04:16Z INFO [terraform executor] Ignore finding rule="aws-s3-enable-versioning" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T16:04:16Z INFO [terraform executor] Ignore finding rule="aws-s3-encryption-customer-key" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:150-160"
2024-09-10T16:04:16Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:322"
2024-09-10T16:04:16Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:339"
2024-09-10T16:04:16Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-public-egress-sgr" range="ec2.tf:73"
2024-09-10T16:04:16Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-public-ingress-acl" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:323"
2024-09-10T16:04:16Z INFO Number of language-specific files num=0
2024-09-10T16:04:16Z INFO Detected config files num=6
trivy_exitcode=0

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:
terraform/environments/panda-cyber-appsec-lab

*****************************

Running Checkov in terraform/environments/panda-cyber-appsec-lab
Excluding the following checks: CKV_GIT_1,CKV_AWS_126,CKV2_AWS_38,CKV2_AWS_39
2024-09-10 16:04:18,737 [MainThread  ] [WARNI]  Failed to download module github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595:None (for external modules, the --download-external-modules flag is required)
2024-09-10 16:04:18,737 [MainThread  ] [WARNI]  Failed to download module github.com/terraform-aws-modules/terraform-aws-vpc//modules/vpc-endpoints?ref=25322b6b6be69db6cca7f167d7b0e5327156a595:None (for external modules, the --download-external-modules flag is required)
2024-09-10 16:04:18,737 [MainThread  ] [WARNI]  Failed to download module github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9:None (for external modules, the --download-external-modules flag is required)
terraform scan results:

Passed checks: 55, Failed checks: 0, Skipped checks: 4


checkov_exitcode=0

CTFLint Scan Failed

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:
terraform/environments/panda-cyber-appsec-lab

*****************************

Running tflint in terraform/environments/panda-cyber-appsec-lab
Excluding the following checks: terraform_unused_declarations
2 issue(s) found:

Warning: [Fixable] Interpolation-only expressions are deprecated in Terraform v0.12.14 (terraform_deprecated_interpolation)

  on terraform/environments/panda-cyber-appsec-lab/ec2.tf line 117:
 117:           "${module.s3-bucket.bucket.arn}",

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.5.0/docs/rules/terraform_deprecated_interpolation.md

Warning: [Fixable] Interpolation-only expressions are deprecated in Terraform v0.12.14 (terraform_deprecated_interpolation)

  on terraform/environments/panda-cyber-appsec-lab/ec2.tf line 215:
 215:       "${module.s3-bucket.bucket.arn}",

Reference: https://github.com/terraform-linters/tflint-ruleset-terraform/blob/v0.5.0/docs/rules/terraform_deprecated_interpolation.md

tflint_exitcode=2

Trivy Scan Success

Show Output
*****************************

Trivy will check the following folders:
terraform/environments/panda-cyber-appsec-lab

*****************************

Running Trivy in terraform/environments/panda-cyber-appsec-lab
2024-09-10T16:04:12Z	INFO	[db] Need to update DB
2024-09-10T16:04:12Z	INFO	[db] Downloading DB...	repository="ghcr.io/aquasecurity/trivy-db:2"
2024-09-10T16:04:14Z	INFO	[vuln] Vulnerability scanning is enabled
2024-09-10T16:04:14Z	INFO	[misconfig] Misconfiguration scanning is enabled
2024-09-10T16:04:14Z	INFO	Need to update the built-in policies
2024-09-10T16:04:14Z	INFO	Downloading the built-in policies...
74.86 KiB / 74.86 KiB [-----------------------------------------------------------] 100.00% ? p/s 0s2024-09-10T16:04:14Z	INFO	[secret] Secret scanning is enabled
2024-09-10T16:04:14Z	INFO	[secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-09-10T16:04:14Z	INFO	[secret] Please see also https://aquasecurity.github.io/trivy/v0.55/docs/scanner/secret#recommendation for faster secret detection
2024-09-10T16:04:15Z	INFO	[terraform scanner] Scanning root module	file_path="."
2024-09-10T16:04:15Z	WARN	[terraform parser] Variable values was not found in the environment or variable files. Evaluating may not work correctly.	module="root" variables="networking"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T16:04:16Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T16:04:16Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-enable-bucket-encryption" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T16:04:16Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-enable-versioning" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T16:04:16Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-encryption-customer-key" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:150-160"
2024-09-10T16:04:16Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:322"
2024-09-10T16:04:16Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:339"
2024-09-10T16:04:16Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-public-egress-sgr" range="ec2.tf:73"
2024-09-10T16:04:16Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-public-ingress-acl" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:323"
2024-09-10T16:04:16Z	INFO	Number of language-specific files	num=0
2024-09-10T16:04:16Z	INFO	Detected config files	num=6
trivy_exitcode=0

Copy link
Contributor

Trivy Scan Success

Show Output ```hcl

Trivy will check the following folders:
terraform/environments/panda-cyber-appsec-lab


Running Trivy in terraform/environments/panda-cyber-appsec-lab
2024-09-10T16:14:15Z INFO [db] Need to update DB
2024-09-10T16:14:15Z INFO [db] Downloading DB... repository="ghcr.io/aquasecurity/trivy-db:2"
2024-09-10T16:14:17Z INFO [vuln] Vulnerability scanning is enabled
2024-09-10T16:14:17Z INFO [misconfig] Misconfiguration scanning is enabled
2024-09-10T16:14:17Z INFO Need to update the built-in policies
2024-09-10T16:14:17Z INFO Downloading the built-in policies...
74.86 KiB / 74.86 KiB [-----------------------------------------------------------] 100.00% ? p/s 0s2024-09-10T16:14:18Z INFO [secret] Secret scanning is enabled
2024-09-10T16:14:18Z INFO [secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-09-10T16:14:18Z INFO [secret] Please see also https://aquasecurity.github.io/trivy/v0.55/docs/scanner/secret#recommendation for faster secret detection
2024-09-10T16:14:18Z INFO [terraform scanner] Scanning root module file_path="."
2024-09-10T16:14:18Z WARN [terraform parser] Variable values was not found in the environment or variable files. Evaluating may not work correctly. module="root" variables="networking"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T16:14:20Z ERROR [terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable. block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T16:14:20Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:322"
2024-09-10T16:14:20Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:339"
2024-09-10T16:14:20Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-public-ingress-acl" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:323"
2024-09-10T16:14:20Z INFO [terraform executor] Ignore finding rule="aws-s3-enable-bucket-encryption" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T16:14:20Z INFO [terraform executor] Ignore finding rule="aws-s3-enable-versioning" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T16:14:20Z INFO [terraform executor] Ignore finding rule="aws-s3-encryption-customer-key" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:150-160"
2024-09-10T16:14:20Z INFO [terraform executor] Ignore finding rule="aws-ec2-no-public-egress-sgr" range="ec2.tf:73"
2024-09-10T16:14:20Z INFO Number of language-specific files num=0
2024-09-10T16:14:20Z INFO Detected config files num=6
trivy_exitcode=0

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:
terraform/environments/panda-cyber-appsec-lab

*****************************

Running Checkov in terraform/environments/panda-cyber-appsec-lab
Excluding the following checks: CKV_GIT_1,CKV_AWS_126,CKV2_AWS_38,CKV2_AWS_39
2024-09-10 16:14:23,320 [MainThread  ] [WARNI]  Failed to download module github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595:None (for external modules, the --download-external-modules flag is required)
2024-09-10 16:14:23,320 [MainThread  ] [WARNI]  Failed to download module github.com/terraform-aws-modules/terraform-aws-vpc//modules/vpc-endpoints?ref=25322b6b6be69db6cca7f167d7b0e5327156a595:None (for external modules, the --download-external-modules flag is required)
2024-09-10 16:14:23,320 [MainThread  ] [WARNI]  Failed to download module github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9:None (for external modules, the --download-external-modules flag is required)
terraform scan results:

Passed checks: 55, Failed checks: 0, Skipped checks: 4


checkov_exitcode=0

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.5.0)
tflint will check the following folders:
terraform/environments/panda-cyber-appsec-lab

*****************************

Running tflint in terraform/environments/panda-cyber-appsec-lab
Excluding the following checks: terraform_unused_declarations
tflint_exitcode=0

Trivy Scan Success

Show Output
*****************************

Trivy will check the following folders:
terraform/environments/panda-cyber-appsec-lab

*****************************

Running Trivy in terraform/environments/panda-cyber-appsec-lab
2024-09-10T16:14:15Z	INFO	[db] Need to update DB
2024-09-10T16:14:15Z	INFO	[db] Downloading DB...	repository="ghcr.io/aquasecurity/trivy-db:2"
2024-09-10T16:14:17Z	INFO	[vuln] Vulnerability scanning is enabled
2024-09-10T16:14:17Z	INFO	[misconfig] Misconfiguration scanning is enabled
2024-09-10T16:14:17Z	INFO	Need to update the built-in policies
2024-09-10T16:14:17Z	INFO	Downloading the built-in policies...
74.86 KiB / 74.86 KiB [-----------------------------------------------------------] 100.00% ? p/s 0s2024-09-10T16:14:18Z	INFO	[secret] Secret scanning is enabled
2024-09-10T16:14:18Z	INFO	[secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-09-10T16:14:18Z	INFO	[secret] Please see also https://aquasecurity.github.io/trivy/v0.55/docs/scanner/secret#recommendation for faster secret detection
2024-09-10T16:14:18Z	INFO	[terraform scanner] Scanning root module	file_path="."
2024-09-10T16:14:18Z	WARN	[terraform parser] Variable values was not found in the environment or variable files. Evaluating may not work correctly.	module="root" variables="networking"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.expiration" value="cty.NilVal"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.transition" value="cty.NilVal"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_expiration" value="cty.NilVal"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.noncurrent_version_transition" value="cty.NilVal"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.principals" value="cty.NilVal"
2024-09-10T16:14:20Z	ERROR	[terraform evaluator] Failed to expand block. Invalid "for-each" argument. Must be known and iterable.	block="module.s3-bucket.dynamic.condition" value="cty.NilVal"
2024-09-10T16:14:20Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:322"
2024-09-10T16:14:20Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-excessive-port-access" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:339"
2024-09-10T16:14:20Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-public-ingress-acl" range="github.com/terraform-aws-modules/terraform-aws-vpc?ref=25322b6b6be69db6cca7f167d7b0e5327156a595/main.tf:323"
2024-09-10T16:14:20Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-enable-bucket-encryption" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T16:14:20Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-enable-versioning" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:16-27"
2024-09-10T16:14:20Z	INFO	[terraform executor] Ignore finding	rule="aws-s3-encryption-customer-key" range="github.com/ministryofjustice/modernisation-platform-terraform-s3-bucket?ref=4e17731f72ef24b804207f55b182f49057e73ec9/main.tf:150-160"
2024-09-10T16:14:20Z	INFO	[terraform executor] Ignore finding	rule="aws-ec2-no-public-egress-sgr" range="ec2.tf:73"
2024-09-10T16:14:20Z	INFO	Number of language-specific files	num=0
2024-09-10T16:14:20Z	INFO	Detected config files	num=6
trivy_exitcode=0

@jodiejones-moj
Copy link
Contributor

Closing as this was just a draft PR

@ASTRobinson ASTRobinson deleted the panda/s3-policy branch September 17, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
environments-repository Used to exclude PRs from this repo in our Slack PR update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants