Class BusEnvelopeJsonOptions
- Namespace
- Stratara.Abstractions.Messaging
- Assembly
- Stratara.Abstractions.dll
Limits applied when deserialising bus envelopes (CommandEnvelope, EventBundle)
and their embedded JSON strings (for example SessionContextJson). Mitigates denial of
service via deeply-nested or oversized JSON payloads from a hostile publisher.
[ExcludeFromCodeCoverage]
public sealed class BusEnvelopeJsonOptions
- Inheritance
-
BusEnvelopeJsonOptions
- Inherited Members
- Extension Methods
Remarks
Bind from configuration via section SectionName ("BusEnvelopeJson") or
override programmatically. The framework calls
EnsureWithinSizeLimit(int, int, string) on the raw
payload length before invoking JsonSerializer, and threads
MaxDepth into the deserialiser via
CreateOptions(int).
Fields
SectionName
Configuration section name ("BusEnvelopeJson") used to bind these options.
public const string SectionName = "BusEnvelopeJson"
Field Value
Properties
MaxBodyBytes
Maximum allowed byte length of a single bus message payload. Defaults to 1 048 576 (1 MiB). Larger payloads are rejected with JsonException before deserialisation, preventing OOM / Gen2 stalls caused by a hostile publisher.
public int MaxBodyBytes { get; set; }
Property Value
MaxDepth
Maximum allowed nesting depth for incoming JSON envelopes. Defaults to 32. The JsonSerializerOptions default is 64; the lower value protects against deeply-nested payloads designed to exhaust the stack or trigger pathological serialiser behaviour.
public int MaxDepth { get; set; }