Skip to content

Secrets Manager  >  Operations  >  validate_resource_policy

validate_resource_policy

Operation

validate_resource_policy async

validate_resource_policy(input: ValidateResourcePolicyInput, plugins: list[Plugin] | None = None) -> ValidateResourcePolicyOutput

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.

Parameters:

Name Type Description Default
input ValidateResourcePolicyInput

An instance of ValidateResourcePolicyInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
ValidateResourcePolicyOutput

An instance of ValidateResourcePolicyOutput.

Input

ValidateResourcePolicyInput dataclass

Dataclass for ValidateResourcePolicyInput structure.

Attributes

resource_policy class-attribute instance-attribute
resource_policy: str | None = None

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.

secret_id class-attribute instance-attribute
secret_id: str | None = None

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

Output

ValidateResourcePolicyOutput dataclass

Dataclass for ValidateResourcePolicyOutput structure.

Attributes

policy_validation_passed class-attribute instance-attribute
policy_validation_passed: bool = False

True if your policy passes validation, otherwise false.

validation_errors class-attribute instance-attribute
validation_errors: list[ValidationErrorsEntry] | None = None

Validation errors if your policy didn't pass validation.