mirror of
https://github.com/kyverno/kyverno.git
synced 2025-04-08 10:04:25 +00:00
skip var substitution in attestations
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
This commit is contained in:
parent
219a4d9950
commit
85c346c0a6
1 changed files with 15 additions and 2 deletions
|
@ -91,12 +91,25 @@ func appendError(resp *response.EngineResponse, rule *v1.Rule, msg string, statu
|
|||
}
|
||||
|
||||
func substituteVariables(rule *v1.Rule, ctx context.EvalInterface, logger logr.Logger) (*v1.Rule, error) {
|
||||
ruleCopy, err := variables.SubstituteAllInRule(logger, ctx, *rule.DeepCopy())
|
||||
|
||||
// remove attestations as variables are not substituted in them
|
||||
ruleCopy := rule.DeepCopy()
|
||||
for _, iv := range ruleCopy.VerifyImages {
|
||||
iv.Attestations = nil
|
||||
}
|
||||
|
||||
var err error
|
||||
*ruleCopy, err = variables.SubstituteAllInRule(logger, ctx, *ruleCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &ruleCopy, nil
|
||||
// replace attestations
|
||||
for i, _ := range rule.VerifyImages {
|
||||
ruleCopy.VerifyImages[i].Attestations = rule.VerifyImages[i].Attestations
|
||||
}
|
||||
|
||||
return ruleCopy, nil
|
||||
}
|
||||
|
||||
type imageVerifier struct {
|
||||
|
|
Loading…
Add table
Reference in a new issue