git » chasquid » commit 9f603da

auth: Fuzz testing

author Alberto Bertogli
2017-04-22 13:52:18 UTC
committer Alberto Bertogli
2018-03-30 21:33:53 UTC
parent e543a03feb9af6cb8d05741b5bcf467fe6ebb515

auth: Fuzz testing

internal/auth/fuzz.go +16 -0
internal/auth/testdata/fuzz/corpus/t-001 +1 -0
internal/auth/testdata/fuzz/corpus/t-002 +1 -0
internal/auth/testdata/fuzz/corpus/t-003 +1 -0
internal/auth/testdata/fuzz/corpus/t-004 +1 -0
internal/auth/testdata/fuzz/corpus/t-005 +1 -0
internal/auth/testdata/fuzz/corpus/t-006 +1 -0
internal/auth/testdata/fuzz/corpus/x-001 +0 -0
internal/auth/testdata/fuzz/corpus/x-002 +0 -0
internal/auth/testdata/fuzz/corpus/x-003 +0 -0
internal/auth/testdata/fuzz/corpus/x-004 +0 -0

diff --git a/internal/auth/fuzz.go b/internal/auth/fuzz.go
new file mode 100644
index 0000000..f43cedc
--- /dev/null
+++ b/internal/auth/fuzz.go
@@ -0,0 +1,16 @@
+// Fuzz testing for package aliases.
+
+// +build gofuzz
+
+package auth
+
+func Fuzz(data []byte) int {
+	//	user, domain, passwd, err := DecodeResponse(string(data))
+	interesting := 0
+	_, _, _, err := DecodeResponse(string(data))
+	if err == nil {
+		interesting = 1
+	}
+
+	return interesting
+}
diff --git a/internal/auth/testdata/fuzz/corpus/t-001 b/internal/auth/testdata/fuzz/corpus/t-001
new file mode 100644
index 0000000..0000c7b
--- /dev/null
+++ b/internal/auth/testdata/fuzz/corpus/t-001
@@ -0,0 +1 @@
+dUBkAHVAZABwYXNz
\ No newline at end of file
diff --git a/internal/auth/testdata/fuzz/corpus/t-002 b/internal/auth/testdata/fuzz/corpus/t-002
new file mode 100644
index 0000000..0b6aaca
--- /dev/null
+++ b/internal/auth/testdata/fuzz/corpus/t-002
@@ -0,0 +1 @@
+dUBkAABwYXNz
\ No newline at end of file
diff --git a/internal/auth/testdata/fuzz/corpus/t-003 b/internal/auth/testdata/fuzz/corpus/t-003
new file mode 100644
index 0000000..cbc87b2
--- /dev/null
+++ b/internal/auth/testdata/fuzz/corpus/t-003
@@ -0,0 +1 @@
+AHVAZABwYXNz
\ No newline at end of file
diff --git a/internal/auth/testdata/fuzz/corpus/t-004 b/internal/auth/testdata/fuzz/corpus/t-004
new file mode 100644
index 0000000..c0769a7
--- /dev/null
+++ b/internal/auth/testdata/fuzz/corpus/t-004
@@ -0,0 +1 @@
+dUBkAABwYXNz/w==
\ No newline at end of file
diff --git a/internal/auth/testdata/fuzz/corpus/t-005 b/internal/auth/testdata/fuzz/corpus/t-005
new file mode 100644
index 0000000..0c2b94c
--- /dev/null
+++ b/internal/auth/testdata/fuzz/corpus/t-005
@@ -0,0 +1 @@
+w7FhY2FAw7FlcXVlAABjbGF2YXLDqQ==
\ No newline at end of file
diff --git a/internal/auth/testdata/fuzz/corpus/t-006 b/internal/auth/testdata/fuzz/corpus/t-006
new file mode 100644
index 0000000..e8b9804
--- /dev/null
+++ b/internal/auth/testdata/fuzz/corpus/t-006
@@ -0,0 +1 @@
+this is not base64 encoded
\ No newline at end of file
diff --git a/internal/auth/testdata/fuzz/corpus/x-001 b/internal/auth/testdata/fuzz/corpus/x-001
new file mode 100644
index 0000000..7ea8e3e
Binary files /dev/null and b/internal/auth/testdata/fuzz/corpus/x-001 differ
diff --git a/internal/auth/testdata/fuzz/corpus/x-002 b/internal/auth/testdata/fuzz/corpus/x-002
new file mode 100644
index 0000000..46dca62
Binary files /dev/null and b/internal/auth/testdata/fuzz/corpus/x-002 differ
diff --git a/internal/auth/testdata/fuzz/corpus/x-003 b/internal/auth/testdata/fuzz/corpus/x-003
new file mode 100644
index 0000000..9d30f6b
Binary files /dev/null and b/internal/auth/testdata/fuzz/corpus/x-003 differ
diff --git a/internal/auth/testdata/fuzz/corpus/x-004 b/internal/auth/testdata/fuzz/corpus/x-004
new file mode 100644
index 0000000..a2e1e4e
Binary files /dev/null and b/internal/auth/testdata/fuzz/corpus/x-004 differ