Some checks failed
Veza CI / Backend (Go) (push) Waiting to run
Veza CI / Frontend (Web) (push) Waiting to run
Veza CI / Notify on failure (push) Blocked by required conditions
Security Scan / Secret Scanning (gitleaks) (push) Failing after 3m4s
Veza CI / Rust (Stream Server) (push) Has been cancelled
Backend API CI / test-integration (push) Failing after 11m59s
Backend API CI / test-unit (push) Failing after 12m1s
backend-ci.yml's `test -z "$(gofmt -l .)"` strict gate (added in
c96edd692) failed on a backlog of unformatted files. None of the
85 files in this commit had been edited since the gate was added
because no push touched veza-backend-api/** in between, so the
gate never fired until today's CI fixes triggered it.
The diff is exclusively whitespace alignment in struct literals
and trailing-space comments. `go build ./...` and the full test
suite (with VEZA_SKIP_INTEGRATION=1 -short) pass identically.
27 lines
762 B
Go
27 lines
762 B
Go
package handlers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
// FuzzLoginPayload fuzzes the login request parsing.
|
|
// The handler should never panic on any input.
|
|
func FuzzLoginPayload(f *testing.F) {
|
|
f.Add([]byte(`{"email":"test@test.com","password":"Pass123!"}`))
|
|
f.Add([]byte(`{"email":"","password":""}`))
|
|
f.Add([]byte(`{}`))
|
|
f.Add([]byte(`invalid json`))
|
|
f.Add([]byte(""))
|
|
f.Add([]byte(`{"email":null,"password":123}`))
|
|
f.Add([]byte(`{"email":"a@b.c","password":"` + string(make([]byte, 10000)) + `"}`))
|
|
|
|
f.Fuzz(func(t *testing.T, data []byte) {
|
|
// Verify that JSON parsing of arbitrary payloads never panics
|
|
var payload struct {
|
|
Email string `json:"email"`
|
|
Password string `json:"password"`
|
|
}
|
|
_ = json.Unmarshal(data, &payload)
|
|
})
|
|
}
|