github.com/aquasecurity/trivy-iac@v0.8.1-0.20240127024015-3d8e412cf0ab/pkg/scanners/cloudformation/parser/fn_base64.go (about)

     1  package parser
     2  
     3  import (
     4  	"encoding/base64"
     5  
     6  	"github.com/aquasecurity/trivy-iac/pkg/scanners/cloudformation/cftypes"
     7  )
     8  
     9  func ResolveBase64(property *Property) (*Property, bool) {
    10  	if !property.isFunction() {
    11  		return property, true
    12  	}
    13  
    14  	refValue := property.AsMap()["Fn::Base64"].AsString()
    15  
    16  	retVal := base64.StdEncoding.EncodeToString([]byte(refValue))
    17  
    18  	return property.deriveResolved(cftypes.String, retVal), true
    19  }