Enforce tenancy at subject construction and default the type registry - #45
Conversation
|
Claude finished @bruth's task in 3m 21s —— View job Review complete
SummaryThis is a clean, well-scoped refactor: tenancy enforcement moves from per-operation convention into the subject-construction path ( Tenancy enforcement — traced every mutating path ( Default registry ( Minor observations (not blocking):
Test coverage is thorough (structural unit tests without a server plus integration tests with a real embedded NATS server for isolation, persistence-across- |
jetstreamext.GetBatch removes the consumer create/delete RPCs (~70us, visible only on tiny replays) but consumes 2.5-3x slower at 1k+ events with 3-5x the allocations, and is a wash on per-entity reloads. The rejected path stays as a test-only prototype in the benchmark so the comparison is reproducible; unpackEventFrom is shared so the two sides differ only in transport. Signed-off-by: Byron Ruth <byron@synadia.com>
…ntion Signed-off-by: Byron Ruth <byron@synadia.com>
Signed-off-by: Byron Ruth <byron@synadia.com>
Signed-off-by: Byron Ruth <byron@synadia.com>
3872af0 to
b436595
Compare
|
Claude finished @bruth's task in 3m 22s —— View job Review complete
SummarySecond pass over this refactor — subject construction now enforces tenancy structurally ( One real (but pre-existing, not introduced by this diff) finding, left as an inline comment on No JetStream durability/ack concerns and no public API breaks — |
| func (binaryTypes) resolveType(declared string, _ any) (string, error) { | ||
| if declared == "" { | ||
| return "", ErrEventTypeRequired | ||
| } | ||
| return declared, nil | ||
| } |
There was a problem hiding this comment.
Minor/pre-existing, not introduced by this PR: binaryTypes.resolveType only checks that declared is non-empty — it doesn't validate the type token the way validEntity validates the entity. Since eventSubject (manager.go:107) builds the published subject as event.Entity + "." + event.Type, a caller-supplied Type containing ., *, >, or whitespace can inject extra subject tokens or wildcards into the published subject, the same class of problem validEntity was written to prevent on the entity side. Worth a follow-up to apply the same character-class check to the type token here (and in registryTypes.resolveType, since the registry's nameRegex permits dots in type names too), for symmetry with the entity-side guard.
Signed-off-by: Byron Ruth <byron@synadia.com>
|
Claude finished @bruth's task in 1m 34s —— View job Review complete
SummaryThis latest push ( Type validation — fixed. Reactor tenant scoping — Tenancy enforcement (unchanged from prior passes, re-verified) — every mutating path ( Default registry ( No new correctness, security, or JetStream durability issues found in this update. Both previously-open findings are now resolved with direct test coverage. |
No description provided.