kyverno / policies

Kyverno policies for security and best practices
Apache License 2.0
323 stars 233 forks source link

[Sample] disallow-privilege-escalation: Simplify CEL expressions using optional #1144

Closed epasham closed 2 days ago

epasham commented 2 weeks ago

Problem Statement

Simplify the CEL expression using optional. Update the CEL expression and test and validate disallow-privilege-escalation policy

Solution Description

The policy has redundant CEL expressions and needs to be simplified. containers, initcontainers and ephemeral containers needs to be captured in a variable and use the variable in CEL expression

Example "Good" Resource

No response

Example "Bad" Resource

No response

Other Comments

No response

Slack discussion

No response

Troubleshooting

epasham commented 2 weeks ago

/assign @epasham