set_bucket_policy
Set a new bucket policy on a MinIO bucket while preserving the previous policy for rollback. Supports dry-run and prevents changes that would lock out the tool's own undo access.
Instructions
[WRITE][risk=medium] Replace the bucket policy. Reversible → prior policy JSON.
An anonymous-Allow policy makes the bucket public — check bucket_exposure_audit after changing policies.
Refuses a policy whose explicit Deny on s3:PutBucketPolicy covers this tool's own access key: an explicit Deny beats every Allow, so the undo that replays the prior policy would itself be denied. Enforced under dry_run too.
Args: bucket_name: Bucket name (from bucket_ls). policy_json: Full policy document as a JSON string (must contain 'Statement'). dry_run: If True, preview without applying. target: MinIO target name from config; omit for the default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | No | ||
| dry_run | No | ||
| bucket_name | Yes | ||
| policy_json | Yes |