Repository: aquasecurity/tfsec
Pull request #974 (2021-07-29 20:01:19)

Fix publish docs script


Patch:
diff --git a/.github/workflows/doc_release.yml b/.github/workflows/doc_release.yml
deleted file mode 100644
index d20f8e9b9..000000000
--- a/.github/workflows/doc_release.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: tfsec documentation
-on:
-  push:
-    tags:
-      - 'v*.*.*'
-
-jobs:
-  build:
-    name: releasing tfsec documentation
-    runs-on: ubuntu-latest
-
-    steps:
-    - uses: actions/checkout@v2
-    
-    - uses: actions/setup-go@v2
-      with:
-        stable: 'false'
-        go-version: '1.16.2' # The Go version to download (if necessary) and use.
-    - run: go version
-
-    - name: Release Docs
-      run: make publish-docs
-      env:
-          DOCS_GITHUB_TOKEN: ${{ secrets.DOCS_GITHUB_TOKEN }}
-  
\ No newline at end of file
diff --git a/internal/app/tfsec/rules/aws/apigateway/enable_cache_encryption_rule.go b/internal/app/tfsec/rules/aws/apigateway/enable_cache_encryption_rule.go
index fd55da23f..30923e34a 100644
--- a/internal/app/tfsec/rules/aws/apigateway/enable_cache_encryption_rule.go
+++ b/internal/app/tfsec/rules/aws/apigateway/enable_cache_encryption_rule.go
@@ -16,15 +16,15 @@ import (
 
 func init() {
 	scanner.RegisterCheckRule(rule.Rule{
-		Provider:       provider.AWSProvider,
-		Service:   "apigateway",
+		Provider:  provider.AWSProvider,
+		Service:   "api-gateway",
 		ShortCode: "enable-cache-encryption",
 		Documentation: rule.RuleDocumentation{
 			Summary:     "API Gateway must have cache enabled",
 			Explanation: `Method cache encryption ensures that any sensitive data in the cache is not vulnerable to compromise in the event of interception`,
 			Impact:      "Data stored in the cache that is unencrypted may be vulnerable to compromise",
 			Resolution:  "Enable cache encryption",
-			BadExample: []string{  `
+			BadExample: []string{`
 resource "aws_api_gateway_method_settings" "bad_example" {
   rest_api_id = aws_api_gateway_rest_api.example.id
   stage_name  = aws_api_gateway_stage.example.stage_name
@@ -37,7 +37,7 @@ resource "aws_api_gateway_method_settings" "bad_example" {
   }
 }
 `},
-			GoodExample: []string{ `
+			GoodExample: []string{`
 resource "aws_api_gateway_method_settings" "good_example" {
   rest_api_id = aws_api_gateway_rest_api.example.id
   stage_name  = aws_api_gateway_stage.example.stage_name
@@ -54,14 +54,14 @@ resource "aws_api_gateway_method_settings" "good_example" {
 				"https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_method_settings#cache_data_encrypted",
 			},
 		},
-		RequiredTypes:  []string{ 
+		RequiredTypes: []string{
 			"resource",
 		},
-		RequiredLabels: []string{ 
+		RequiredLabels: []string{
 			"aws_api_gateway_method_settings",
 		},
-		DefaultSeverity: severity.Medium, 
-		CheckFunc: func(set result.Set, resourceBlock block.Block, _ *hclcontext.Context){
+		DefaultSeverity: severity.Medium,
+		CheckFunc: func(set result.Set, resourceBlock block.Block, _ *hclcontext.Context) {
 			if cacheDataEncryptedAttr := resourceBlock.GetBlock("settings").GetAttribute("cache_data_encrypted"); cacheDataEncryptedAttr.IsNil() { // alert on use of default value
 				set.AddResult().
 					WithDescription("Resource '%s' uses default value for settings.cache_data_encrypted", resourceBlock.FullName())
diff --git a/scripts/publish-docs.sh b/scripts/publish-docs.sh
index 68d9584e2..2b4c81d77 100755
--- a/scripts/publish-docs.sh
+++ b/scripts/publish-docs.sh
@@ -26,7 +26,7 @@ clone_site
 go run ./cmd/tfsec-docs
 cp -r checkdocs/docs/* ./_site/_docs/
 cp -r checkdocs/data/* ./_site/_data/
-cp =r checkdocs/codes.json ./_site/assets/codes.json
+cp -r checkdocs/codes.json ./_site/assets/codes.json
 deploy
 
 rm -rf checkdocs


Test patch:
diff --git a/internal/app/tfsec/rules/aws/apigateway/enable_cache_encryption_rule_test.go b/internal/app/tfsec/rules/aws/apigateway/enable_cache_encryption_rule_test.go
index e0f09cd57..3d32f8c7e 100644
--- a/internal/app/tfsec/rules/aws/apigateway/enable_cache_encryption_rule_test.go
+++ b/internal/app/tfsec/rules/aws/apigateway/enable_cache_encryption_rule_test.go
@@ -9,7 +9,7 @@ import (
 )
 
 func Test_AWSEnableCacheEncryption_FailureExamples(t *testing.T) {
-	expectedCode := "aws-apigateway-enable-cache-encryption"
+	expectedCode := "aws-api-gateway-enable-cache-encryption"
 
 	rule, err := scanner.GetRuleById(expectedCode)
 	if err != nil {
@@ -31,7 +31,7 @@ func Test_AWSEnableCacheEncryption_FailureExamples(t *testing.T) {
 }
 
 func Test_AWSEnableCacheEncryption_SuccessExamples(t *testing.T) {
-	expectedCode := "aws-apigateway-enable-cache-encryption"
+	expectedCode := "aws-api-gateway-enable-cache-encryption"
 
 	rule, err := scanner.GetRuleById(expectedCode)
 	if err != nil {