nats-io/nats.net.v2

Missing key validation in KV

mtmk opened this issue · 0 comments

mtmk commented

Observed behavior

Keys are not validated e.g.:

public async ValueTask<ulong> PutAsync<T>(string key, T value, INatsSerialize<T>? serializer = default, CancellationToken cancellationToken = default)
{
var ack = await _context.PublishAsync($"$KV.{Bucket}.{key}", value, serializer: serializer, cancellationToken: cancellationToken);
ack.EnsureSuccess();
return ack.Seq;
}

Expected behavior

They should be validated based on design document https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-8.md#10

Server and client version

2.10.x / 2.2.0

Breaking change

If validation is introduce this will break applications PUT requests with invalid entries