AWS S3
This plugin collects read-only Amazon S3 bucket configuration, evaluates CCF Rego policy bundles, and emits evidence back through the CCF agent.
This page is for operators who run the plugin-aws-s3 plugin with the CCF Agent, and for developers who write policies for it. It documents v0.1.3 and is generated from the plugin's README at v0.1.3.
How it works
How it fits in CCF
The CCF agent starts this binary through HashiCorp go-plugin, passes configuration and policy paths over gRPC, and receives generated evidence through the runner callback. This repository does not call the CCF API directly.
During plugin initialisation, subject templates and risk templates declared by the configured policy bundle are registered through the agent API helper.
Configuration
The plugin expects:
- AWS credentials through the default AWS SDK credential chain
- target regions from config.regions or config.region
- AWS_REGION as a fallback when plugin config does not provide a region
Any agent-supplied policy_data is passed through to Rego as data.*.
Evidence collected
Supported resource families
The collector can evaluate policies for:
- S3 buckets
Data collected
For each in-scope bucket, the plugin collects and normalises:
- bucket name, ARN, creation date, and home region
- bucket tags
- server-side encryption settings
- public access block settings
- bucket policy document, policy hash, and public policy status
- ownership controls
- versioning and MFA delete status
- object lock configuration
- lifecycle rules and retention summary
- replication configuration
- server access logging configuration
- static website hosting configuration
The policy input contains both the raw bucket resource under input.bucket and the evaluated context under input.bucket_context.
Policy input
The plugin evaluates one kind of resource, an S3 bucket, and a policy receives one document per bucket as input. The document has two top-level keys: bucket, the identity of the bucket, and bucket_context, everything the plugin read about it. A bundle is matched by its name, aws-s3-policies. Fields are listed by their path inside the document; a field marked as left out is missing from the document, not null, so test for it with object.get or a default. The bucket_context object always has current, bucket_home_region and one object for each setting below (encryption, public_access_block, policy, policy_status, ownership_controls, versioning, object_lock, lifecycle, replication, logging, website), but a setting the bucket does not have is an empty object, or has its fields left out.
| Field | Type | Description |
|---|---|---|
bucket | object | The bucket itself. |
bucket.name | string | Bucket name. |
bucket.arn | string | Bucket ARN, arn:aws:s3:::<name>. |
bucket.region | string | Region the bucket lives in. us-east-1 when S3 reports no location, and eu-west-1 for the legacy EU location. |
bucket.creation_date | string (RFC 3339 time) | When the bucket was created. Left out when S3 returns no date. |
bucket_context | object | What the plugin read about the bucket. The fields below are all inside it. |
bucket_context.bucket_home_region | string | Region the bucket lives in, same as bucket.region. |
bucket_context.tags | object (string to string) | The bucket's tags. Left out when the bucket has none. |
bucket_context.policy_hash | string | SHA-256 hex digest of the bucket policy text. Left out when there is no bucket policy. |
bucket_context.current | object | Summary flags computed from the rest of the context, the easiest thing for a policy to test. Fields: |
bucket_context.current.bucket_name | string | Bucket name. |
bucket_context.current.bucket_arn | string | Bucket ARN. |
bucket_context.current.region | string | Bucket region. |
bucket_context.current.tags_present | boolean | True when the bucket has at least one tag. |
bucket_context.current.is_public | boolean | True when S3 reports the bucket policy as public. False when there is no bucket policy. |
bucket_context.current.encryption_enabled | boolean | True when the bucket has at least one default encryption rule. |
bucket_context.current.uses_kms | boolean | True when a default encryption rule uses aws:kms. |
bucket_context.current.ownership_enforced | boolean | True when object ownership is BucketOwnerEnforced. |
bucket_context.current.is_versioned | boolean | True when versioning status is Enabled. |
bucket_context.current.mfa_delete_enabled | boolean | True when MFA delete is Enabled. |
bucket_context.current.object_lock_enabled | boolean | True when Object Lock is enabled. |
bucket_context.current.has_lifecycle_rules | boolean | True when the bucket has at least one lifecycle rule. |
bucket_context.current.lifecycle_min_expiration_days | integer | Smallest expiration_days across lifecycle rules that set one. 0 when none does. |
bucket_context.current.has_noncurrent_version_expiration | boolean | True when any lifecycle rule expires noncurrent versions. |
bucket_context.current.logging_enabled | boolean | True when server access logging has a target bucket. |
bucket_context.current.replication_enabled | boolean | True when at least one replication rule has status Enabled. |
bucket_context.current.website_hosting_enabled | boolean | True when static website hosting is configured. |
bucket_context.encryption.rules | array of objects | Default encryption rules. Left out when the bucket has no default encryption (encryption is then an empty object). |
bucket_context.encryption.rules[].algorithm | string | AES256, aws:kms or aws:kms:dsse. |
bucket_context.encryption.rules[].kms_key_arn | string | KMS key the rule names. Left out when none is named. |
bucket_context.encryption.rules[].bucket_key_enabled | boolean | Whether S3 Bucket Keys are on. |
bucket_context.public_access_block.block_public_acls | boolean | Block public ACLs. All four are false when the bucket has no public access block. |
bucket_context.public_access_block.ignore_public_acls | boolean | Ignore public ACLs. All four are false when the bucket has no public access block. |
bucket_context.public_access_block.block_public_policy | boolean | Block public bucket policies. All four are false when the bucket has no public access block. |
bucket_context.public_access_block.restrict_public_buckets | boolean | Restrict access to buckets with public policies. All four are false when the bucket has no public access block. |
bucket_context.policy.raw | string | The bucket policy as the JSON string S3 returns. Left out when there is no bucket policy. |
bucket_context.policy_status.is_public | boolean | Whether S3 evaluates the bucket policy as public. |
bucket_context.ownership_controls.object_ownership | string | BucketOwnerEnforced, BucketOwnerPreferred or ObjectWriter. Left out when no ownership controls are set. |
bucket_context.versioning.status | string | Enabled or Suspended. Left out when versioning was never turned on. |
bucket_context.versioning.mfa_delete | string | Enabled or Disabled. Left out when S3 returns none. |
bucket_context.object_lock.enabled | boolean | Whether Object Lock is enabled. |
bucket_context.object_lock.default_retention_mode | string | GOVERNANCE or COMPLIANCE. Left out when there is no default retention. |
bucket_context.object_lock.default_retention_days | integer | Default retention in days. Left out when 0. |
bucket_context.object_lock.default_retention_years | integer | Default retention in years. Left out when 0. |
bucket_context.lifecycle.rules | array of objects | Lifecycle rules. Left out when the bucket has none. Each rule has the fields below. |
bucket_context.lifecycle.rules[].id | string | Rule ID. Left out when empty. |
bucket_context.lifecycle.rules[].status | string | Enabled or Disabled. |
bucket_context.lifecycle.rules[].expiration_days | integer | Days until current objects expire. Left out when 0. |
bucket_context.lifecycle.rules[].noncurrent_version_expiration_days | integer | Days until noncurrent versions expire. Left out when 0. |
bucket_context.lifecycle.rules[].abort_incomplete_multipart_upload_after_days | integer | Days after which incomplete multipart uploads are aborted. Left out when 0. |
bucket_context.lifecycle.rules[].expired_object_delete_marker | boolean | Whether expired object delete markers are removed. |
bucket_context.replication.role | string | IAM role ARN used for replication. Left out when there is no replication. |
bucket_context.replication.rules | array of objects | Replication rules that have a destination. Left out when there are none. |
bucket_context.replication.rules[].id | string | Rule ID. Left out when empty. |
bucket_context.replication.rules[].status | string | Enabled or Disabled. |
bucket_context.replication.rules[].destination_bucket_arn | string | ARN of the destination bucket. |
bucket_context.logging.target_bucket | string | Bucket that receives access logs. Left out when logging is off. |
bucket_context.logging.target_prefix | string | Prefix of the log objects. Left out when empty. |
bucket_context.website.hosting_enabled | boolean | Whether static website hosting is configured. |
bucket_context.website.index_suffix | string | Index document suffix. Left out when empty. |
An example input:
{
"bucket": {
"name": "acme-payments-audit-logs",
"arn": "arn:aws:s3:::acme-payments-audit-logs",
"region": "eu-west-1",
"creation_date": "2025-03-14T08:22:41Z"
},
"bucket_context": {
"current": {
"bucket_name": "acme-payments-audit-logs",
"bucket_arn": "arn:aws:s3:::acme-payments-audit-logs",
"region": "eu-west-1",
"tags_present": true,
"is_public": false,
"encryption_enabled": true,
"uses_kms": true,
"ownership_enforced": true,
"is_versioned": true,
"mfa_delete_enabled": false,
"object_lock_enabled": true,
"has_lifecycle_rules": true,
"lifecycle_min_expiration_days": 365,
"has_noncurrent_version_expiration": true,
"logging_enabled": true,
"replication_enabled": false,
"website_hosting_enabled": false
},
"bucket_home_region": "eu-west-1",
"tags": {
"Environment": "production"
},
"encryption": {
"rules": [
{
"algorithm": "aws:kms",
"kms_key_arn": "arn:aws:kms:eu-west-1:111122223333:key/1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"bucket_key_enabled": true
}
]
},
"public_access_block": {
"block_public_acls": true,
"ignore_public_acls": true,
"block_public_policy": true,
"restrict_public_buckets": true
},
"policy": {
"raw": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"DenyInsecureTransport\",\"Effect\":\"Deny\",\"Principal\":\"*\",\"Action\":\"s3:*\",\"Resource\":[\"arn:aws:s3:::acme-payments-audit-logs\",\"arn:aws:s3:::acme-payments-audit-logs/*\"],\"Condition\":{\"Bool\":{\"aws:SecureTransport\":\"false\"}}}]}"
},
"policy_hash": "9f2b6c1e0d4a7385b1c3e8f4a60d2c57e91b3a8d4f6c0e2a7b5d9138c4e6f0a2",
"policy_status": {
"is_public": false
},
"ownership_controls": {
"object_ownership": "BucketOwnerEnforced"
},
"versioning": {
"status": "Enabled",
"mfa_delete": "Disabled"
},
"object_lock": {
"enabled": true,
"default_retention_mode": "COMPLIANCE",
"default_retention_days": 365
},
"lifecycle": {
"rules": [
{
"id": "expire-old-logs",
"status": "Enabled",
"expiration_days": 365,
"noncurrent_version_expiration_days": 30,
"abort_incomplete_multipart_upload_after_days": 7,
"expired_object_delete_marker": false
}
]
},
"replication": {},
"logging": {
"target_bucket": "acme-access-logs",
"target_prefix": "s3/acme-payments-audit-logs/"
},
"website": {
"hosting_enabled": false
}
}
}
Subject templates
The subject templates this plugin registers. Each example is built from sample data.
aws-s3-bucket
An Amazon S3 bucket. Title: AWS S3 bucket {{ .bucket_name }} in {{ .region }}. The evidence also carries type (bucket) and resource_arn labels that are not part of the identity.
| Identity key | Description |
|---|---|
provider | Cloud provider, always aws. |
region | Region the bucket lives in. |
bucket_name | Name of the bucket. |
Example:
{
"name": "aws-s3-bucket",
"type": "component",
"title": "AWS S3 bucket acme-payments-audit-logs in eu-west-1",
"description": "Amazon S3 bucket acme-payments-audit-logs in AWS region eu-west-1.",
"purpose": "Represents an Amazon S3 bucket evaluated for storage compliance posture.",
"identityLabels": {
"provider": "aws",
"region": "eu-west-1",
"bucket_name": "acme-payments-audit-logs"
}
}
Policies
The policy bundles that work with this plugin, at their newest releases. The controls are the ones the bundle's policies list in their metadata.
| Bundle | Latest version | Controls covered | Compatible plugin lines |
|---|---|---|---|
plugin-aws-s3-policies | v0.1.1 | none listed | latest |
Default policy bundle mapping
| Repository | Behavior | Primary input |
|---|---|---|
| plugin-aws-s3-policies | bucket | input.bucket + input.bucket_context |