Released: TBD Compare: v0.12.0-alpha.14…v0.12.0-alpha.15
alpha.15 is the opt-in event-validation release — community spec #247,
ADR 0029, shipped end-to-end in one PR (#257, merge 006a975) across
nine sub-issues (#248–#256). Until now goSignals validated a SET only as a
token — signature, iss, aud — and forwarded whatever payload rode inside
it. A receiver that trusted goSignals inherited every malformed payload its
upstream transmitters emitted. This release adds a transport-neutral validator
registry (pkg/goSetValidate) and a per-receiver-stream event_validation
mode, so an operator can say “if I recognize the event type, the payload had
better be well-formed” — or, at the firewall end of the dial, “only events on
my negotiated contract and vouched for by a validator reach my downstream”.
The feature is inert by default and this is a zero-behavior-change upgrade
for validation purposes. The mode enum is NONE | WARN | ENFORCE | STRICT,
defaulting to NONE, which is exactly today’s content-agnostic forwarding —
no validator set is even built. WARN is the staged-rollout step (wire-
invisible; a WARN log plus the new goSignals_router_event_validation_total
counter is the only signal), ENFORCE rejects recognized-but-malformed events
while still forwarding unknown types, and STRICT additionally rejects
anything out-of-contract or unvalidatable. The knob lives on the internal
StreamStateRecord (deliberately off the SSF wire-format
StreamConfiguration, alongside DefaultSubjects /
RetentionWindowDays / SubjectRemovalGraceSeconds), with a server-wide
default from I2SIG_STREAM_EVENT_VALIDATION. It is receive-side only,
applies identically on RFC 8936 poll, RFC 8935 push and SSTP, and on a
bidirectional SSTP pair record the single field governs the inbound leg
(COM-ADR 0018).
Spec #247 is a community-only enhancement — it creates no cross-repo slice
and no consumer issue in any sister repo. Every library hook is additive
only: goSetPush.ReceiverConfig, goSetPoll.ReceiverConfig and
goSetSstp.VerifyConfig each gain one optional Validators field where nil
reproduces today’s behavior exactly, no constructor or function signature
moves (a compile-time assertion in the pkg test fails the build if
VerifySET’s does), and the existing SSTP suite passes unmodified. Enterprise
and admin recompile unchanged at this tag. Two behavior changes do warrant
reading before upgrading — events_requested semantics (an omitted set now
means “everything” rather than “nothing”, and a wildcard is enumerated rather
than echoed back) and the delivery-path rejection handling, both detailed in
their own sections below.
pkg/goSetValidate — the validation seampkg/ssfModels
(impl f59ee00). Prefactor. Lifts the registration-time
events_requested → events_delivered semantics out of the unexported
(*StreamService).calculateDeliveredEvents into two pure exported functions
on pkg/ssfModels — MatchDeliveredEvents(requested, supported []string)
and MatchesEventPattern(pattern, eventUri string). The stream service and
the goSignals CLI’s calculateEvents both delegate, so exactly one
implementation of the pattern → URI semantics remains (spec story 20, “no
second profile-selection config surface”). Additive to pkg/ssfModels;
make seams green.pkg/goSetValidate registry, ParseAndValidate, SSF
stream-management validators (impl 7931f6e). The seam itself, with no
wiring into any transport — after this commit the server behaves exactly as
before. Exposes Disposition (Valid / Unsupported / Malformed,
declared in ascending severity so the whole-SET “worst disposition wins”
reduction is a max), Result / SetResult, the Validator /
ValidatorFunc per-event-type interface, Registry (NewRegistry,
BuiltinRegistry, chaining Register, Lookup — BuiltinRegistry hands
back a fresh instance so one embedder’s registrations cannot mutate
another’s view), ValidatorSet (a registry narrowed to one stream’s engaged
URIs, nil-safe Validate), and ParseAndValidate, which composes the
verified goSet.Parse (ADR-0066 §D3 — never Peek) with payload
validation; a nil ValidatorSet degrades to exactly goSet.Parse plus a
zero SetResult.NewValidatorSet engages both unconditionally,
so a narrowly-scoped STRICT stream can never reject its own verification
handshake. (SSF §8.1.5 permits a Stream Updated event that appears in none
of events_supported / events_requested / events_delivered.)pkg/goSet, pkg/goSet/events, stdlib and keyfunc — no stream state,
nothing under internal/. TestPackageImportBoundary parses the package’s
own sources and fails if a new import escapes the allowlist, so the
standalone-consumption promise (spec story 16) is checkable.docs/adr/0029-event-validation-mode-and-validator-registry.md
records the mode enum and the registry-derivation decisions;
docs/contracts/spec-247-goSetValidate-surface.md freezes the exported
surface for the wiring slices; CONTEXT.md gains the Event validation mode
and SSF stream-management events glossary entries (929edc5).event_validation knobevent_validation knob + server default (impl
33179da). Settable and persisted, not yet enforced — no validators are
engaged and no event is rejected by this change alone.
pkg/ssfModels.EventValidationMode is a closed enum with case-insensitive
ParseEventValidationMode and Valid(); StreamStateRecord gains
EventValidation, carried by DeepCopy/Update.StreamServiceConfig.EventValidationDefault, wired
from I2SIG_STREAM_EVENT_VALIDATION through envcompat.Lookup in both
the memory and mongo providers’ service_config.go — the route every other
I2SIG_STREAM_* variable takes (ADR 0011 taxonomy). An unrecognized value
resolves to NONE with a WARN. An empty per-stream value resolves against
the server default at read time (ResolveEventValidation).WARN-logged
and dropped while the stream still creates/updates — the existing
SubjectRemovalGraceSeconds wrong-direction precedent. On an SSTP pair the
single field is honored whether the patch targets the pair or the inbound
SID, and governs the inbound leg (COM-ADR 0018: one bidirectional
StreamStateRecord per pair).subject_removal_grace_seconds is surfaced.
docs/configuration_properties.md documents the variable, its accepted
values and its default.event_validation on push and poll receivers (impl
69099c1). The first slice with observable behavior.
goSetPush.ReceiverConfig and goSetPoll.ReceiverConfig each gain one
Validators *goSetValidate.ValidatorSet field; ReceivedSET gains
Validation and ParsedPollResponse gains Validations (keyed by JTI), so
computed dispositions reach the caller that owns policy. The libraries
compute and report — they never reject and never map a disposition to a wire
error. Validation runs only after alg/iss/aud/signature are settled,
so a trust failure can never be reported as a payload defect.internal/server.
applyEventValidation is the single place the #247 mode × disposition matrix
is written down. Push rejects with HTTP 400 and an RFC 8935 §2.4
invalid_request body naming the offending event URI and failing claim,
before the push monitor or the event router sees the SET. Poll puts the jti
in the next poll’s setErrs with the same code (RFC 8936 §7.1.2 shares the
registry) instead of acking it; other jtis in the batch ack normally. WARN
is wire-invisible (202/ack plus a WARN log carrying jti, event URI and the
failed check); Unsupported logs at DEBUG.events_delivered via
the exported ssfModels matcher from #248, so pkg/goSetValidate keeps its
standalone import boundary. NONE builds no validator set at all — the
default posture is the pre-#247 receive path, not “validate and discard the
answer”.event_validation on the SSTP acceptor and dialer (impl
dc7dee7). goSetSstp.VerifyConfig gains one Validators field and
VerifiedSET gains Validation; VerifySET’s signature does not move (a
compile-time assertion fails the build if it ever does) and a nil
Validators reproduces today’s behavior exactly — this is its own slice
precisely because pkg/goSetSstp has live out-of-tree consumers.
Engagement is computed from SstpInbound.EventsDelivered, never the
transmit leg’s (the test fixture deliberately populates the transmit leg
with a different event set so a wrong-leg read fails).setErr carrying invalid_request before the SET reaches the router, other
JTIs in the same message unaffected; the dialer’s inbound half does the same
and the rejection rides the next request’s setErrs. Acks and setErrs
now travel together as one sstpPendingFeedback value — every inbound JTI
ends in exactly one of them and both share a lifecycle (discharged on a
peer-accepted exchange, preserved across 4xx/transport/weird). The dialer
inherits the server default via a new
SstpDialerConfig.EventValidationDefault.goSignals_router_event_validation_total, labeled
disposition × mode × transport (push, poll, sstp — one label for
both SSTP paths, so “how much is my SSTP fleet rejecting” is a lookup rather
than a sum). Deliberately not labeled by stream_id or event URI —
either would make the series count unbounded on a busy receiver. Recorded in
docs/Metrics.md.d733f24). The five catalog-advertised CAEP
event types: session-revoked, token-claims-change, credential-change,
assurance-level-change, device-compliance-change. Required-claim presence,
claim type/format, the closed vocabularies CAEP defines (change_type,
change_direction, device compliance statuses, initiating_entity), and
structural subject shape via pkg/subjectid — normally the SET’s top-level
sub_id, with the earlier in-payload subject shape accepted when present.
credential_type and namespace stay open vocabularies (CAEP permits
any other mutually agreed value). The CAEP URIs are re-declared inside
pkg/goSetValidate because pkg/ssfModels is outside the import allowlist;
a drift-guard test in pkg/ssfModels keeps catalog and pack in agreement.cffc423). The nine catalog-advertised RISC
types. Both subject carriers are accepted — RISC’s in-payload subject
claim and SSF’s top-level sub_id — so an older RISC transmitter is not
reported malformed. The identifier events carry the interesting constraints:
RISC 2.5/2.6 require an email-or-phone subject type, 2.5 additionally
requires the old value, and new-value is type- and format-checked against
the subject’s identifier type; 2.6 defines no attributes, so a new-value
there is an unknown extra claim and passes. account-disabled’s reason
vocabulary is open, so only its shape is checked.e45e6ff). The
catalog-correctness pass this issue asked for first: every SCIM event URN was
checked against published RFC 9967, and no URN changed from the
draft-ietf-scim-events-16 spellings — all twelve are byte-identical
(including the all-lowercase scim NSS and asyncresp, already corrected in
v0.12.0-alpha.4), and RFC 9967 defines no additional SCIM event type. The
claim is checkable rather than asserted:
TestScimEventUris_MatchRfc9967 pins each URN literal with the RFC section
that defines it. The pass did find two in-repo divergences, both fixed:
cmd/goSignals generated demo events under an uppercase-NSS
urn:ietf:params:SCIM:event:... the server never advertises (now uses the
model constants), and the full-form payload attribute was emitted as Data
where RFC 9967 §2.4 names it data. Subject validation uses Kind as the
structural gate rather than CanonicalKey, because scim is not an RFC 9493
registered format and CanonicalKey would report every conformant SCIM event
malformed.2b44839). Carries the payload
validation from closed PR #245 forward into the generalized seam as an
EXPERIMENTAL pack — WISE is an unadopted proposal, so the pack makes no
conformance claim and carries no stability promise. Four event types:
credential-revoked, credential-compromise, trust-anchor-changed,
workload-compromised. What is deliberately not carried over is #245’s
recommended-action / incident-response policy (WISERecommendedAction):
which response a finding warrants is the receiving deployment’s call, bound
to its own authorization and audit controls, and a test asserts reason and
change_type cannot change the reported Result.d3f5f72).
Engagement intersects events_delivered with model.GetSupportedEvents(),
which listed SCIM/CAEP/RISC but no WISE — so a WISE URI was filtered out and
short-circuited to Unsupported before reaching registry.Lookup, meaning a
malformed WISE payload was forwarded unvalidated under ENFORCE and a
well-formed one rejected under STRICT. Only the four validated types
are advertised: advertising one without a validator would resolve as
Unsupported and be rejected by a STRICT receiver, so the catalog stays
aligned with what the pack can vouch for. Drift guard mirrors the existing
CAEP/RISC coverage tests.events_requested / events_delivered semantics (behavior change)events_requested now defaults to the full supported catalog
(7d103ba). Previously a create with the optional field absent (SSF 1.0
§7.1.1) left both events_requested and events_delivered empty, so the
stream registered successfully and then delivered nothing — never what
the receiver intended. Applied to all three registration paths (SSF create,
receiver registration against a remote transmitter, SSTP pair bootstrap) and
to UpdateStream, where an empty events_requested still means “not
patched”; the patch now re-negotiates against the stream’s own catalog
rather than the request’s absent read-only events_supported, which
previously emptied events_delivered."*" is a non-standard goSignals
shorthand accepted on the request only — events_requested and
events_delivered are defined as sets of event type URIs, so a returned or
persisted configuration now enumerates the URIs a pattern selects. Explicit
non-wildcard URIs are still preserved verbatim, including unsupported ones:
events_requested records what was asked for, events_delivered the subset
granted. Event sets are also copied on assignment, so the three fields no
longer share a backing array via the "*" fast path.c2da1be then d527dde). An intermediate fix quoted regex
metacharacters so "*" was the only metacharacter, which turned out to be a
capability regression — the CLI and its tests have relied on alternation
(*:event:(feed|sig):*) since the matcher was introduced — so
MatchesEventPattern is back to regex with the trade-off documented, and the
defect that motivated the change is fixed properly: a pattern that fails to
compile used to match nothing silently, registering a stream with a
narrower events_delivered than was asked for and no error anywhere. New
model.ValidateEventPatterns is called from CreateStream, UpdateStream
and validateSstpDirection before any state is mutated, and
services.ErrInvalidRequest lets the handlers answer the 400 they already
document instead of a catch-all 500. The CLI --events help documents the
regex language.15ec074): expandRequestedEvents treats an entry as a pattern
when it selects a supported URI it is not equal to, not merely when it
contains "*", so a legal alternation is no longer echoed verbatim into a
field SSF 1.0 §7.1.1 defines as a set of URIs. An unmatched pattern is still
dropped and an unsupported concrete URI still preserved.Adding a receiver-side rejection made the delivery paths’ handling of per-SET rejections load-bearing for the first time, and it was wrong in three places. Acking a SET is permanent, and all three paths cleared events on any rejection code — so a peer-side key rotation or a receiver misconfiguration became silent, unbounded event loss with the stream still reporting healthy.
invalid_request (3f87e13).
dispatchPushFailure classified RFC 8935 §2.4 invalid_request as
ClassRFC8935Error and disabled the whole stream, so one bad payload stopped
delivery for every subject until an operator manually re-enabled it — and
under STRICT, any event type no pack covers triggered the same outage. Push
now matches the poll precedent: log WARN, ack the JTI, clear the SET,
touch no stream state. Scoped to invalid_request — every other §2.4 code
still disables (jws_signature_failed is already retried once by the
key-flush sub-policy, ADR 0028, so what arrives here is a deterministic
stream-level fault). Both halves of the split are pinned by tests.setErrs it receives (61b0079). Neither
direction did, and outbound bookkeeping is literal-ack — anything
sent-but-unacked is released for retry — so a rejected SET was claimed,
signed, POSTed, rejected, released and re-claimed every cycle
indefinitely, burning a sign plus an HTTP round-trip each time. The dialer
(runCycle, pushWhilePollHeld) unions cls.SetErrs into the JTIs handed
to AckOutbound via a new clearedOutbound helper that de-duplicates a JTI
a malformed peer both acks and rejects; the acceptor consumes
inbound.SetErrs alongside inbound.Ack. Every rejection is logged WARN,
the operator’s only view of what a peer refused.2f6b8b5,
refined in 15ec074). SSTP routes each per-JTI setErr through the repo’s
own ClassifySetErr registry via a new goSetSstp.PartitionSetErrs: a
deterministic rejection clears, a retryable one (signature-invalid /
unknown-kid / jwtCrypto — what our own acceptor emits mid key-rotation)
stays pending for a later cycle, and binding-revoked pauses the direction
with the peer’s own reason instead of draining the queue into a dead stream.
PartitionSetErrs further splits registered non-retryable codes (clear)
from unregistered ones (a new Unrecognized bucket, held) — under
default-deny a vendor URI, a transient peer condition or a future §2.3
keyword was permanently deleting outbound SETs the pre-#247 dialer simply
retried. invalid_request is now registered in setErrClassTable
explicitly rather than clearing by accident of default-deny.15ec074).
RFC 8935 gives one code to “this payload is bad” and “I can accept nothing”,
so the transmitter re-validates the rejected SET with its own validators: if
it agrees the payload is Malformed the SET is cleared and delivery
continues (no burst of bad payloads can disable a healthy stream); if it does
not, the stream disables without acking, so a receiver-side fault costs
zero events. Only Malformed corroborates — Unsupported means we cannot
vouch either way and must not discard.setErrs
(15ec074). RFC 8936 §2.4 leaves a transmitter free to keep an un-acked SET
pending, so reporting alone livelocked the stream against any transmitter
that does not read setErrs as an acknowledgement.c0fd4c3). A peer
may ship queued outbound SETs on any 200, including the response to a
returnEvents=false second push (§2.1 forbids long-poll waiting, not the
return of already-queued SETs). pushWhilePollHeld ingested those and then
threw away the feedback runInboundHalf produced, so the peer never learned
we had taken the SETs and resent them every cycle forever. A mutex-guarded
per-pair deferred-feedback store now carries it: the second push hands
feedback there, the pair loop drains and merges it at the top of the next
cycle before the primary goroutine starts. Taking rather than reading makes
the hand-off exactly-once; UnregisterPair drops a removed pair’s entry so
the store cannot outlive its pair.0bcbbbd). ParseEventValidationMode
accepts a mode case-insensitively, so {"event_validation":"enforce"} was
admitted and stored verbatim while ResolveEventValidationMode required an
exact canonical match and fell through to the server default — the record
read back enforce while every malformed SET was forwarded unvalidated.
applyEventValidation now stores the parsed value and the resolver parses
rather than exact-matches, so already-persisted un-normalized values still
resolve.0bcbbbd). Lookup was case-sensitive
while the router’s event-type comparison is not (strings.EqualFold), so a
case-variant URI was routed but reported Unsupported — STRICT rejected
legitimate traffic and ENFORCE passed a malformed payload unvalidated.
Registry keys and ValidatorSet engagement now fold through one
registryKey helper; Result.EventURI keeps the wire form so logs and error
descriptions name what actually arrived.0bcbbbd).
It was rebuilding a full BuiltinRegistry (SSF + CAEP + RISC + SCIM + WISE)
and recompiling the delivered-events globs for every inbound SET,
measured at ~2.5 ms per SET. internal/server now shares one registry behind
a sync.Once — it never registers onto it, so the fresh-instance guarantee
BuiltinRegistry gives library embedders is not needed here — and memoizes
engaged-URI derivation keyed on the full (delivered, supported) input, so a
hit cannot be stale and no invalidation hook is required. 15ec074 adds
goSetValidate.SharedBuiltinRegistry so the two internal packages that only
read the builtin packs share one instance instead of hand-rolling sync.Once
separately.events_delivered engages the supported set, not nothing
(15ec074). Streams registered before #247 persisted [] whenever
events_requested was omitted, so STRICT rejected 100% of their traffic
while an identically-configured new stream worked.15ec074). Silence from an operator who did not pass --events is not a
peer requesting the full catalog; widening it had begun forwarding the SCIM
full-resource event types to a peer that asked for nothing.normalizePayload short-circuits only on a map that is wire-shaped all the
way down (15ec074), via a non-allocating type walk. The bare
map[string]any check skipped the documented JSON round-trip, so an
in-process payload holding typed structs was reported Malformed for a
conformant SET.event_validation mode gets a 400, not a 500 (2f6b8b5) — an
unrecognized mode is flagged with ErrInvalidRequest like a typo’d pattern.
Relatedly (15ec074), the stream service no longer WARNs when the
server-default env var is merely unset; that is the documented default
for every deployment that has not opted in. A genuinely bad value still
warns.I2SIG_STREAM_EVENT_VALIDATION, ADR 0028 (key-flush retry) for why
jws_signature_failed never reaches the per-SET rejection path, ADR
COM-0018 (one bidirectional StreamStateRecord per SSTP pair) for the
inbound-leg binding, and ADR-0066 §D3 (Parse vs Peek) for
ParseAndValidate’s composition.v0.12.0-alpha.15). Enterprise, admin, tenancy, and billing-sidecar publish
paired notes for this tag; none of them requires a code change to consume
this one.go test -race ./... is green module-wide and go vet ./... is clean at
006a975; make seams passes, which is the additive-only claim for
pkg/goSetPush, pkg/goSetPoll, pkg/goSetSstp and pkg/ssfModels. The
window adds ~12,300 lines across 89 files, the large majority of it test code.
New coverage: pkg/goSetValidate/{caep,risc,scim,wise,ssf_stream_management,
validatorset,registry,parse,disposition,boundary,case_insensitive}_test.go
(table-driven per-validator cases, each citing the spec/RFC section it
encodes, plus the import-boundary and case-folding guards),
pkg/ssfModels/{delivered_events_match,model_event_validation}_test.go and the
four *_validator_coverage_test.go catalog drift guards,
pkg/services/{stream_event_validation,stream_event_validation_normalize,
stream_events_requested,stream_service_sstp}_test.go (knob persistence /
inheritance / transmit-only warn-and-ignore, events_requested negotiation),
pkg/goSetPush/receiver_validation_test.go,
pkg/goSetPoll/poll_validation_test.go,
pkg/goSetSstp/{verify_validation,setterr_disposition}_test.go, and the
transport mode matrices in internal/server/{sstp_event_validation,
sstp_second_push_feedback,sstp_seterr_clear}_test.go plus
internal/server/test/{push,poll,sstp}_event_validation_test.go (one live-peer
dial cycle proves a setErr reaches the wire).