1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-09 09:26:54 +00:00
kyverno/pkg
Alex Hamlin 218877dc03
Evaluate one version of each pod security standard (#10924)
The original logic for evaluating pod security standards took two steps
for each defined check:

1. If the policy author requested the latest version of the standard,
   find the newest version of the check and evaluate the pod against it,
   adding any failure to the final results.

2. Otherwise, evaluate the pod against *each version of the check* whose
   minimum version is below the requested version, adding any failures
   to the final results.

This second step can be problematic, as new PSS versions may permit a
broader range of values for a restricted field compared to old versions.
As a concrete example, versioned podSecurity rules don't permit some of
the newer sysctls allowed by Kubernetes v1.27 and v1.29, since Kyverno
still evaluates v1.0 of the check.

With this change, Kyverno identifies the highest version of the check
that the podSecurity rule allows, and only executes that version of the
check against the pod. Since the "latest" version is special-cased to
compare newer than all non-latest versions, no special logic is required
in that case.

I've added unit tests for several combinations of sysctl and policy
version, especially to check that policy v1.27 permits the new sysctl
allowed in v1.27 but not the sysctls allowed in v1.29. I've also taken
the liberty of changing `assert.Assert` to `assert.Check`, to collect
multiple failures from a single unit test run.

Signed-off-by: Alex Hamlin <alexanderh@qualtrics.com>
2024-09-03 18:58:40 +00:00
..
auth fix: add the resource name to the SubjectAccessReview (#10221) 2024-08-07 12:46:44 +00:00
autogen chore: rename validationFailureAction to failureAction under the rule (#10893) 2024-08-27 20:07:57 +00:00
background feat: foreach support for clone (#10888) 2024-08-29 11:59:22 +00:00
breaker rename package: d4f --> breaker (#10863) 2024-08-15 10:53:20 +00:00
client feat: enable custom data in policy reports using properties (#10933) 2024-09-03 17:36:07 +00:00
clients feat: bump to k8s 1.31 (#10938) 2024-08-28 17:09:58 +00:00
config feat: add a circuit breaker for updaterequests (#10382) 2024-06-11 08:54:51 +00:00
controllers chore: remove v1alpha1 of VAPs and use v1beta1 (#10955) 2024-08-29 15:31:25 +00:00
cosign feat: bump to k8s 1.31 (#10938) 2024-08-28 17:09:58 +00:00
engine feat: enable custom data in policy reports using properties (#10933) 2024-09-03 17:36:07 +00:00
event chore: remove v1alpha1 of VAPs and use v1beta1 (#10955) 2024-08-29 15:31:25 +00:00
exceptions chore: use v2 clients for policy exceptions (#10530) 2024-06-24 16:36:55 +00:00
globalcontext feat(gctx): retry logic (#10796) 2024-08-21 19:32:58 +00:00
images feat: add support for sigstore bundle verification (#10567) 2024-08-16 11:36:48 +00:00
imageverifycache fix: properly use useCache field in image verification policies (#10709) 2024-08-19 14:26:07 +00:00
informers feat(perf): add new linter prealloc to enforce slice declarations best practice (#10250) 2024-05-20 14:46:35 +05:30
leaderelection Remove dependency on github.com/pkg/errors (#6165) 2023-02-01 14:38:04 +08:00
logging chore(log): add caller (#10874) 2024-08-16 14:08:55 +00:00
metrics feat: bump to k8s 1.31 (#10938) 2024-08-28 17:09:58 +00:00
notary feat: fix notary tests (#10579) 2024-07-02 14:18:29 +00:00
policy fix: match wildcard names for generateExisting policies (#10945) 2024-08-29 13:09:30 +00:00
policycache chore: rename validationFailureAction to failureAction under the rule (#10893) 2024-08-27 20:07:57 +00:00
profiling refactor: introduce cmd internal package (#5404) 2022-11-18 22:21:15 +08:00
pss Evaluate one version of each pod security standard (#10924) 2024-09-03 18:58:40 +00:00
registryclient fix: use gcr crane opts while fetching image descriptors (#9838) 2024-03-04 08:14:00 +00:00
tls chore: set cert renewal time to 15 days before expiration (#8567) 2023-12-06 13:37:01 +00:00
toggle fix: display a message when the controller has no permissions for VAPs (#8776) 2023-11-01 21:52:03 +08:00
tracing feat: bump to k8s 1.31 (#10938) 2024-08-28 17:09:58 +00:00
userinfo refactor: reduce userinfos deps and add unit tests (#6524) 2023-03-10 09:09:19 +00:00
utils feat: enable custom data in policy reports using properties (#10933) 2024-09-03 17:36:07 +00:00
validatingadmissionpolicy feat: enable custom data in policy reports using properties (#10933) 2024-09-03 17:36:07 +00:00
validation fix: variable substitution error handling in policy validation (#10936) 2024-08-29 23:49:45 +00:00
version fix: use golang builtin version management (#7654) 2023-06-30 23:27:06 +00:00
webhooks feat: enable custom data in policy reports using properties (#10933) 2024-09-03 17:36:07 +00:00