mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
080a96fed4
* Refactor fuzzing utils and add 3 fuzzers Signed-off-by: AdamKorcz <adam@adalogics.com> * Fix lint issues Signed-off-by: AdamKorcz <adam@adalogics.com> * use latest go-jmespath Signed-off-by: AdamKorcz <adam@adalogics.com> * Check layer size (#8552) * fix excessive logs Signed-off-by: Jim Bugwadia <jim@nirmata.com> * check fetched layer size Signed-off-by: Jim Bugwadia <jim@nirmata.com> * check sig layer size Signed-off-by: Jim Bugwadia <jim@nirmata.com> --------- Signed-off-by: Jim Bugwadia <jim@nirmata.com> Signed-off-by: AdamKorcz <adam@adalogics.com> * fix lint issues Signed-off-by: AdamKorcz <adam@adalogics.com> --------- Signed-off-by: AdamKorcz <adam@adalogics.com> Signed-off-by: Jim Bugwadia <jim@nirmata.com> Co-authored-by: Jim Bugwadia <jim@nirmata.com>
24 lines
541 B
Go
24 lines
541 B
Go
package fuzz
|
|
|
|
import (
|
|
"strings"
|
|
|
|
fuzz "github.com/AdaLogics/go-fuzz-headers"
|
|
)
|
|
|
|
func GetK8sString(ff *fuzz.ConsumeFuzzer) (string, error) {
|
|
allowedChars := []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.")
|
|
stringLength, err := ff.GetInt()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
var sb strings.Builder
|
|
for i := 0; i < stringLength%63; i++ {
|
|
charIndex, err := ff.GetInt()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
sb.WriteString(string(allowedChars[charIndex%len(allowedChars)]))
|
|
}
|
|
return sb.String(), nil
|
|
}
|