Skip to content
Back to skills

Nats Knowledge Patch

ASecurity

NATS Server

  • 25 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 5, 2026
developmentnodegitapisecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill nats-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Nats Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Nats Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-nats-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-nats-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: nats-knowledge-patch
description: NATS Server
version: "2.15.3"
license: MIT
metadata:
  author: Nevaberry
---


# NATS Server Knowledge Patch

Load this skill when configuring, upgrading, or troubleshooting NATS Server,
JetStream publishing and consumers, leafnode connections, or authentication.
Use the quick reference below for common changes and the topic files for full
conditions, examples, and version-specific behavior.

## Reference index

| Reference | Topics |
| --- | --- |
| [JetStream streams and publishing](references/jetstream-streams-and-publishing.md) | API validation and levels, TTL, delete markers, atomic and fast batches, counters, schedules, retention, deduplication, ingest queues |
| [Consumers, mirrors, and sources](references/consumers-mirrors-and-sources.md) | Limits, priorities, pins, pausing, reset, delivery state, inactivity, durable sourcing, flow control, mirror promotion |
| [Networking, security, and observability](references/networking-security-and-observability.md) | Authentication, JWTs, permissions, TLS, proxies, leafnodes, gateways, subject mappings, MQTT, WebSockets, tracing, monitoring |
| [Operations, upgrades, and recovery](references/operations-upgrades-and-recovery.md) | Compatibility, configuration checks, feature flags, storage, recovery, placement, scaling, backup, health, shutdown |

## Breaking changes and compatibility

- From 2.12.0, JetStream rejects requests with unknown JSON fields. Correct the
  request or update the client library; `strict: false` in the `jetstream` block
  temporarily restores permissive decoding during migration.
- Pedantic stream and consumer creates and updates fail if applying server
  defaults would change the requested configuration.
- Monitoring endpoints no longer wrap responses in JSONP callbacks. Update
  monitoring clients to read JSON. Some per-connection logs require debug logging.
- In 2.14.8 and 2.15.1, gateways remove support for the legacy `$GR.` reply
  prefix used by servers older than 2.1.2. Clients cannot publish to that prefix.
- Spaces in configured server, cluster, or gateway names cause startup failure.
  JetStream rejects the domain names `ACK`, `FC`, `SNAPSHOT`, and `EVENT`.
- Unsupported stored stream or consumer configuration values cause the asset
  to be marked offline. A metadata leader that lacks support rejects updates.
- Feature flag overrides require a restart. Unknown names are logged and
  ignored. Remove the entire `feature_flags` block before downgrading to 2.12.
- Downgrade from 2.12 only to 2.11.9 or later in the 2.11 line; the first startup
  rescans message blocks to rebuild stream state. Allow extra startup time.
  Version 2.14.7 supports the desired-state metadata needed for safe upgrades
  and downgrades between 2.14 and 2.15.

See the operations reference for maintenance policy and recovery constraints.

## Authentication and permission changes

`NoAuthUser` fallback connections must satisfy that user's connection restrictions.
With `no_auth_user` and an auth callout configured together, authentication checks
also cover the fallback path. TLS `verify_and_map` enforces authentication for
users configured with blank passwords.

Auth callouts enforce allowed connection types and the returned user JWT's `src`
restriction. JWT payload-size and subscription-count limits apply to auth callout
and MQTT clients. In 2.15.3, encrypted auth callouts require an XKey on the server.

Queue-scoped permissions check both subject and queue group. Queue subscription
deny rules use the mapped delivery subject. Stream imports crossing leafnode
links apply publish permissions to the transformed subject sent over the link.
Leafnode allowlists must include required inbound JetStream ACK subjects and,
when needed, MQTT subjects. See the networking reference for the exact changes.

## Consumer limits and update constraints

In 2.15, new consumer creation defaults to a cap of 1,000 per stream unless stream
configuration or account limits specify `max_consumers`. Override the default with
`default_max_consumers` in the server's JetStream limits; `-1` disables it.
Zero-valued consumer limits on stream updates mean unlimited.

Consumer updates cannot change storage type or whether the consumer is direct
or used for sourcing. Same-name create requests preserve the existing consumer's
state. On a standalone server, stream updates requesting more than one replica fail.

## Per-message expiration and delete markers

Enable `allow_msg_ttl` at creation or on an existing stream; this opt-in is
irreversible. `Nats-TTL: 60` or `Nats-TTL: 1m` expires a message relative to its
stream timestamp. `Nats-TTL: never` exempts it from time expiration, including
`MaxAge`. Malformed or subsecond values, including zero, produce PubAck error
`10165`; direct publishes with TTL to a stream with TTL disabled produce `10166`.

Set `subject_delete_marker_ttl` to at least one second for markers when age-based
expiration removes the last message on a subject. Enable rollups and allow purges,
especially in pedantic mode. Shorter finite message TTLs are raised to the marker
TTL, except on streams limited to one message per subject.

Sources and mirrors accept replicated TTL headers even with local TTL disabled.
Enable `allow_msg_ttl` on the receiving stream to enforce them. Sources can generate
their own expiration markers; mirror configurations reject `subject_delete_marker_ttl`.

## Atomic and fast batch publishing

For atomic batches, opt in with `allow_atomic` at API level 2. Start with a batch ID
of up to 64 characters and sequence `1`, then reuse the ID and increment sequence.
`Nats-Batch-Commit: 1` stores the final message and returns a PubAck containing
`batch`, `count`, and the final stream sequence.

The server checks preconditions against stream state just before commit. Put
`Nats-Expected-Last-Sequence` only on the first entry. Use
`Nats-Expected-Last-Subject-Sequence` only for a subject no earlier batch entry writes.
In 2.12.0, sequence gaps, failed preconditions, `Nats-Msg-Id`, and
`Nats-Expected-Last-Msg-Id` reject the whole batch.

A batch holds up to 1,000 messages and is abandoned after 10 idle seconds without
an error reply. Watch `io.nats.jetstream.advisory.v1.stream_batch_abandoned` for
the batch ID and reason. Mirrors and sources do not reapply the original checks.

Fast batches use `AllowBatchPublish` on standalone or replicated streams, check
preconditions per message, and ingest as the batch arrives. Handle both backward
and forward sequence-gap reports. Atomic and fast batches support a separate
end-of-batch control message that commits without storing that control message.
For an atomic batch, send `Nats-Batch-Commit: eob` on the separate commit request.

## Counter streams

Set `allow_msg_counter` at stream creation at API level 2. Each subject is an
independent counter. Use Limits retention, discard-old behavior, and no per-message
TTL. Publish a signed integer delta in `Nats-Incr`; counter streams require it and
reject rollups and publish preconditions. The stored body and PubAck expose the
arbitrary-precision total as a string `val`. Read the subject's last message for
its current value.

Source subject transforms can aggregate counters. `Nats-Counter-Sources` tracks
each source stream and original subject's last value. Reset an upstream counter
with the negative of its current total, optionally purging entries before the
reset. A subject purge alone resets a standalone counter but leaves downstream
totals intact. Mirrors copy counter messages verbatim.

## Scheduled publishing

Enable `allow_msg_schedules` at API level 2; the opt-in can be added later and is
permanent. Give each schedule a unique subject in the same stream as its target.
A later publish to that schedule subject replaces the prior schedule.

`Nats-Schedule: @at` takes an RFC3339 timestamp and fires immediately if overdue,
including after restart. Recurrence supports `@hourly`, `@every 5m`, or six-field
UTC cron with seconds first. `Nats-Schedule-Source` samples a concrete subject's
latest stored message on each run.

`Nats-TTL` limits the schedule's eligibility. With `allow_msg_ttl` enabled,
`Nats-Schedule-TTL` sets the generated message's TTL. Generated messages carry
`Nats-Scheduler` and `Nats-Schedule-Next`. Set `Nats-Schedule-Rollup` on the schedule
message to roll up when publishing the generated message to the target subject.

## Pull priorities, pins, and delivery reset

Choose the priority policy and whether to use groups when creating the consumer.
In 2.11.0, a priority consumer takes exactly one group, every pull includes `group`,
and group names have at most 16 ASCII letters, digits, `-`, `_`, `/`, or `=`.

- `overflow` uses explicit acknowledgments. `min_pending` counts undelivered
  messages and `min_ack_pending` counts unacknowledged messages; either threshold
  makes the pull eligible when both are supplied. Waiting pulls can get heartbeats.
- `pinned_client` uses explicit acknowledgments. Send the delivered `Nats-Pin-Id`
  as `id` on later pulls. On status `423`, clear the stale ID and pull with the group.
  A current-ID pull renews the pin. Set pull expiry below the pin timeout, which
  defaults to two minutes and can be updated.
- `prioritized` allows lower-priority pulls to receive work when higher-priority
  pulls are absent; higher-priority pulls take precedence when they return.

`PauseUntil` pauses delivery until its deadline while heartbeats continue.
Reset clears pending and redelivery state and restarts the consumer sequence at 1.
An empty payload or `{"seq":0}` resumes after the stream acknowledgment floor;
positive sequences have delivery-policy and configured-start constraints detailed
in the consumers reference. Clients should allow sequences to restart after an
external reset. Delivery pauses during reset, and the reply reports reset-position
state. Advancing a sourcing consumer skips upstream messages.

## Durable sources, mirrors, and acknowledgment subjects

WorkQueue and Interest sourcing or mirroring automatically creates and reuses an
ordered durable consumer, acknowledging after downstream persistence. Removing
the configuration attempts to delete it; check for a leftover durable. Pre-created
upstream durable push consumers can supply the source or mirror's `consumer` object.
Set starting position and filters on that consumer. A WorkQueue sourcing consumer
occupies its filter; use Interest or Limits if another consumer needs overlap.

`AckFlowControl` needs flow control, an idle heartbeat, and `MaxDeliver: -1`;
leave `AckWait` and `BackOff` unset. See the consumers reference for cumulative
acknowledgments, filter scope, and mixed-version fallback behavior.

When parsing ACK metadata, accept the 9-token v1 layout and v2 with 11 or more
tokens. In v2, `_` in the domain position means no domain. Publish acknowledgments
to the supplied reply subject as-is. `$JS.ACK.>` and `$JS.FC.>` match both formats;
stream-scoped permissions need the v2 patterns before the default changes in 2.15.

Mirror promotion is irreversible. Delete the primary or remove its subjects, then
clear the mirror configuration and assign the primary's subjects to the promoted stream.

## Tracing, leafnode readiness, and configuration checks

Subscribe to an inbox and publish with `Nats-Trace-Dest` set to it. Add
`Nats-Trace-Only: true` to trace without delivering to original-subject subscribers.
`Nats-Trace-Dest: trace disabled` disables all server tracing for that publish.
Leafnode publish permissions must allow the trace destination.

With `/healthz?leaf-remotes-connected=true`, the health endpoint returns unavailable
until every enabled solicited leafnode remote is connected. `/healthz?js-server-only=true` checks local JetStream
readiness independently of metadata leadership; `/healthz?js-meta-only=true`
checks the metadata group. `/healthz` skips expired JWT accounts, so track their
expiration separately.

In 2.15.3, check a proposed configuration change with:

```sh
nats-server -c current.conf -t --test_reload proposed.conf
```

Exit code `3` means a restart is required. Plain `-t` applies command-line flags as
startup does. Embedded servers can use `CheckReload` or `CheckReloadOptions`.

## Operational limits and recovery

Wait for PubAcks to limit outstanding publishes. Excess Core NATS stream publishes
can be dropped; JetStream publishers can receive `429 JSStreamTooManyRequests`.
Tune ingest queues if logs report excessive stream ingest. New leaders wait for
Raft catch-up before serving reads and writes; account for this during failover retries.

A filestore I/O error freezes the affected stream and appears as a `write error`
in health checks. For a replicated stream, another replica can take over; restart
the affected server to recover. If restarts leave only one in-memory replica with stream data, bring
every replica back online: a quorum alone is insufficient in that case.

See the operations reference for snapshot validation, lost encrypted blocks,
restore completion and deduplication, metadata quorum recovery, placement limits,
live scaling, and shutdown behavior.

Files in this skill

  • SKILL.md8.6 KB
  • coverage.json617 B
  • references/consumers-mirrors-and-sources.md4.9 KB
  • references/jetstream-streams-and-publishing.md5.6 KB
  • references/networking-security-and-observability.md4.2 KB
  • references/operations-upgrades-and-recovery.md4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.