github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/cloudformation/parser/fn_equals.go (about)

     1  package parser
     2  
     3  import (
     4  	"github.com/khulnasoft-lab/defsec/pkg/scanners/cloudformation/cftypes"
     5  )
     6  
     7  func ResolveEquals(property *Property) (resolved *Property, success bool) {
     8  	if !property.isFunction() {
     9  		return property, true
    10  	}
    11  
    12  	refValue := property.AsMap()["Fn::Equals"].AsList()
    13  
    14  	if len(refValue) != 2 {
    15  		return abortIntrinsic(property, "Fn::Equals should have exactly 2 values, returning original Property")
    16  	}
    17  
    18  	propA, _ := refValue[0].resolveValue()
    19  	propB, _ := refValue[1].resolveValue()
    20  	return property.deriveResolved(cftypes.Bool, propA.EqualTo(propB.RawValue())), true
    21  }