- server: relay storing signed objects (PUT/GET), per-IP rate limiting, per-subject quota (1000), one-response-per-request, pagination, /v1/healthz /v1/readyz /v1/metrics - verify: signature-verifying trust evaluator; every object is checked via env.Verify(), approvals via VerifyApprovalResponse, revocations via VerifyRevocationOf; k-of-n approval quorum - docs: TRUST-MODEL.md and API.md describing issuer-anchored signatures and the endpoint/status-code contract - tests: server, verify, and ratelimit packages
50 lines
1.6 KiB
Go
50 lines
1.6 KiB
Go
//go:build gofuzz
|
|
|
|
package protocol
|
|
|
|
import "bytes"
|
|
|
|
// Fuzz is the OSS-Fuzz entry point for the six protocol objects. It asserts the
|
|
// injection property of PROTOCOL.md section 12.4: any byte string that decodes
|
|
// must be exactly the canonical encoding of the object decoded from it, so a
|
|
// signature cannot be transplanted between two byte strings that denote one
|
|
// object (encode(decode(b)) == b). The decoder is total: a decode error never
|
|
// yields a usable object.
|
|
//
|
|
// Compiled only under the "gofuzz" build tag (go-fuzz / OSS-Fuzz); the
|
|
// testing.F-based targets in the package's test files are excluded there.
|
|
func Fuzz(data []byte) int {
|
|
interesting := 0
|
|
|
|
if o, err := DecodeIdentity(data); err == nil {
|
|
if out, e := EncodeIdentity(o); e == nil && bytes.Equal(out, data) {
|
|
interesting = 1
|
|
}
|
|
}
|
|
if o, err := DecodeClaim(data); err == nil {
|
|
if out, e := EncodeClaim(o); e == nil && bytes.Equal(out, data) {
|
|
interesting = 1
|
|
}
|
|
}
|
|
if o, err := DecodeRevocation(data); err == nil {
|
|
if out, e := EncodeRevocation(o); e == nil && bytes.Equal(out, data) {
|
|
interesting = 1
|
|
}
|
|
}
|
|
if o, err := DecodeApprovalRequest(data); err == nil {
|
|
if out, e := EncodeApprovalRequest(o); e == nil && bytes.Equal(out, data) {
|
|
interesting = 1
|
|
}
|
|
}
|
|
if o, err := DecodeApprovalResponse(data); err == nil {
|
|
if out, e := EncodeApprovalResponse(o); e == nil && bytes.Equal(out, data) {
|
|
interesting = 1
|
|
}
|
|
}
|
|
if o, err := DecodeAuthAssertion(data); err == nil {
|
|
if out, e := EncodeAuthAssertion(o); e == nil && bytes.Equal(out, data) {
|
|
interesting = 1
|
|
}
|
|
}
|
|
return interesting
|
|
}
|