Skip to content

Commit 3aa1c57

Browse files
authored
Sanitize the cft template file for aws:: words as it causes parser to 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
1 parent a4faf59 commit 3aa1c57

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pkg/iac-providers/cft/v1/sanitize-cft-template.go

+4
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ func (a *CFTV1) sanitizeCftTemplate(data []byte, isYAML bool) (map[string]interf
100100

101101
func removeRefAnchors(data []byte) ([]byte, error) {
102102
const REF = "!ref"
103+
const DoubleColon = "::"
103104
strdata := string(data)
104105
words := strings.Split(strdata, " ")
105106

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

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

pkg/version/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package version
1919
import "fmt"
2020

2121
// Terrascan The Terrascan version
22-
const Terrascan = "1.18.8"
22+
const Terrascan = "1.18.9"
2323

2424
// Get returns the terrascan version
2525
func Get() string {

0 commit comments

Comments
 (0)