mirror of
https://github.com/gravitational/teleport.git
synced 2026-11-04 01:23:29 +08:00
* Remove lib/fuzz These fuzz targets are already configured elsewhere. oss-fuzz targets are configured in `fuzz/oss-fuzz-build.sh` * aws_test.go: Add FuzzParseSigV4 This adds (and enables in oss-fuzz) a new fuzz test case (and seed) for aws.go's ParseSigV4 * api/types/fuzz_test.go: Add fuzzing seeds * api/utils/aws/fuzz_test.go: Add basic seeds to get broad coverage * api/utils/azure/fuzz_test.go: Add seeds and enable in oss-fuzz * lib/utils/parse/fuzz_test.go: Add fuzzing seeds * Add opensearch fuzzing to oss-fuzz * lib/srv/db/redis/connection/fuzz_test.go: Add fuzzing seeds * lib/kube/proxy/fuzz_test.go: Add fuzzing seeds * lib/srv/regular/fuzz_test.go: Add Fuzzing Seeds * lib/utils/fuzz_test.go: Add fuzzing seeds
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
/*
|
|
Copyright 2022 Gravitational, Inc.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package parse
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func FuzzNewExpression(f *testing.F) {
|
|
f.Add("")
|
|
f.Add("foo")
|
|
f.Add("{{external.foo}}")
|
|
f.Add(`{{regexp.replace(internal.foo, "foo-(.*)-(.*)", "$1.$2")}}`)
|
|
|
|
f.Fuzz(func(t *testing.T, variable string) {
|
|
require.NotPanics(t, func() {
|
|
NewTraitsTemplateExpression(variable)
|
|
})
|
|
})
|
|
}
|
|
|
|
func FuzzNewMatcher(f *testing.F) {
|
|
f.Add("")
|
|
f.Add("foo")
|
|
f.Add("*")
|
|
f.Add("^foo$")
|
|
f.Add(`{{regexp.match("foo.*")}}`)
|
|
|
|
f.Fuzz(func(t *testing.T, value string) {
|
|
require.NotPanics(t, func() {
|
|
NewMatcher(value)
|
|
})
|
|
})
|
|
}
|