Skip to content

Validate Resource Policy

secretsmanager_validate_resource_policy R Documentation

Validates that a resource policy does not grant a wide range of principals access to your secret

Description

Validates that a resource policy does not grant a wide range of principals access to your secret. A resource-based policy is optional for secrets.

The API performs three checks when validating the policy:

  • Sends a call to Zelkova, an automated reasoning engine, to ensure your resource policy does not allow broad access to your secret, for example policies that use a wildcard for the principal.

  • Checks for correct syntax in a policy.

  • Verifies the policy does not lock out a caller.

Secrets Manager generates a CloudTrail log entry when you call this action. Do not include sensitive information in request parameters because it might be logged. For more information, see Logging Secrets Manager events with CloudTrail.

Required permissions: secretsmanager:ValidateResourcePolicy and secretsmanager:PutResourcePolicy. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.

Usage

secretsmanager_validate_resource_policy(SecretId, ResourcePolicy)

Arguments

SecretId

The ARN or name of the secret with the resource-based policy you want to validate.

ResourcePolicy

[required] A JSON-formatted string that contains an Amazon Web Services resource-based policy. The policy in the string identifies who can access or manage this secret and its versions. For example policies, see Permissions policy examples.

Value

A list with the following syntax:

list(
  PolicyValidationPassed = TRUE|FALSE,
  ValidationErrors = list(
    list(
      CheckName = "string",
      ErrorMessage = "string"
    )
  )
)

Request syntax

svc$validate_resource_policy(
  SecretId = "string",
  ResourcePolicy = "string"
)

Examples

## Not run: 
# The following example shows how to validate a resource-based policy to a
# secret.
svc$validate_resource_policy(
  ResourcePolicy = "{\n\"Version\":\"2012-10-17\",\n\"Statement\":[{\n\"Effect\":\"A...",
  SecretId = "MyTestDatabaseSecret"
)

## End(Not run)