Excessive permissions in an Azure Table access policy

Limit Table SAS permissions to required entity operations.

Description

In an Azure Table stored access policy, raud lets a service SAS referencing that policy query (r), add (a), update (u) and delete (d) entities.

Potential impact

A token intended for queries could also change or delete data if it retains write permissions.

Remediation

For query-only access, set permissions = "r" and limit the policy’s validity period. To restrict which entities can be read, specify the partition and row key bounds when issuing the SAS. Verify that the SAS can query the intended entities and cannot update them.

Examples

The excerpts update the same policy on mytablename. Supply the actual account ID and valid UTC start and expiry times.

Before

hcl
resource "azurerm_storage_table" "example" {
  name                 = "mytablename"
  storage_account_id   = var.storage_account_id

  acl {
    id = "someid-1XXXXXXXXX"

    access_policy {
      expiry      = var.policy_expiry_utc
      permissions = "raud"
      start       = var.policy_start_utc
    }
  }
}

After

hcl
resource "azurerm_storage_table" "example" {
  name                 = "mytablename"
  storage_account_id   = var.storage_account_id

  acl {
    id = "someid-1XXXXXXXXX"

    access_policy {
      expiry      = var.policy_expiry_utc
      permissions = "r"
      start       = var.policy_start_utc
    }
  }
}

References