mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
e9e44291bf
* cosign 2.0 version upgrade Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * IgnoreTlog and IgnoreSCT updated Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * removed cli packages Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * lazy evaluate vars in conditions (#7238) * lazy evaluate vars in conditions Signed-off-by: Jim Bugwadia <jim@nirmata.com> * remove unnecessary conversion Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix test Signed-off-by: Jim Bugwadia <jim@nirmata.com> * Update test/conformance/kuttl/validate/clusterpolicy/standard/variables/lazyload/conditions/03-manifests.yaml Signed-off-by: shuting <shutting06@gmail.com> * Update test/conformance/kuttl/validate/clusterpolicy/standard/variables/lazyload/README.md Signed-off-by: shuting <shutting06@gmail.com> * added error check in test Signed-off-by: Jim Bugwadia <jim@nirmata.com> --------- Signed-off-by: Jim Bugwadia <jim@nirmata.com> Signed-off-by: shuting <shutting06@gmail.com> Co-authored-by: shuting <shutting06@gmail.com> Co-authored-by: kyverno-bot <104836976+kyverno-bot@users.noreply.github.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * in-toto-golang update Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * added rekor Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * quote image in error (#7259) Signed-off-by: bakito <github@bakito.ch> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * fix: auto update webhooks not configuring fail endpoint (#7261) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * fix latest version check (#7263) Signed-off-by: ShutingZhao <shuting@nirmata.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * chore(deps): bump svenstaro/upload-release-action from 2.5.0 to 2.6.0 (#7270) Bumps [svenstaro/upload-release-action](https://github.com/svenstaro/upload-release-action) from 2.5.0 to 2.6.0. - [Release notes](https://github.com/svenstaro/upload-release-action/releases) - [Changelog](https://github.com/svenstaro/upload-release-action/blob/master/CHANGELOG.md) - [Commits](7319e4733e...58d5258088
) --- updated-dependencies: - dependency-name: svenstaro/upload-release-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * chore(deps): bump sigs.k8s.io/controller-runtime from 0.14.6 to 0.15.0 (#7272) Bumps [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) from 0.14.6 to 0.15.0. - [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases) - [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md) - [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.14.6...v0.15.0) --- updated-dependencies: - dependency-name: sigs.k8s.io/controller-runtime dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * feat: add yaml util to check empty document (#7276) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * chore(deps): bump github.com/go-git/go-git/v5 from 5.6.1 to 5.7.0 (#7274) Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.6.1 to 5.7.0. - [Release notes](https://github.com/go-git/go-git/releases) - [Commits](https://github.com/go-git/go-git/compare/v5.6.1...v5.7.0) --- updated-dependencies: - dependency-name: github.com/go-git/go-git/v5 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * chore(deps): bump github.com/go-git/go-git/v5 from 5.6.1 to 5.7.0 (#7274) Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.6.1 to 5.7.0. - [Release notes](https://github.com/go-git/go-git/releases) - [Commits](https://github.com/go-git/go-git/compare/v5.6.1...v5.7.0) --- updated-dependencies: - dependency-name: github.com/go-git/go-git/v5 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * chore(deps): bump github.com/go-git/go-git/v5 from 5.6.1 to 5.7.0 (#7274) Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.6.1 to 5.7.0. - [Release notes](https://github.com/go-git/go-git/releases) - [Commits](https://github.com/go-git/go-git/compare/v5.6.1...v5.7.0) --- updated-dependencies: - dependency-name: github.com/go-git/go-git/v5 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * go mod update Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * removed cosign 1.13.1 dependency Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * added default rekor url Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * updated cosign option Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * chore(deps): bump github.com/go-git/go-git/v5 from 5.6.1 to 5.7.0 (#7274) Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.6.1 to 5.7.0. - [Release notes](https://github.com/go-git/go-git/releases) - [Commits](https://github.com/go-git/go-git/compare/v5.6.1...v5.7.0) --- updated-dependencies: - dependency-name: github.com/go-git/go-git/v5 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * go mod update Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * go sum fix Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * NIT Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * fix failing test: Test_VerifyManifest_MustAll_InvalidYAML Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * suggestions from jim Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * go mod fix Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * updates to cosign verification Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * kuttl test ignore sct Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * go mod fixes Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * go mod update Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * downgrading gcr version Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * null pointer error Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * updated failing cli tests Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * updated kuttl test with complete subjects Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * fixed issue with wildcard replacement Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * engine tests Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * removed conflicts with notary Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * updated go mod Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * codegen and test Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * added pubkeys test Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * add default CTLogPubKeys Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * cleanup Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * unwanted test Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * fix: auth checks with the APIVersion and the subresource (#7628) * fix auth checks with apiVersion and subresource Signed-off-by: ShutingZhao <shuting@nirmata.com> * add kuttl tests Signed-off-by: ShutingZhao <shuting@nirmata.com> * remove duplicate code Signed-off-by: ShutingZhao <shuting@nirmata.com> * update permissions Signed-off-by: ShutingZhao <shuting@nirmata.com> --------- Signed-off-by: ShutingZhao <shuting@nirmata.com> * fix: harden rbac permissions (#7638) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore(deps): bump sigstore/cosign-installer from 3.0.5 to 3.1.0 (#7664) Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.0.5 to 3.1.0. - [Release notes](https://github.com/sigstore/cosign-installer/releases) - [Commits](dd6b2e2b61...d13028333d
) --- updated-dependencies: - dependency-name: sigstore/cosign-installer dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump ossf/scorecard-action from 2.1.3 to 2.2.0 (#7663) Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.3 to 2.2.0. - [Release notes](https://github.com/ossf/scorecard-action/releases) - [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md) - [Commits](80e868c13c...08b4669551
) --- updated-dependencies: - dependency-name: ossf/scorecard-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [Chore] bump notation-go from 1.0.0-rc.3 -> 1.0.0-rc.6 (#7650) * Bump notation-go from 1.0.0-rc.3 -> 1.0.0-rc.6 Signed-off-by: webstradev <e.s.westra.95@gmail.com> * fixed tests Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * added tests for repository Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> --------- Signed-off-by: webstradev <e.s.westra.95@gmail.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> Co-authored-by: webstradev <e.s.westra.95@gmail.com> Co-authored-by: shuting <shuting@nirmata.com> * fix: vscode debug config (#7653) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: pr updater workflow (#7665) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * refactor: add specific loaders from #7597 (#7671) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * feat: add cluster select and relabling config for ServiceMonitors (#7659) * feat: add cluster select and relabling config for ServiceMonitors Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com> * feat: add cluster select and relabling config for ServiceMonitors Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com> --------- Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com> * fix: cleanup controller context from #7597 (#7672) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: cleanup controller rbac (#7669) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * refactor: migrate context loaders (part 1) from #7597 (#7676) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * refactor: migrate context loaders (part 2) from #7597 (#7677) * refactor: migrate context loaders (part 1) from #7597 Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * refactor: migrate context loaders (part 2) from #7597 Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * feat: add lazy loading feature flag (#7680) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: image verification (#7652) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * Fix deferred loading (#7597) * handle nested contexts Signed-off-by: Jim Bugwadia <jim@nirmata.com> * add feature flag Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix tests Signed-off-by: Jim Bugwadia <jim@nirmata.com> * add kuttl tests Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix linter issues Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix CLI regclient Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix: token permissions on report vulns workflow (#7611) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: token permissions (#7619) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: update the flag descriptions of the reports-controller (#7617) Signed-off-by: emmanuel-ferdman <emmanuelferdman@gmail.com> * fix: panic if env var not defined (#7613) * fix: panic if env var not defined Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * use toggles instead of a flag Signed-off-by: Jim Bugwadia <jim@nirmata.com> * update toggle name Signed-off-by: Jim Bugwadia <jim@nirmata.com> * update toggle name Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix roles Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix role Signed-off-by: Jim Bugwadia <jim@nirmata.com> * update manifests Signed-off-by: Jim Bugwadia <jim@nirmata.com> * remove extra unlock Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix loader reset Signed-off-by: Jim Bugwadia <jim@nirmata.com> * add tests Signed-off-by: Jim Bugwadia <jim@nirmata.com> * propagate context Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * cm resolver Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * level management Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * address review comments Signed-off-by: Jim Bugwadia <jim@nirmata.com> * add enableDeferredLoading to other controllers Signed-off-by: Jim Bugwadia <jim@nirmata.com> * re-enable ACR credhelper Signed-off-by: Jim Bugwadia <jim@nirmata.com> * improve tests Signed-off-by: Jim Bugwadia <jim@nirmata.com> * remove image registry client init Signed-off-by: Jim Bugwadia <jim@nirmata.com> * check for invalid reset/restore Signed-off-by: Jim Bugwadia <jim@nirmata.com> * recursive kuttl test Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * add pre/post queries Signed-off-by: Jim Bugwadia <jim@nirmata.com> * add check for a recursive match Signed-off-by: Jim Bugwadia <jim@nirmata.com> * new test suite Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * eval loaders at creation level Signed-off-by: Jim Bugwadia <jim@nirmata.com> * kuttl test Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * add an index for resolving deps in order Signed-off-by: Jim Bugwadia <jim@nirmata.com> * improve comment Signed-off-by: Jim Bugwadia <jim@nirmata.com> * extract remove method Signed-off-by: Jim Bugwadia <jim@nirmata.com> * merge main Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * flags Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * feature flag Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix flag Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * update unit tests Signed-off-by: ShutingZhao <shuting@nirmata.com> * two rules kuttl test Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * update unit tests Signed-off-by: ShutingZhao <shuting@nirmata.com> * revert Signed-off-by: ShutingZhao <shuting@nirmata.com> * per rule checkpoint Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix mutate chained rules Signed-off-by: ShutingZhao <shuting@nirmata.com> * per rule checpoint/restore Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * log error Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Jim Bugwadia <jim@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: emmanuel-ferdman <emmanuelferdman@gmail.com> Signed-off-by: ShutingZhao <shuting@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> Co-authored-by: shuting <shuting@nirmata.com> * fix: factorise confimap informer code (#7667) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: shuting <shuting@nirmata.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore(deps): bump sigstore/cosign-installer from 3.1.0 to 3.1.1 (#7689) Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.1.0 to 3.1.1. - [Release notes](https://github.com/sigstore/cosign-installer/releases) - [Commits](d13028333d...6e04d228eb
) --- updated-dependencies: - dependency-name: sigstore/cosign-installer dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: Swap any/all in the error message. (#7688) Signed-off-by: JaeHeung Han <hylowaker@users.noreply.github.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * feat: add background only policy support (#6666) * feat: add background only policy support Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * webhook Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * validation Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * kuttl Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * all disabled Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: pr updater workflow (#7697) * fix: pr updater workflow Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * Update .github/workflows/pr-update.yaml Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: customizable tracer configuration (#7644) * fix: customizable tracer configuration Signed-off-by: Daniel Laszlo <laszlodaniel@icloud.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * fix: harden rbac permissions (#7638) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * chore(deps): bump sigstore/cosign-installer from 3.0.5 to 3.1.0 (#7664) Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.0.5 to 3.1.0. - [Release notes](https://github.com/sigstore/cosign-installer/releases) - [Commits](dd6b2e2b61...d13028333d
) --- updated-dependencies: - dependency-name: sigstore/cosign-installer dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * chore(deps): bump ossf/scorecard-action from 2.1.3 to 2.2.0 (#7663) Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.3 to 2.2.0. - [Release notes](https://github.com/ossf/scorecard-action/releases) - [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md) - [Commits](80e868c13c...08b4669551
) --- updated-dependencies: - dependency-name: ossf/scorecard-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * use resource.New instead of Merge Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * fix tabs Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * [Chore] bump notation-go from 1.0.0-rc.3 -> 1.0.0-rc.6 (#7650) * Bump notation-go from 1.0.0-rc.3 -> 1.0.0-rc.6 Signed-off-by: webstradev <e.s.westra.95@gmail.com> * fixed tests Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * added tests for repository Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> --------- Signed-off-by: webstradev <e.s.westra.95@gmail.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> Co-authored-by: webstradev <e.s.westra.95@gmail.com> Co-authored-by: shuting <shuting@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * fix: vscode debug config (#7653) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * fix: pr updater workflow (#7665) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * refactor: add specific loaders from #7597 (#7671) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * feat: add cluster select and relabling config for ServiceMonitors (#7659) * feat: add cluster select and relabling config for ServiceMonitors Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com> * feat: add cluster select and relabling config for ServiceMonitors Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com> --------- Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * fix: cleanup controller context from #7597 (#7672) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * fix: cleanup controller rbac (#7669) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * refactor: migrate context loaders (part 1) from #7597 (#7676) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * refactor: migrate context loaders (part 2) from #7597 (#7677) * refactor: migrate context loaders (part 1) from #7597 Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * refactor: migrate context loaders (part 2) from #7597 Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * feat: add lazy loading feature flag (#7680) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * fix: image verification (#7652) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * Fix deferred loading (#7597) * handle nested contexts Signed-off-by: Jim Bugwadia <jim@nirmata.com> * add feature flag Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix tests Signed-off-by: Jim Bugwadia <jim@nirmata.com> * add kuttl tests Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix linter issues Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix CLI regclient Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix: token permissions on report vulns workflow (#7611) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: token permissions (#7619) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: update the flag descriptions of the reports-controller (#7617) Signed-off-by: emmanuel-ferdman <emmanuelferdman@gmail.com> * fix: panic if env var not defined (#7613) * fix: panic if env var not defined Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * use toggles instead of a flag Signed-off-by: Jim Bugwadia <jim@nirmata.com> * update toggle name Signed-off-by: Jim Bugwadia <jim@nirmata.com> * update toggle name Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix roles Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix role Signed-off-by: Jim Bugwadia <jim@nirmata.com> * update manifests Signed-off-by: Jim Bugwadia <jim@nirmata.com> * remove extra unlock Signed-off-by: Jim Bugwadia <jim@nirmata.com> * fix loader reset Signed-off-by: Jim Bugwadia <jim@nirmata.com> * add tests Signed-off-by: Jim Bugwadia <jim@nirmata.com> * propagate context Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * cm resolver Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * level management Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * address review comments Signed-off-by: Jim Bugwadia <jim@nirmata.com> * add enableDeferredLoading to other controllers Signed-off-by: Jim Bugwadia <jim@nirmata.com> * re-enable ACR credhelper Signed-off-by: Jim Bugwadia <jim@nirmata.com> * improve tests Signed-off-by: Jim Bugwadia <jim@nirmata.com> * remove image registry client init Signed-off-by: Jim Bugwadia <jim@nirmata.com> * check for invalid reset/restore Signed-off-by: Jim Bugwadia <jim@nirmata.com> * recursive kuttl test Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * add pre/post queries Signed-off-by: Jim Bugwadia <jim@nirmata.com> * add check for a recursive match Signed-off-by: Jim Bugwadia <jim@nirmata.com> * new test suite Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * eval loaders at creation level Signed-off-by: Jim Bugwadia <jim@nirmata.com> * kuttl test Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * add an index for resolving deps in order Signed-off-by: Jim Bugwadia <jim@nirmata.com> * improve comment Signed-off-by: Jim Bugwadia <jim@nirmata.com> * extract remove method Signed-off-by: Jim Bugwadia <jim@nirmata.com> * merge main Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * flags Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * feature flag Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix flag Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * update unit tests Signed-off-by: ShutingZhao <shuting@nirmata.com> * two rules kuttl test Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * update unit tests Signed-off-by: ShutingZhao <shuting@nirmata.com> * revert Signed-off-by: ShutingZhao <shuting@nirmata.com> * per rule checkpoint Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix mutate chained rules Signed-off-by: ShutingZhao <shuting@nirmata.com> * per rule checpoint/restore Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * log error Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Jim Bugwadia <jim@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: emmanuel-ferdman <emmanuelferdman@gmail.com> Signed-off-by: ShutingZhao <shuting@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> Co-authored-by: shuting <shuting@nirmata.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * fix: factorise confimap informer code (#7667) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: shuting <shuting@nirmata.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * chore(deps): bump sigstore/cosign-installer from 3.1.0 to 3.1.1 (#7689) Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.1.0 to 3.1.1. - [Release notes](https://github.com/sigstore/cosign-installer/releases) - [Commits](d13028333d...6e04d228eb
) --- updated-dependencies: - dependency-name: sigstore/cosign-installer dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> * Update pkg/tracing/config.go Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Daniel Laszlo <laszlodaniel@icloud.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: webstradev <e.s.westra.95@gmail.com> Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com> Signed-off-by: Jim Bugwadia <jim@nirmata.com> Signed-off-by: emmanuel-ferdman <emmanuelferdman@gmail.com> Signed-off-by: ShutingZhao <shuting@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> Co-authored-by: webstradev <e.s.westra.95@gmail.com> Co-authored-by: shuting <shuting@nirmata.com> Co-authored-by: Frank Jogeleit <frank.jogeleit@lovoo.com> Co-authored-by: Jim Bugwadia <jim@nirmata.com> Co-authored-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: lock schema manager when updating it (#7704) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * test: add kuttl tests for background only policies (#7709) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * Feat: Upgrade controller-gen to v0.12.0 and fix tooling (#7683) * Upgrade controller-gen and fix tooling Signed-off-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> * Address comments Signed-off-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> * Add a marker in the sed command Signed-off-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> * Upgrade to the latest version and rearrange the annotations Signed-off-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> * Fix failing Verify Codegen tests Signed-off-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> * Remove unnecessary file Signed-off-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> * Restore original version in test folder Signed-off-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> * Add creationTimestamp: null again in the test folder Signed-off-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> --------- Signed-off-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> Co-authored-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: release signing (#7711) (#7713) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore: use github token instead of pat (#7716) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: reduce token permissions (#7719) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: reduce token permissions (#7721) * fix: reduce token permissions Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: reduce token permissions Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: make `test --fail-only` return 1 if there are failed tests (#7717) Signed-off-by: Carles Figuerola <cfiguerola@expediagroup.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * remove redundant tests (#7702) Signed-off-by: ShutingZhao <shuting@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: use gh token instead of pat (#7723) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: remove obsolete scripts (#7720) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: reduce token permission (#7729) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: use github token instead of pat (#7727) * fix: remove jmespath replace directive Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: use github token instead of pat Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: use golang builtin version management (#7654) * fix: use golang builtin version management Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * feat: template for user setup in kuttl (#7731) Signed-off-by: Alok N <alokme123@gmail.com> * feat: Add option to add imagePullSecrets to cleanup CronJobs (#7730) * Add option to add imagePullSecrets to cleanup CronJobs Signed-off-by: Alexander Olzem <olzemal@pm.me> * Update chart README Signed-off-by: Alexander Olzem <olzemal@pm.me> --------- Signed-off-by: Alexander Olzem <olzemal@pm.me> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: typo in check cmd (#7733) Signed-off-by: emmanuel-ferdman <emmanuelferdman@gmail.com> * fix: nits in cli flags (#7736) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore: bump ko version (#7738) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore: bump kind node versions (#7737) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: refactor cli values loading and remove dead code (#7739) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * [Feature] round() JMESPath function (#7489) * adding roundoff Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * removing unnecessary Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * adding test Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * adding edge case Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * fixing error Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * updating function call Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * updating function jpRound Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * error handling negative Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * fix Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> * fix linter Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * parsing Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * cleanup Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix tests Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore(deps): bump ubuntu from `6120be6` to `0bced47` in /.devcontainer (#7744) Bumps ubuntu from `6120be6` to `0bced47`. --- updated-dependencies: - dependency-name: ubuntu dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: improve cli apply args check (#7746) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix: remove cli dead code (#7748) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * Replaced gcr crane with gcr remote (#7747) * fix: oras-go/v2 version in go.sum Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * refactor: move kyverno constants out of v1 package (#7760) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore: use register-gen to register k8s types (#7761) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore(deps): bump fluxcd/flux2 from 0.41.2 to 2.0.0 (#7764) Bumps [fluxcd/flux2](https://github.com/fluxcd/flux2) from 0.41.2 to 2.0.0. - [Release notes](https://github.com/fluxcd/flux2/releases) - [Changelog](https://github.com/fluxcd/flux2/blob/main/.goreleaser.yml) - [Commits](dbda8fbdb8...9ea0a535ea
) --- updated-dependencies: - dependency-name: fluxcd/flux2 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore: introduce defaulters-gen (#7765) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * feat: add table output to cli apply command (#7757) * feat: add table output to cli apply command Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * factorise Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: shuting <shuting@nirmata.com> * chore: bump cosign in gh workflows (#7715) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore: switch to deepcopy-gen (#7766) * chore: switch to deepcopy-gen Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore: increase linter timeout (#7767) Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * undo: revert back to cosign 2.0.2 cosign 2.1.1 has dependency conflicts with oras Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * remove markers Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * chore: remove 0_14 version of gcr k8s-sigstore-manifest got a new version so we can finally upgrade gcr to v0.15 Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * add: add logging to tlogs and sct Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * undo: remove registryOpts in favor of registry client opts added the missing parts from registryOptions in registry client opts Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * chore: add generated files Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * chore: clean go mod Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * fix: remove bad logs Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * bug: fix go mod Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * fix: update kubebuilder version in crds Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * update: rollback policy to ignore tlog Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> * chore: update codegen Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> --------- Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com> Signed-off-by: Jim Bugwadia <jim@nirmata.com> Signed-off-by: shuting <shutting06@gmail.com> Signed-off-by: bakito <github@bakito.ch> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: ShutingZhao <shuting@nirmata.com> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: webstradev <e.s.westra.95@gmail.com> Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com> Signed-off-by: emmanuel-ferdman <emmanuelferdman@gmail.com> Signed-off-by: JaeHeung Han <hylowaker@users.noreply.github.com> Signed-off-by: Daniel Laszlo <laszlodaniel@icloud.com> Signed-off-by: Daniel Laszlo <daniel.laszlo@bitpanda.com> Signed-off-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> Signed-off-by: Carles Figuerola <cfiguerola@expediagroup.com> Signed-off-by: Alok N <alokme123@gmail.com> Signed-off-by: Alexander Olzem <olzemal@pm.me> Signed-off-by: Rexbeast2 <ssukhveer514@gmail.com> Co-authored-by: Jim Bugwadia <jim@nirmata.com> Co-authored-by: shuting <shutting06@gmail.com> Co-authored-by: kyverno-bot <104836976+kyverno-bot@users.noreply.github.com> Co-authored-by: Marc Brugger <github@bakito.ch> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: shuting <shuting@nirmata.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: webstradev <e.s.westra.95@gmail.com> Co-authored-by: Frank Jogeleit <frank.jogeleit@lovoo.com> Co-authored-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: JaeHeung Han <hylowaker@users.noreply.github.com> Co-authored-by: Daniel Laszlo <laszlodaniel@icloud.com> Co-authored-by: Md Shahbaz Alam <shahbazalam75508@gmail.com> Co-authored-by: shahbaz <shahbaz@shahbaz.myguest.virtualbox.org> Co-authored-by: Carles-Figuerola <carles@figuerola.info> Co-authored-by: Alok Naushad <alokme123@gmail.com> Co-authored-by: Alex Olzem <olzemal@gmail.com> Co-authored-by: SukhveerS <78963782+Rexbeast2@users.noreply.github.com>
656 lines
22 KiB
Go
656 lines
22 KiB
Go
package internal
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"errors"
|
|
"fmt"
|
|
"net"
|
|
"strings"
|
|
|
|
"github.com/go-logr/logr"
|
|
"github.com/kyverno/kyverno/api/kyverno"
|
|
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
|
"github.com/kyverno/kyverno/pkg/config"
|
|
"github.com/kyverno/kyverno/pkg/cosign"
|
|
engineapi "github.com/kyverno/kyverno/pkg/engine/api"
|
|
enginecontext "github.com/kyverno/kyverno/pkg/engine/context"
|
|
"github.com/kyverno/kyverno/pkg/engine/variables"
|
|
"github.com/kyverno/kyverno/pkg/images"
|
|
"github.com/kyverno/kyverno/pkg/imageverifycache"
|
|
"github.com/kyverno/kyverno/pkg/notary"
|
|
apiutils "github.com/kyverno/kyverno/pkg/utils/api"
|
|
"github.com/kyverno/kyverno/pkg/utils/jsonpointer"
|
|
"github.com/kyverno/kyverno/pkg/utils/wildcard"
|
|
"go.uber.org/multierr"
|
|
"gomodules.xyz/jsonpatch/v2"
|
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
|
)
|
|
|
|
type ImageVerifier struct {
|
|
logger logr.Logger
|
|
rclient engineapi.RegistryClient
|
|
ivCache imageverifycache.Client
|
|
policyContext engineapi.PolicyContext
|
|
rule kyvernov1.Rule
|
|
ivm *engineapi.ImageVerificationMetadata
|
|
imageSignatureRepository string
|
|
}
|
|
|
|
func NewImageVerifier(
|
|
logger logr.Logger,
|
|
rclient engineapi.RegistryClient,
|
|
ivCache imageverifycache.Client,
|
|
policyContext engineapi.PolicyContext,
|
|
rule kyvernov1.Rule,
|
|
ivm *engineapi.ImageVerificationMetadata,
|
|
imageSignatureRepository string,
|
|
) *ImageVerifier {
|
|
return &ImageVerifier{
|
|
logger: logger,
|
|
rclient: rclient,
|
|
ivCache: ivCache,
|
|
policyContext: policyContext,
|
|
rule: rule,
|
|
ivm: ivm,
|
|
imageSignatureRepository: imageSignatureRepository,
|
|
}
|
|
}
|
|
|
|
func HasImageVerifiedAnnotationChanged(ctx engineapi.PolicyContext, log logr.Logger) bool {
|
|
newResource := ctx.NewResource()
|
|
oldResource := ctx.OldResource()
|
|
if newResource.Object == nil || oldResource.Object == nil {
|
|
return false
|
|
}
|
|
newValue := newResource.GetAnnotations()[kyverno.AnnotationImageVerify]
|
|
oldValue := oldResource.GetAnnotations()[kyverno.AnnotationImageVerify]
|
|
if newValue == oldValue {
|
|
return false
|
|
}
|
|
var newValueObj, oldValueObj map[string]bool
|
|
err := json.Unmarshal([]byte(newValue), &newValueObj)
|
|
if err != nil {
|
|
log.Error(err, "failed to parse new resource annotation.")
|
|
return true
|
|
}
|
|
err = json.Unmarshal([]byte(oldValue), &oldValueObj)
|
|
if err != nil {
|
|
log.Error(err, "failed to parse old resource annotation.")
|
|
return true
|
|
}
|
|
for img := range oldValueObj {
|
|
_, found := newValueObj[img]
|
|
if found {
|
|
result := newValueObj[img] != oldValueObj[img]
|
|
if result {
|
|
log.V(2).Info("annotation mismatch", "oldValue", oldValue, "newValue", newValue, "key", kyverno.AnnotationImageVerify)
|
|
return result
|
|
}
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func matchImageReferences(imageReferences []string, image string) bool {
|
|
for _, imageRef := range imageReferences {
|
|
if wildcard.Match(imageRef, image) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func isImageVerified(resource unstructured.Unstructured, image string, log logr.Logger) (bool, error) {
|
|
if resource.Object == nil {
|
|
return false, fmt.Errorf("nil resource")
|
|
}
|
|
annotations := resource.GetAnnotations()
|
|
if len(annotations) == 0 {
|
|
return false, nil
|
|
}
|
|
data, ok := annotations[kyverno.AnnotationImageVerify]
|
|
if !ok {
|
|
log.V(2).Info("missing image metadata in annotation", "key", kyverno.AnnotationImageVerify)
|
|
return false, fmt.Errorf("image is not verified")
|
|
}
|
|
ivm, err := engineapi.ParseImageMetadata(data)
|
|
if err != nil {
|
|
log.Error(err, "failed to parse image verification metadata", "data", data)
|
|
return false, fmt.Errorf("failed to parse image metadata: %w", err)
|
|
}
|
|
return ivm.IsVerified(image), nil
|
|
}
|
|
|
|
func ExpandStaticKeys(attestorSet kyvernov1.AttestorSet) kyvernov1.AttestorSet {
|
|
var entries []kyvernov1.Attestor
|
|
for _, e := range attestorSet.Entries {
|
|
if e.Keys != nil {
|
|
keys := splitPEM(e.Keys.PublicKeys)
|
|
if len(keys) > 1 {
|
|
moreEntries := createStaticKeyAttestors(keys)
|
|
entries = append(entries, moreEntries...)
|
|
continue
|
|
}
|
|
}
|
|
entries = append(entries, e)
|
|
}
|
|
return kyvernov1.AttestorSet{
|
|
Count: attestorSet.Count,
|
|
Entries: entries,
|
|
}
|
|
}
|
|
|
|
func splitPEM(pem string) []string {
|
|
keys := strings.SplitAfter(pem, "-----END PUBLIC KEY-----")
|
|
if len(keys) < 1 {
|
|
return keys
|
|
}
|
|
return keys[0 : len(keys)-1]
|
|
}
|
|
|
|
func createStaticKeyAttestors(keys []string) []kyvernov1.Attestor {
|
|
var attestors []kyvernov1.Attestor
|
|
for _, k := range keys {
|
|
a := kyvernov1.Attestor{
|
|
Keys: &kyvernov1.StaticKeyAttestor{
|
|
PublicKeys: k,
|
|
},
|
|
}
|
|
attestors = append(attestors, a)
|
|
}
|
|
return attestors
|
|
}
|
|
|
|
func buildStatementMap(statements []map[string]interface{}) (map[string][]map[string]interface{}, []string) {
|
|
results := map[string][]map[string]interface{}{}
|
|
var predicateTypes []string
|
|
for _, s := range statements {
|
|
predicateType := s["type"].(string)
|
|
if results[predicateType] != nil {
|
|
results[predicateType] = append(results[predicateType], s)
|
|
} else {
|
|
results[predicateType] = []map[string]interface{}{s}
|
|
}
|
|
predicateTypes = append(predicateTypes, predicateType)
|
|
}
|
|
return results, predicateTypes
|
|
}
|
|
|
|
func makeAddDigestPatch(imageInfo apiutils.ImageInfo, digest string) jsonpatch.JsonPatchOperation {
|
|
return jsonpatch.JsonPatchOperation{
|
|
Operation: "replace",
|
|
Path: imageInfo.Pointer,
|
|
Value: imageInfo.String() + "@" + digest,
|
|
}
|
|
}
|
|
|
|
func EvaluateConditions(
|
|
conditions []kyvernov1.AnyAllConditions,
|
|
ctx enginecontext.Interface,
|
|
s map[string]interface{},
|
|
log logr.Logger,
|
|
) (bool, string, error) {
|
|
predicate, ok := s["predicate"].(map[string]interface{})
|
|
if !ok {
|
|
return false, "", fmt.Errorf("failed to extract predicate from statement: %v", s)
|
|
}
|
|
if err := enginecontext.AddJSONObject(ctx, predicate); err != nil {
|
|
return false, "", fmt.Errorf("failed to add Statement to the context %v: %w", s, err)
|
|
}
|
|
c, err := variables.SubstituteAllInConditions(log, ctx, conditions)
|
|
if err != nil {
|
|
return false, "", fmt.Errorf("failed to substitute variables in attestation conditions: %w", err)
|
|
}
|
|
return variables.EvaluateAnyAllConditions(log, ctx, c)
|
|
}
|
|
|
|
// verify applies policy rules to each matching image. The policy rule results and annotation patches are
|
|
// added to tme imageVerifier `resp` and `ivm` fields.
|
|
func (iv *ImageVerifier) Verify(
|
|
ctx context.Context,
|
|
imageVerify kyvernov1.ImageVerification,
|
|
matchedImageInfos []apiutils.ImageInfo,
|
|
cfg config.Configuration,
|
|
) ([]jsonpatch.JsonPatchOperation, []*engineapi.RuleResponse) {
|
|
var responses []*engineapi.RuleResponse
|
|
var patches []jsonpatch.JsonPatchOperation
|
|
|
|
// for backward compatibility
|
|
imageVerify = *imageVerify.Convert()
|
|
|
|
for _, imageInfo := range matchedImageInfos {
|
|
image := imageInfo.String()
|
|
|
|
if HasImageVerifiedAnnotationChanged(iv.policyContext, iv.logger) {
|
|
msg := kyverno.AnnotationImageVerify + " annotation cannot be changed"
|
|
iv.logger.Info("image verification error", "reason", msg)
|
|
responses = append(responses, engineapi.RuleFail(iv.rule.Name, engineapi.ImageVerify, msg))
|
|
continue
|
|
}
|
|
|
|
pointer := jsonpointer.ParsePath(imageInfo.Pointer).JMESPath()
|
|
changed, err := iv.policyContext.JSONContext().HasChanged(pointer)
|
|
if err == nil && !changed {
|
|
iv.logger.V(4).Info("no change in image, skipping check", "image", image)
|
|
iv.ivm.Add(image, true)
|
|
continue
|
|
}
|
|
|
|
verified, err := isImageVerified(iv.policyContext.NewResource(), image, iv.logger)
|
|
if err == nil && verified {
|
|
iv.logger.Info("image was previously verified, skipping check", "image", image)
|
|
iv.ivm.Add(image, true)
|
|
continue
|
|
}
|
|
|
|
ruleResp, digest := iv.verifyImage(ctx, imageVerify, imageInfo, cfg)
|
|
|
|
if imageVerify.MutateDigest {
|
|
patch, retrievedDigest, err := iv.handleMutateDigest(ctx, digest, imageInfo)
|
|
if err != nil {
|
|
responses = append(responses, engineapi.RuleError(iv.rule.Name, engineapi.ImageVerify, "failed to update digest", err))
|
|
} else if patch != nil {
|
|
if ruleResp == nil {
|
|
ruleResp = engineapi.RulePass(iv.rule.Name, engineapi.ImageVerify, "mutated image digest")
|
|
}
|
|
patches = append(patches, *patch)
|
|
imageInfo.Digest = retrievedDigest
|
|
image = imageInfo.String()
|
|
}
|
|
}
|
|
|
|
if ruleResp != nil {
|
|
if len(imageVerify.Attestors) > 0 || len(imageVerify.Attestations) > 0 {
|
|
iv.ivm.Add(image, ruleResp.Status() == engineapi.RuleStatusPass)
|
|
}
|
|
responses = append(responses, ruleResp)
|
|
}
|
|
}
|
|
return patches, responses
|
|
}
|
|
|
|
func (iv *ImageVerifier) verifyImage(
|
|
ctx context.Context,
|
|
imageVerify kyvernov1.ImageVerification,
|
|
imageInfo apiutils.ImageInfo,
|
|
cfg config.Configuration,
|
|
) (*engineapi.RuleResponse, string) {
|
|
if len(imageVerify.Attestors) <= 0 && len(imageVerify.Attestations) <= 0 {
|
|
return nil, ""
|
|
}
|
|
image := imageInfo.String()
|
|
for _, att := range imageVerify.Attestations {
|
|
if att.Type == "" && att.PredicateType != "" {
|
|
att.Type = att.PredicateType
|
|
}
|
|
}
|
|
iv.logger.V(2).Info("verifying image signatures", "image", image, "attestors", len(imageVerify.Attestors), "attestations", len(imageVerify.Attestations))
|
|
if err := iv.policyContext.JSONContext().AddImageInfo(imageInfo, cfg); err != nil {
|
|
iv.logger.Error(err, "failed to add image to context")
|
|
return engineapi.RuleError(iv.rule.Name, engineapi.ImageVerify, fmt.Sprintf("failed to add image to context %s", image), err), ""
|
|
}
|
|
if len(imageVerify.Attestors) > 0 {
|
|
if !matchImageReferences(imageVerify.ImageReferences, image) {
|
|
return nil, ""
|
|
}
|
|
ruleResp, cosignResp := iv.verifyAttestors(ctx, imageVerify.Attestors, imageVerify, imageInfo, "")
|
|
if ruleResp.Status() != engineapi.RuleStatusPass {
|
|
return ruleResp, ""
|
|
}
|
|
if imageInfo.Digest == "" {
|
|
imageInfo.Digest = cosignResp.Digest
|
|
}
|
|
if len(imageVerify.Attestations) == 0 {
|
|
return ruleResp, cosignResp.Digest
|
|
}
|
|
}
|
|
|
|
return iv.verifyAttestations(ctx, imageVerify, imageInfo)
|
|
}
|
|
|
|
func (iv *ImageVerifier) verifyAttestors(
|
|
ctx context.Context,
|
|
attestors []kyvernov1.AttestorSet,
|
|
imageVerify kyvernov1.ImageVerification,
|
|
imageInfo apiutils.ImageInfo,
|
|
predicateType string,
|
|
) (*engineapi.RuleResponse, *images.Response) {
|
|
var cosignResponse *images.Response
|
|
image := imageInfo.String()
|
|
for i, attestorSet := range attestors {
|
|
var err error
|
|
path := fmt.Sprintf(".attestors[%d]", i)
|
|
iv.logger.V(4).Info("verifying attestors", "path", path)
|
|
cosignResponse, err = iv.verifyAttestorSet(ctx, attestorSet, imageVerify, imageInfo, path)
|
|
if err != nil {
|
|
iv.logger.Error(err, "failed to verify image")
|
|
return iv.handleRegistryErrors(image, err), nil
|
|
}
|
|
}
|
|
if cosignResponse == nil {
|
|
return engineapi.RuleError(iv.rule.Name, engineapi.ImageVerify, "invalid response", fmt.Errorf("nil")), nil
|
|
}
|
|
msg := fmt.Sprintf("verified image signatures for %s", image)
|
|
return engineapi.RulePass(iv.rule.Name, engineapi.ImageVerify, msg), cosignResponse
|
|
}
|
|
|
|
// handle registry network errors as a rule error (instead of a policy failure)
|
|
func (iv *ImageVerifier) handleRegistryErrors(image string, err error) *engineapi.RuleResponse {
|
|
msg := fmt.Sprintf("failed to verify image %s: %s", image, err.Error())
|
|
var netErr *net.OpError
|
|
if errors.As(err, &netErr) {
|
|
return engineapi.RuleError(iv.rule.Name, engineapi.ImageVerify, fmt.Sprintf("failed to verify image %s", image), err)
|
|
}
|
|
return engineapi.RuleFail(iv.rule.Name, engineapi.ImageVerify, msg)
|
|
}
|
|
|
|
func (iv *ImageVerifier) verifyAttestations(
|
|
ctx context.Context,
|
|
imageVerify kyvernov1.ImageVerification,
|
|
imageInfo apiutils.ImageInfo,
|
|
) (*engineapi.RuleResponse, string) {
|
|
image := imageInfo.String()
|
|
for i, attestation := range imageVerify.Attestations {
|
|
var attestationError error
|
|
path := fmt.Sprintf(".attestations[%d]", i)
|
|
|
|
iv.logger.V(2).Info(fmt.Sprintf("attestation %+v", attestation))
|
|
if attestation.Type == "" && attestation.PredicateType == "" {
|
|
return engineapi.RuleFail(iv.rule.Name, engineapi.ImageVerify, path+": missing type"), ""
|
|
}
|
|
|
|
if attestation.Type == "" && attestation.PredicateType != "" {
|
|
attestation.Type = attestation.PredicateType
|
|
}
|
|
|
|
if len(attestation.Attestors) == 0 {
|
|
// add an empty attestor to allow fetching and checking attestations
|
|
attestation.Attestors = []kyvernov1.AttestorSet{{Entries: []kyvernov1.Attestor{{}}}}
|
|
}
|
|
|
|
for j, attestor := range attestation.Attestors {
|
|
attestorPath := fmt.Sprintf("%s.attestors[%d]", path, j)
|
|
requiredCount := attestor.RequiredCount()
|
|
verifiedCount := 0
|
|
|
|
for _, a := range attestor.Entries {
|
|
entryPath := fmt.Sprintf("%s.entries[%d]", attestorPath, i)
|
|
v, opts, subPath := iv.buildVerifier(a, imageVerify, image, &imageVerify.Attestations[i])
|
|
cosignResp, err := v.FetchAttestations(ctx, *opts)
|
|
if err != nil {
|
|
iv.logger.Error(err, "failed to fetch attestations")
|
|
return iv.handleRegistryErrors(image, err), ""
|
|
}
|
|
|
|
if imageInfo.Digest == "" {
|
|
imageInfo.Digest = cosignResp.Digest
|
|
image = imageInfo.String()
|
|
}
|
|
|
|
attestationError = iv.verifyAttestation(cosignResp.Statements, attestation, imageInfo)
|
|
if attestationError != nil {
|
|
attestationError = fmt.Errorf("%s: %w", entryPath+subPath, attestationError)
|
|
return engineapi.RuleFail(iv.rule.Name, engineapi.ImageVerify, attestationError.Error()), ""
|
|
}
|
|
|
|
verifiedCount++
|
|
if verifiedCount >= requiredCount {
|
|
iv.logger.V(2).Info("image attestations verification succeeded", "verifiedCount", verifiedCount, "requiredCount", requiredCount)
|
|
break
|
|
}
|
|
}
|
|
|
|
if verifiedCount < requiredCount {
|
|
msg := fmt.Sprintf("image attestations verification failed, verifiedCount: %v, requiredCount: %v", verifiedCount, requiredCount)
|
|
return engineapi.RuleFail(iv.rule.Name, engineapi.ImageVerify, msg), ""
|
|
}
|
|
}
|
|
|
|
iv.logger.V(4).Info("attestation checks passed", "path", path, "image", imageInfo.String(), "type", attestation.Type)
|
|
}
|
|
|
|
msg := fmt.Sprintf("verified image attestations for %s", image)
|
|
iv.logger.V(2).Info(msg)
|
|
return engineapi.RulePass(iv.rule.Name, engineapi.ImageVerify, msg), imageInfo.Digest
|
|
}
|
|
|
|
func (iv *ImageVerifier) verifyAttestorSet(
|
|
ctx context.Context,
|
|
attestorSet kyvernov1.AttestorSet,
|
|
imageVerify kyvernov1.ImageVerification,
|
|
imageInfo apiutils.ImageInfo,
|
|
path string,
|
|
) (*images.Response, error) {
|
|
var errorList []error
|
|
verifiedCount := 0
|
|
attestorSet = ExpandStaticKeys(attestorSet)
|
|
requiredCount := attestorSet.RequiredCount()
|
|
image := imageInfo.String()
|
|
|
|
for i, a := range attestorSet.Entries {
|
|
var entryError error
|
|
var cosignResp *images.Response
|
|
attestorPath := fmt.Sprintf("%s.entries[%d]", path, i)
|
|
iv.logger.V(4).Info("verifying attestorSet", "path", attestorPath)
|
|
|
|
if a.Attestor != nil {
|
|
nestedAttestorSet, err := kyvernov1.AttestorSetUnmarshal(a.Attestor)
|
|
if err != nil {
|
|
entryError = fmt.Errorf("failed to unmarshal nested attestor %s: %w", attestorPath, err)
|
|
} else {
|
|
attestorPath += ".attestor"
|
|
cosignResp, entryError = iv.verifyAttestorSet(ctx, *nestedAttestorSet, imageVerify, imageInfo, attestorPath)
|
|
}
|
|
} else {
|
|
v, opts, subPath := iv.buildVerifier(a, imageVerify, image, nil)
|
|
cosignResp, entryError = v.VerifySignature(ctx, *opts)
|
|
if entryError != nil {
|
|
entryError = fmt.Errorf("%s: %w", attestorPath+subPath, entryError)
|
|
}
|
|
}
|
|
|
|
if entryError == nil {
|
|
verifiedCount++
|
|
if verifiedCount >= requiredCount {
|
|
iv.logger.V(2).Info("image attestors verification succeeded", "verifiedCount", verifiedCount, "requiredCount", requiredCount)
|
|
return cosignResp, nil
|
|
}
|
|
} else {
|
|
errorList = append(errorList, entryError)
|
|
}
|
|
}
|
|
|
|
err := multierr.Combine(errorList...)
|
|
iv.logger.Info("image attestors verification failed", "verifiedCount", verifiedCount, "requiredCount", requiredCount, "errors", err.Error())
|
|
return nil, err
|
|
}
|
|
|
|
func (iv *ImageVerifier) buildVerifier(
|
|
attestor kyvernov1.Attestor,
|
|
imageVerify kyvernov1.ImageVerification,
|
|
image string,
|
|
attestation *kyvernov1.Attestation,
|
|
) (images.ImageVerifier, *images.Options, string) {
|
|
switch imageVerify.Type {
|
|
case kyvernov1.Notary:
|
|
return iv.buildNotaryVerifier(attestor, imageVerify, image, attestation)
|
|
default:
|
|
return iv.buildCosignVerifier(attestor, imageVerify, image, attestation)
|
|
}
|
|
}
|
|
|
|
func (iv *ImageVerifier) buildCosignVerifier(
|
|
attestor kyvernov1.Attestor,
|
|
imageVerify kyvernov1.ImageVerification,
|
|
image string,
|
|
attestation *kyvernov1.Attestation,
|
|
) (images.ImageVerifier, *images.Options, string) {
|
|
path := ""
|
|
repository := iv.imageSignatureRepository
|
|
if imageVerify.Repository != "" {
|
|
repository = imageVerify.Repository
|
|
}
|
|
opts := &images.Options{
|
|
ImageRef: image,
|
|
Repository: repository,
|
|
Annotations: imageVerify.Annotations,
|
|
Client: iv.rclient,
|
|
}
|
|
|
|
if imageVerify.Roots != "" {
|
|
opts.Roots = imageVerify.Roots
|
|
}
|
|
|
|
if attestation != nil {
|
|
opts.PredicateType = attestation.PredicateType
|
|
opts.Type = attestation.Type
|
|
opts.IgnoreSCT = true // TODO: Add option to allow SCT when attestors are not provided
|
|
if attestation.PredicateType != "" && attestation.Type == "" {
|
|
iv.logger.Info("predicate type has been deprecated, please use type instead")
|
|
opts.Type = attestation.PredicateType
|
|
}
|
|
opts.FetchAttestations = true
|
|
}
|
|
|
|
if attestor.Keys != nil {
|
|
path = path + ".keys"
|
|
if attestor.Keys.PublicKeys != "" {
|
|
opts.Key = attestor.Keys.PublicKeys
|
|
} else if attestor.Keys.Secret != nil {
|
|
opts.Key = fmt.Sprintf("k8s://%s/%s", attestor.Keys.Secret.Namespace, attestor.Keys.Secret.Name)
|
|
} else if attestor.Keys.KMS != "" {
|
|
opts.Key = attestor.Keys.KMS
|
|
}
|
|
if attestor.Keys.Rekor != nil {
|
|
opts.RekorURL = attestor.Keys.Rekor.URL
|
|
opts.RekorPubKey = attestor.Keys.Rekor.RekorPubKey
|
|
opts.IgnoreSCT = attestor.Keys.Rekor.IgnoreSCT
|
|
opts.IgnoreTlog = attestor.Keys.Rekor.IgnoreTlog
|
|
} else {
|
|
opts.RekorURL = "https://rekor.sigstore.dev"
|
|
opts.IgnoreSCT = false
|
|
opts.IgnoreTlog = false
|
|
}
|
|
opts.SignatureAlgorithm = attestor.Keys.SignatureAlgorithm
|
|
} else if attestor.Certificates != nil {
|
|
path = path + ".certificates"
|
|
opts.Cert = attestor.Certificates.Certificate
|
|
opts.CertChain = attestor.Certificates.CertificateChain
|
|
if attestor.Certificates.Rekor != nil {
|
|
opts.RekorURL = attestor.Certificates.Rekor.URL
|
|
}
|
|
} else if attestor.Keyless != nil {
|
|
path = path + ".keyless"
|
|
if attestor.Keyless.Rekor != nil {
|
|
opts.RekorURL = attestor.Keyless.Rekor.URL
|
|
opts.RekorPubKey = attestor.Keyless.Rekor.RekorPubKey
|
|
opts.IgnoreSCT = attestor.Keyless.Rekor.IgnoreSCT
|
|
opts.IgnoreTlog = attestor.Keyless.Rekor.IgnoreTlog
|
|
} else {
|
|
opts.RekorURL = "https://rekor.sigstore.dev"
|
|
opts.IgnoreSCT = false
|
|
opts.IgnoreTlog = false
|
|
}
|
|
|
|
opts.Roots = attestor.Keyless.Roots
|
|
opts.Issuer = attestor.Keyless.Issuer
|
|
opts.Subject = attestor.Keyless.Subject
|
|
opts.AdditionalExtensions = attestor.Keyless.AdditionalExtensions
|
|
}
|
|
|
|
if attestor.Repository != "" {
|
|
opts.Repository = attestor.Repository
|
|
}
|
|
|
|
if attestor.Annotations != nil {
|
|
opts.Annotations = attestor.Annotations
|
|
}
|
|
|
|
return cosign.NewVerifier(), opts, path
|
|
}
|
|
|
|
func (iv *ImageVerifier) buildNotaryVerifier(
|
|
attestor kyvernov1.Attestor,
|
|
imageVerify kyvernov1.ImageVerification,
|
|
image string,
|
|
attestation *kyvernov1.Attestation,
|
|
) (images.ImageVerifier, *images.Options, string) {
|
|
path := ""
|
|
opts := &images.Options{
|
|
ImageRef: image,
|
|
Cert: attestor.Certificates.Certificate,
|
|
CertChain: attestor.Certificates.CertificateChain,
|
|
Client: iv.rclient,
|
|
}
|
|
|
|
if attestation != nil {
|
|
opts.Type = attestation.Type
|
|
opts.PredicateType = attestation.PredicateType
|
|
if attestation.PredicateType != "" && attestation.Type == "" {
|
|
iv.logger.Info("predicate type has been deprecated, please use type instead")
|
|
opts.Type = attestation.PredicateType
|
|
}
|
|
opts.FetchAttestations = true
|
|
}
|
|
|
|
if attestor.Repository != "" {
|
|
opts.Repository = attestor.Repository
|
|
}
|
|
|
|
if attestor.Annotations != nil {
|
|
opts.Annotations = attestor.Annotations
|
|
}
|
|
|
|
return notary.NewVerifier(), opts, path
|
|
}
|
|
|
|
func (iv *ImageVerifier) verifyAttestation(statements []map[string]interface{}, attestation kyvernov1.Attestation, imageInfo apiutils.ImageInfo) error {
|
|
if attestation.Type == "" && attestation.PredicateType == "" {
|
|
return fmt.Errorf("a type is required")
|
|
}
|
|
image := imageInfo.String()
|
|
statementsByPredicate, types := buildStatementMap(statements)
|
|
iv.logger.V(4).Info("checking attestations", "predicates", types, "image", image)
|
|
statements = statementsByPredicate[attestation.Type]
|
|
if statements == nil {
|
|
iv.logger.Info("no attestations found for predicate", "type", attestation.Type, "predicates", types, "image", imageInfo.String())
|
|
return fmt.Errorf("attestions not found for predicate type %s", attestation.Type)
|
|
}
|
|
for _, s := range statements {
|
|
iv.logger.Info("checking attestation", "predicates", types, "image", imageInfo.String())
|
|
val, msg, err := iv.checkAttestations(attestation, s)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to check attestations: %w", err)
|
|
}
|
|
if !val {
|
|
return fmt.Errorf("attestation checks failed for %s and predicate %s: %s", imageInfo.String(), attestation.Type, msg)
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (iv *ImageVerifier) checkAttestations(a kyvernov1.Attestation, s map[string]interface{}) (bool, string, error) {
|
|
if len(a.Conditions) == 0 {
|
|
return true, "", nil
|
|
}
|
|
iv.policyContext.JSONContext().Checkpoint()
|
|
defer iv.policyContext.JSONContext().Restore()
|
|
return EvaluateConditions(a.Conditions, iv.policyContext.JSONContext(), s, iv.logger)
|
|
}
|
|
|
|
func (iv *ImageVerifier) handleMutateDigest(ctx context.Context, digest string, imageInfo apiutils.ImageInfo) (*jsonpatch.JsonPatchOperation, string, error) {
|
|
if imageInfo.Digest != "" {
|
|
return nil, "", nil
|
|
}
|
|
if digest == "" {
|
|
desc, err := iv.rclient.FetchImageDescriptor(ctx, imageInfo.String())
|
|
if err != nil {
|
|
return nil, "", err
|
|
}
|
|
digest = desc.Digest.String()
|
|
}
|
|
patch := makeAddDigestPatch(imageInfo, digest)
|
|
iv.logger.V(4).Info("adding digest patch", "image", imageInfo.String(), "patch", patch.Json())
|
|
return &patch, digest, nil
|
|
}
|