NATS
messaging.nats
Protects against destructive NATS/JetStream operations like deleting streams, consumers, key-value entries, objects, and accounts.
- 6blocking rules
- 10safe patterns
- 2Critical
- 4High
[packs]
enabled = ["messaging.nats"]Evaluated when a command contains nats.
Blocking rules
Each rule ID is messaging.nats:<name>. Use it in allowlists and [policy.rules].
Criticalnats-account-deletenats account delete removes an account and its resources.
Explanation
Deleting a NATS account removes all streams, consumers, and permissions associated with that account. All applications using this account will lose connectivity. Safer alternatives: - Review account resources before deletion - Migrate resources to another account first - Disable the account instead of deleting
Criticalnats-stream-deletenats stream delete/rm removes a JetStream stream and all its messages.
Explanation
Deleting a JetStream stream permanently removes all stored messages, consumers, and configuration. Applications relying on this stream will lose access to historical data. Safer alternatives: - nats stream info: Review stream details first - nats stream purge: Remove messages but keep the stream - Back up stream configuration before deletion
Highnats-consumer-deletenats consumer delete/rm removes a JetStream consumer.
Explanation
Deleting a consumer removes its acknowledgment state and delivery tracking. Messages may be redelivered to other consumers or lost if this was the only consumer. Safer alternatives: - nats consumer info: Review consumer state first - Pause the consumer instead of deleting - Ensure other consumers exist for critical streams
Highnats-kv-deletenats kv del/rm deletes key-value entries.
Explanation
Deleting KV entries removes data that applications may depend on. If history is disabled, the deletion is permanent and cannot be recovered. Safer alternatives: - nats kv get: Retrieve and back up the value first - nats kv history: Check if history is enabled - Use TTL for automatic expiration instead of manual deletion
Highnats-object-deletenats object delete removes an object from the store.
Explanation
Deleting an object from the object store removes the file and its metadata. Applications expecting this object will receive errors. Safer alternatives: - nats object info: Review object details first - Download the object before deletion - Use object versioning if available
Highnats-stream-purgenats stream purge deletes ALL messages from the stream.
Explanation
Purging a stream removes all messages while keeping the stream and consumer configurations intact. Consumers will have no messages to process until new ones arrive. Safer alternatives: - nats stream info: Check message count first - Use --seq to purge only messages up to a specific sequence - Use --keep to retain the last N messages
Safe patterns
Checked first. A command that matches one is never blocked by this pack.
nats-stream-infonats-stream-lsnats-consumer-infonats-consumer-lsnats-kv-getnats-kv-lsnats-pubnats-subnats-server-infonats-bench