dcg

AWS SQS/SNS

messaging.sqs_sns

Protects against destructive AWS SQS and SNS operations like deleting queues, purging messages, deleting topics, and removing subscriptions.

  • 8blocking rules
  • 6safe patterns
  • 2Critical
  • 4High
  • 2Medium
~/.config/dcg/config.toml
[packs]
enabled = ["messaging.sqs_sns"]

Evaluated when a command contains aws, sqs, sns.

Blocking rules

Each rule ID is messaging.sqs_sns:<name>. Use it in allowlists and [policy.rules].

  1. aws-sns-delete-topic

    Critical

    aws sns delete-topic removes an SNS topic and its subscriptions.

    Explanation
    Deleting an SNS topic removes all subscriptions and stops all message delivery. Publishers will receive errors. Lambda functions, SQS queues, and other subscribers will no longer receive notifications. Safer alternatives: - aws sns list-subscriptions-by-topic: Review subscribers first - Unsubscribe endpoints individually if needed - Use topic policies to restrict publishing instead
  2. aws-sqs-delete-queue

    Critical

    aws sqs delete-queue permanently deletes an SQS queue.

    Explanation
    Deleting an SQS queue removes the queue and all messages in it. Messages in flight are lost, and any applications sending to this queue will receive errors. You must wait 60 seconds before recreating a queue with the same name. Safer alternatives: - aws sqs get-queue-attributes: Review queue metrics first - aws sqs purge-queue: Remove messages but keep the queue - Use message retention period for automatic cleanup
  3. aws-sns-delete-platform-application

    High

    aws sns delete-platform-application removes a platform application.

    Explanation
    Deleting a platform application removes all endpoints and stops push notifications to mobile devices. All registered device tokens are removed, and users will stop receiving push notifications. Safer alternatives: - aws sns list-endpoints-by-platform-application: Review endpoints - Disable individual endpoints instead of deleting the app - Back up endpoint ARNs before deletion
  4. aws-sns-remove-permission

    High

    aws sns remove-permission revokes permissions on a topic.

    Explanation
    Removing permissions can break cross-account access or service integrations. AWS services and other accounts may lose the ability to publish or subscribe to the topic. Safer alternatives: - aws sns get-topic-attributes: Review current policy first - Add new permissions before removing old ones - Use IAM policies for fine-grained access control
  5. aws-sns-unsubscribe

    High

    aws sns unsubscribe removes a subscription and stops message delivery.

    Explanation
    Unsubscribing stops message delivery to that endpoint. If this is a critical integration (Lambda, SQS, HTTP endpoint), that system will stop receiving notifications immediately. Safer alternatives: - aws sns get-subscription-attributes: Review subscription first - Use subscription filter policies to reduce traffic - Disable the endpoint instead of unsubscribing
  6. aws-sqs-purge-queue

    High

    aws sqs purge-queue deletes ALL messages in the queue.

    Explanation
    Purging an SQS queue deletes all messages immediately. This includes messages in flight and delayed messages. The operation cannot be undone. You can only purge a queue once every 60 seconds. Safer alternatives: - aws sqs get-queue-attributes: Check message count first - Process messages normally instead of purging - Use dead-letter queues for failed messages
  7. aws-sqs-delete-message

    Medium

    aws sqs delete-message removes a message from the queue.

    Explanation
    Deleting a message removes it permanently from the queue. Only delete after successful processing. If processing fails after deletion, the message is lost. Safer alternatives: - Extend visibility timeout if processing takes longer - Use dead-letter queues for failed processing - Implement idempotent processing for safety
  8. aws-sqs-delete-message-batch

    Medium

    aws sqs delete-message-batch removes multiple messages from the queue.

    Explanation
    Batch deletion removes up to 10 messages at once. Messages must be successfully processed before deletion, or they will be lost. Ensure your processing logic is complete before calling delete. Safer alternatives: - Verify receipt handles are still valid - Use visibility timeout to prevent duplicate processing - Delete messages only after confirmed processing

Safe patterns

Checked first. A command that matches one is never blocked by this pack.

  • aws-sqs-list-queues
  • aws-sqs-get-queue-attributes
  • aws-sqs-receive-message
  • aws-sns-list-topics
  • aws-sns-list-subscriptions
  • aws-sns-get-topic-attributes