Skip to content

Commit

Permalink
fix: skip replacing secret data without ref prefix (#1175)
Browse files Browse the repository at this point in the history
  • Loading branch information
liu-hm19 authored Jun 21, 2024
1 parent 2241ae5 commit 1da8b5c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/engine/operation/graph/resource_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ const (
ImplicitRefPrefix = "$kusion_path."
)

const (
SecretRefPrefix = "ref://"
)

func (rn *ResourceNode) PreExecute(o *models.Operation) v1.Status {
value := reflect.ValueOf(rn.resource.Attributes)

Expand Down Expand Up @@ -87,6 +91,12 @@ func replaceSecretRef(o *models.Operation, obj map[string]interface{}) (map[stri
}
for k, data := range secret.Data {
ref := string(data)

// Skip the secret data which is not with the secret ref prefix.
if !strings.HasPrefix(ref, SecretRefPrefix) {
continue
}

externalSecretRef, err := parseExternalSecretDataRef(ref)
if err != nil {
return nil, v1.NewErrorStatus(err)
Expand Down

0 comments on commit 1da8b5c

Please sign in to comment.