Conversation
Collaborator
Author
|
I added custom mutators on multiple fields and can now fuzz on pod, containers and initContainers securityContext fields. EphemeralContainers cannot be specified at creation, unfortunately (which makes sense). You can use the feature with: while true; do ./kdigger gen --fuzz-pod --fuzz-init --fuzz-container | kubectl apply --dry-run=server -f -; doneIt can be useful to just Or just look at an example with: ./kdigger gen --fuzz-pod --fuzz-init --fuzz-containerThe custom mutators can still be improved to provide more sensible outputs but they should not generate invalid pods spec. |
It uses google/gofuzz to generate a random but somehow valid SecurityContext that can be injected in a pod's manifest. It can generate a pod securityContext, a container securityContext and an initContainer securityContext.
Collaborator
Author
|
Sweet!Sent from my iPhoneOn 2 Dec 2022, at 15:56, Mahé ***@***.***> wrote:
I should have asked a chatbot...
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

POC for #10.
The idea would be to generate a random valid manifest in order to fuzz the admission control. Not in a traditional fuzzing sense, like finding crashes and bugs in the implementation of the admission, but finding loopholes in the admission rules.
It uses
google/gofuzzand custom fuzzing functions to generate a random but somehow validv1.SecurityContextthat can be injected into a pod's manifest.This POC should be extended to support more fields, like stated in the original idea issue:
In order to test this POC, checkout to the
fuzzbranch, compile withmakeand generate random SecurityContext with./kdigger gen -f. You can generate multiples with something like that for example:You can check against the API server if they are valid with:
./kdigger gen -f | kubectl apply --dry-run=server -f -And by the way, I need to do an update on the main branch to scan the admission control with
--dry-runby default.