Table of Contents

Property SkipSubjectValidation

Namespace
NATS.Client.Core
Assembly
NATS.Client.Core.dll

SkipSubjectValidation

Gets or sets a value indicating whether to skip subject validation. The default is false, meaning subject validation is enabled.

[Obsolete("Skipping subject validation is discouraged and may be removed in a future release. Leave subject validation enabled.")]
public bool SkipSubjectValidation { get; init; }

Property Value

bool

Remarks

When set to false (default), subjects are validated to ensure they are not empty and don't contain whitespace characters (space, tab, CR, LF). This prevents CRLF protocol injection where a subject containing \r\n could inject arbitrary NATS commands.

When set to true, all subject validation is bypassed for maximum throughput. Only use this if you fully control all subject strings and can guarantee they never contain whitespace or CRLF sequences.

This option is obsolete and discouraged. With validation off, a subject that merely contains a space or tab is split into tokens on the wire: PUB foo bar 5 is read by the server as subject foo with reply-to bar, and SUB foo bar 1 as subject foo joined to queue group bar. Either way the call is silently misrouted with no error. Disabling validation also removes the guard against CRLF protocol injection. The saving is negligible next to the network round trip, so this is kept only for compatibility and may be removed in a future release.