Some checks failed
validate / Rego (opa fmt + opa test) (push) Successful in 16s
validate / JSON Schema (ajv) (push) Successful in 20s
build-images / signing-service image (push) Successful in 24s
validate / DB (migrate up/down dry-run) (push) Failing after 26s
validate / Go (vet + test) (push) Successful in 1m16s
Adds services/verification-service exposing POST /api/v1/verify/chain for sink:dummy-sink. The handler runs the six hard-coded chain checks described in DEV-612 and reserves decision_id in a new `verification_decisions` table so a replayed sink delivery is refused without recomputing signatures. - DSSE signature verification against configurable approval + transform signer key_ids, loaded from VERIFICATION_SIGNER_KEYS (pem/hex/b64/b64u) - RFC 6962 inclusion-proof verifier (shared leaf/node hashing with services/transparency-log/pkg/backend) - Content binding: subject.digest.sha256 must match predicate.content_hash (approval) and request.payload_hash (transform) - Hard-coded coverage of allowed_transformations / allowed_sinks / expires_at predicates (OPA deferred to Phase 2 per the subtask) - Replay guard via new db/trust/migrations/0005_verification_decisions (in-memory store ships; Postgres skeleton mirrors sibling pattern) - Dockerfile mirrors signing-service pattern (distroless static + nonroot) - README documents endpoint, reason-code taxonomy, required predicate fields, and the Phase-2 non-scope Tests: happy path + 7 negatives (bad signature, missing inclusion proof, hash drift, sink not allowed, expired, replay, operation not allowed). Co-Authored-By: Paperclip <noreply@paperclip.ing>
31 lines
719 B
Go
31 lines
719 B
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestMemory_Reserve_Idempotent(t *testing.T) {
|
|
m := NewMemory()
|
|
d := Decision{
|
|
DecisionID: "dec-1",
|
|
ApprovalRef: "sha256:aaaa",
|
|
TransformRef: "sha256:bbbb",
|
|
PayloadHash: "sha256:cccc",
|
|
SinkTarget: "sink:dummy-sink",
|
|
CreatedAt: time.Now(),
|
|
}
|
|
if err := m.Reserve(context.Background(), d); err != nil {
|
|
t.Fatalf("first reserve: %v", err)
|
|
}
|
|
err := m.Reserve(context.Background(), d)
|
|
if !errors.Is(err, ErrReplay) {
|
|
t.Fatalf("second reserve: want ErrReplay, got %v", err)
|
|
}
|
|
got, ok, _ := m.Get(context.Background(), "dec-1")
|
|
if !ok || got.ApprovalRef != d.ApprovalRef {
|
|
t.Fatalf("get: ok=%v, got=%+v", ok, got)
|
|
}
|
|
}
|