-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into subscriber-fuzz
- Loading branch information
Showing
1,153 changed files
with
2,727 additions
and
199,196 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package utils | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func FuzzSanitizeString(f *testing.F) { | ||
f.Fuzz(func(t *testing.T, input string) { | ||
err := ValidateStrictPassword(input) | ||
if err != nil { | ||
if isExpectedError(err) { | ||
fmt.Printf("Expected validation failure for input '%s': %v\n", input, err) | ||
} else { | ||
fmt.Printf("Unexpected validation failure for input '%s': %v\n", input, err) | ||
} | ||
} | ||
}) | ||
} | ||
|
||
func isExpectedError(err error) bool { | ||
expectedErrors := []string{ | ||
"password is less than 8 characters", | ||
"password does not contain digits", | ||
"password does not contain lowercase alphabets", | ||
"password does not contain uppercase alphabets", | ||
"password does not contain special characters", | ||
} | ||
|
||
for _, expected := range expectedErrors { | ||
if err.Error() == expected { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.