Apache Kafka
messaging.kafka
Protects against destructive Kafka CLI operations like deleting topics, removing consumer groups, resetting offsets, and deleting records.
- 7blocking rules
- 9safe patterns
- 3Critical
- 4High
[packs]
enabled = ["messaging.kafka"]Evaluated when a command contains kafka-topics, kafka-topics.sh, kafka-consumer-groups, kafka-consumer-groups.sh, kafka-configs, kafka-configs.sh, kafka-acls, kafka-acls.sh, kafka-delete-records, kafka-delete-records.sh.
Blocking rules
Each rule ID is messaging.kafka:<name>. Use it in allowlists and [policy.rules].
Criticalkafka-delete-recordskafka-delete-records deletes records up to specified offsets.
Explanation
This command permanently deletes messages from topic partitions up to the specified offsets. Deleted data cannot be recovered. Consumers attempting to read deleted offsets will encounter errors. Safer alternatives: - Use retention policies for automatic data expiration - Verify the offset JSON file carefully before execution - Consider topic compaction for key-based retention
Criticalkafka-topics-deletekafka-topics --delete removes Kafka topics and data.
Explanation
Deleting a Kafka topic permanently removes all messages and partitions. Consumers will receive errors, and any unprocessed data is lost. Producer applications may fail until they handle the missing topic. Safer alternatives: - kafka-topics --describe: Review topic details first - Set retention.ms to expire data naturally - Back up critical data before deletion
Criticalrpk-topic-deleterpk topic delete removes topics (Kafka-compatible).
Explanation
Deleting a topic via rpk (Redpanda) permanently removes all data and partitions, similar to kafka-topics --delete. This affects both Redpanda and Kafka-compatible systems. Safer alternatives: - rpk topic describe: Review topic details first - rpk topic list: Verify the topic name - Use retention settings for data lifecycle management
Highkafka-acls-removekafka-acls --remove deletes ACLs and can break access controls.
Explanation
Removing ACLs can immediately break access for producers and consumers. Applications may fail with authorization errors, causing message loss or processing delays. Safer alternatives: - kafka-acls --list: Review existing ACLs first - Test ACL changes in a non-production environment - Add new ACLs before removing old ones during transitions
Highkafka-configs-delete-configkafka-configs --alter --delete-config removes broker/topic configs.
Explanation
Deleting configuration overrides reverts topics or brokers to default settings. This can unexpectedly change retention, replication, or compression behavior. Safer alternatives: - kafka-configs --describe: Review current configuration first - Set explicit values instead of deleting to revert to defaults - Test configuration changes in a non-production environment
Highkafka-consumer-groups-deletekafka-consumer-groups --delete removes consumer groups and offsets.
Explanation
Deleting a consumer group removes all committed offsets. When consumers reconnect, they will start from the earliest or latest offset based on their configuration, potentially reprocessing or skipping messages. Safer alternatives: - kafka-consumer-groups --describe: Check group status first - Reset offsets instead of deleting the group - Ensure all consumers are stopped before deletion
Highkafka-consumer-groups-reset-offsetskafka-consumer-groups --reset-offsets rewinds offsets and can cause reprocessing.
Explanation
Resetting consumer offsets can cause messages to be reprocessed or skipped. This affects data consistency if your consumers are not idempotent. Resetting to the earliest offset on a high-volume topic may trigger massive reprocessing. Safer alternatives: - Use --dry-run to preview the reset first - Reset to a specific timestamp or offset for precision - Ensure consumers are stopped before resetting
Safe patterns
Checked first. A command that matches one is never blocked by this pack.
kafka-topics-listkafka-topics-describekafka-consumer-groups-listkafka-consumer-groups-describekafka-acls-listkafka-configs-describekafka-console-consumerkafka-console-producerkafka-broker-api-versions