dcg

OpenSearch

search.opensearch

Protects against destructive OpenSearch REST API operations and AWS CLI domain deletions.

  • 12blocking rules
  • 8safe patterns
  • 3Critical
  • 6High
  • 3Medium
~/.config/dcg/config.toml
[packs]
enabled = ["search.opensearch"]

Evaluated when a command contains opensearch, aws, curl, http, 9200, _search, _cluster, _cat, _doc, _all.

Blocking rules

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

  1. aws-opensearch-delete-domain

    Critical

    aws opensearch delete-domain permanently deletes an OpenSearch domain.

    Explanation
    Deleting an OpenSearch domain removes the entire cluster including all indices, data, and configuration. This is irreversible and affects all applications using the domain. Automated snapshots may also be deleted. Safer alternatives: - aws opensearch describe-domain: Review domain configuration - Create a manual snapshot before deletion - Export data to S3 for long-term retention
  2. os-curl-delete-index

    Critical

    curl -X DELETE against an OpenSearch index (or _all/*) deletes data permanently.

    Explanation
    Deleting an OpenSearch index permanently removes all documents, mappings, and settings. Using _all or * patterns can delete multiple indices at once. This action cannot be undone without restoring from a snapshot. Safer alternatives: - _cat/indices: List indices before deletion - Create a snapshot before deleting - Close the index first if just archiving
  3. os-http-delete-index

    Critical

    http DELETE against an OpenSearch index (or _all/*) deletes data permanently.

    Explanation
    Deleting an OpenSearch index permanently removes all documents, mappings, and settings. Using _all or * patterns can delete multiple indices at once. This action cannot be undone without restoring from a snapshot. Safer alternatives: - _cat/indices: List indices before deletion - Create a snapshot before deleting - Close the index first if just archiving
  4. aws-opensearch-delete-inbound-connection

    High

    aws opensearch delete-inbound-connection removes an OpenSearch connection.

    Explanation
    Deleting an inbound connection removes cross-cluster connectivity. Applications performing cross-cluster searches or replication will fail. The connection must be re-established from the source domain. Safer alternatives: - List connections to understand dependencies - Verify no active cross-cluster operations - Update applications to use alternative data sources
  5. aws-opensearch-delete-outbound-connection

    High

    aws opensearch delete-outbound-connection removes an OpenSearch connection.

    Explanation
    Deleting an outbound connection removes cross-cluster connectivity from this domain. Any cross-cluster searches or replication to other domains will fail. Re-establishing requires a new connection request. Safer alternatives: - List connections to understand what will be affected - Coordinate with teams using connected domains - Test connection removal in a non-production environment
  6. os-curl-close-index

    High

    curl -X POST to _close closes an index, making it unavailable for reads/writes.

    Explanation
    Closing an index makes it completely unavailable for search and indexing. Applications will receive errors until the index is reopened. Using _all or * can close all indices at once. Safer alternatives: - Check index status with _cat/indices first - Use specific index names instead of wildcards - Verify no active applications depend on the index
  7. os-curl-delete-by-query

    High

    curl -X POST to _delete_by_query deletes documents matching the query.

    Explanation
    The _delete_by_query endpoint can delete large numbers of documents at once. A poorly constructed query can remove more data than intended. This operation cannot be easily undone. Safer alternatives: - Use _search with same query first to preview matches - Add conflicts=abort to stop on version conflicts - Use scroll_size to process in smaller batches
  8. os-http-close-index

    High

    http POST to _close closes an index, making it unavailable for reads/writes.

    Explanation
    Closing an index makes it completely unavailable for search and indexing. Applications will receive errors until the index is reopened. Using _all or * can close all indices at once. Safer alternatives: - Check index status with _cat/indices first - Use specific index names instead of wildcards - Verify no active applications depend on the index
  9. os-http-delete-by-query

    High

    http POST to _delete_by_query deletes documents matching the query.

    Explanation
    The _delete_by_query endpoint can delete large numbers of documents at once. A poorly constructed query can remove more data than intended. This operation cannot be easily undone. Safer alternatives: - Use _search with same query first to preview matches - Add conflicts=abort to stop on version conflicts - Use scroll_size to process in smaller batches
  10. aws-opensearch-delete-package

    Medium

    aws opensearch delete-package removes an OpenSearch package.

    Explanation
    Deleting a package removes custom plugins, dictionaries, or scripts. Domains using this package may experience errors or degraded functionality. The package must be re-uploaded if needed again. Safer alternatives: - List domains using this package first - Dissociate package from domains before deletion - Keep a copy of package contents for recovery
  11. os-curl-delete-doc

    Medium

    curl -X DELETE against /_doc deletes a document from OpenSearch.

    Explanation
    Deleting individual documents removes them from search results immediately. While less destructive than bulk operations, this can affect applications expecting the document to exist. Safer alternatives: - GET the document first to verify content - Use _update API to mark as deleted instead - Ensure document ID is correct before deletion
  12. os-http-delete-doc

    Medium

    http DELETE against /_doc deletes a document from OpenSearch.

    Explanation
    Deleting individual documents removes them from search results immediately. While less destructive than bulk operations, this can affect applications expecting the document to exist. Safer alternatives: - GET the document first to verify content - Use _update API to mark as deleted instead - Ensure document ID is correct before deletion

Safe patterns

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

  • os-curl-get-search
  • os-curl-get-cat
  • os-curl-get-cluster-health
  • os-http-get-search
  • os-http-get-cat
  • os-http-get-cluster-health
  • aws-opensearch-describe-domain
  • aws-opensearch-list-domain-names