Skip to content

Commit

Permalink
Sanitize the cft template file for aws:: words as it causes parser to…
Browse files Browse the repository at this point in the history
… fail (#1656)

* fix for crash in lambda function cft yaml if code key is not present

* removed duplicate tag image tag

* bump up the version to 1.18.5

* added feature to parse cft template for ssm parameter

* bumped the version to 1.18.7

* bump up version to v1.18.8

* Sanitize the cft template file for aws:: words as it causes parser to fail

* Sanitize the cft template file for aws:: words as it causes parser to fail

* increment version
  • Loading branch information
nmoretenable authored Dec 18, 2023
1 parent a4faf59 commit 3aa1c57
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/iac-providers/cft/v1/sanitize-cft-template.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func (a *CFTV1) sanitizeCftTemplate(data []byte, isYAML bool) (map[string]interf

func removeRefAnchors(data []byte) ([]byte, error) {
const REF = "!ref"
const DoubleColon = "::"
strdata := string(data)
words := strings.Split(strdata, " ")

Expand All @@ -123,6 +124,9 @@ func removeRefAnchors(data []byte) ([]byte, error) {
nextLower := strings.ToLower(words[i+1])

if strings.Contains(nextLower, "aws::") {
if i+1 < len(words) { // check edge case
words[i+1] = strings.ReplaceAll(nextLower, DoubleColon, "-")
}
continue
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package version
import "fmt"

// Terrascan The Terrascan version
const Terrascan = "1.18.8"
const Terrascan = "1.18.9"

// Get returns the terrascan version
func Get() string {
Expand Down

0 comments on commit 3aa1c57

Please sign in to comment.