AWS Secrets Manager
This repository builds a CCF RunnerV2 plugin for AWS Secrets Manager. It collects read-only Secrets Manager metadata, resource policies, version stages, tags, and CloudTrail event history, then evaluates configured Rego policy bundles against one normalized record per secret ARN.
The plugin never calls GetSecretValue.
This page is for operators who run the plugin-aws-secretsmanager plugin with the CCF Agent, and for developers who write policies for it. It documents v0.1.4 and is generated from the plugin's README at v0.1.4.
How it works
CloudTrail Attribution
Secrets Manager events are matched to a secret by ARN, friendly name with suffix, or friendly name without suffix using substring checks against the raw CloudTrail event during collection. This is intentional because many Secrets Manager event types put the identifier in requestParameters rather than the structured Resources list.
IAM credential-removal events are account-wide. The plugin parses affected userName, roleName, userArn, and roleArn from requestParameters and attaches the event only to secrets whose resource-policy principal strings substring-match those identifiers. Unmatched IAM events are dropped.
Only normalized event fields are emitted; raw CloudTrail payloads are not included in Rego input.
Error Scoping
Target-level failures, such as ListSecrets or CloudTrail lookup failure for an account/region, are stored once under target scope. They are not copied onto every secret.
Per-secret failures, such as a GetResourcePolicy error for one ARN, are attached only to that secret's collection.errors. ResourceNotFoundException and empty resource policies are valid no-policy states, not errors.
Out of Scope
KMS key policy, key rotation, and grants are collected by plugin-aws-kms; this plugin records only the kms_key_id string from Secrets Manager. IAM principal resolution belongs to plugin-aws-iam; this plugin records policy principal strings and CloudTrail IAM-event ARNs only. Decrypted secret material is never read.
Configuration
The CCF agent passes flat string config. Structured values are JSON strings.
| Key | Default | Notes |
|---|---|---|
accounts | [] | JSON array of {account_id, regions[], role_arn, external_id, session_name, tags{}}. Empty uses the ambient AWS credential chain. |
default_regions | [] | JSON array used when an account omits regions; then falls back to the SDK default region. |
lookback_days | 90 | Positive integer up to 90, used for CloudTrail event history. |
policy_inputs | {} | JSON object exposed to Rego as input.policy_inputs. |
policy_input | {} | Alias for policy_inputs. |
policy_labels | {} | JSON string map merged into evidence labels. |
max_concurrency | 4 | Positive worker count for account/region targets; 0 is normalized to 1. |
api_timeout_seconds | 120 | Positive per-target budget covering all paginated Secrets Manager, CloudTrail, and STS calls for one account/region. |
Runtime logs default to info. Set LOG_LEVEL to debug, info, warn, or error to override the level.
Evidence collected
Subject
The plugin registers one subject template:
| Name | Type | Identity labels |
|---|---|---|
aws-secretsmanager-secret | component | account_id, region, resource_id |
Every evidence record also includes labels: provider=aws, type=secretsmanager, subject=aws-secretsmanager-secret, account_id, region, resource_id, resource_arn, resource_type=secret, and account_tag_<key> for account config tags. resource_id is the ARN segment after the final : and keeps the AWS 6-character suffix.
Coverage
CONFIG evidence supports rotation, vendor credential, confidentiality, and privacy policy bundles through DescribeSecret, GetResourcePolicy, ListSecretVersionIds, and tags from DescribeSecret. Fields include rotation state, rotation rules, KMS key ID string, owning service, replication status, version stages, resource policy principals, and hashed name/description.
For secrets marked for deletion, the collector records DescribeSecret metadata, deleted_date, and any matched CloudTrail deletion context, but skips per-secret subresource calls such as GetResourcePolicy and ListSecretVersionIds because AWS rejects those operations for pending-deletion secrets.
DYNAMIC evidence uses a 90-day default CloudTrail lookback. Secrets Manager events are filtered to RotateSecret, PutSecretValue, UpdateSecret, UpdateSecretVersionStage, DeleteSecret, RestoreSecret, PutResourcePolicy, DeleteResourcePolicy, TagResource, UntagResource, CreateSecret, and GetSecretValue. IAM credential-removal events are filtered to DeleteUser, DeleteAccessKey, DetachUserPolicy, RemoveUserFromGroup, DeleteRole, DetachRolePolicy, and RemoveRoleFromInstanceProfile.
Policy input
The plugin evaluates one kind of resource, a Secrets Manager secret, and a policy receives one document per secret as input. The document has a resource.type of secret; the plugin never reads the secret value. Names and descriptions are not sent in clear text: config.name_hash and config.description_hash carry SHA-256 hashes written as sha256: followed by the hex digest. Dates are RFC 3339 strings in UTC, and are an empty string when AWS reports none. The table lists every field with its full path.
| Field | Type | Description |
|---|---|---|
schema_version | string | Version of this document layout. Always v1. |
source | string | Always aws-secretsmanager. |
account.account_id | string | AWS account ID the secret belongs to. |
account.role_arn | string | ARN of the role the plugin assumed for the account. Empty when it used its own credentials. |
account.tags | object (string to string) | Tags set on the account in the plugin configuration. Not the secret's tags. |
region.name | string | AWS region the secret lives in. |
resource.id | string | The secret's friendly name followed by the six-character suffix AWS adds, the last part of the ARN. |
resource.arn | string | ARN of the secret. |
resource.type | string | Always secret. |
config.secret_arn | string | ARN of the secret, as in resource.arn. |
config.name_hash | string | Hash of the secret name. |
config.description_hash | string | Hash of the secret description. The hash of an empty string when there is no description. |
config.kms_key_id | string | KMS key that encrypts the secret. aws/secretsmanager when AWS reports none, which means the AWS-managed default key. |
config.rotation_enabled | boolean | Whether automatic rotation is turned on. |
config.rotation_lambda_arn | string | ARN of the Lambda function that rotates the secret. Empty when none. |
config.rotation_rules.automatically_after_days | integer | Days between automatic rotations. 0 when no interval is set. |
config.rotation_rules.schedule_expression | string | Rotation schedule as a cron or rate expression. Empty when none. |
config.rotation_rules.duration | string | Length of the rotation window. Empty when none. |
config.last_rotated_date | string (RFC 3339 time) | When the secret was last rotated. Empty when never. |
config.last_changed_date | string (RFC 3339 time) | When the secret or its metadata last changed. Empty when AWS reports none. |
config.last_accessed_date | string (RFC 3339 time) | The last day the secret value was retrieved. Empty when AWS reports none. |
config.deleted_date | string (RFC 3339 time) | When the secret is scheduled for deletion. Empty when it is not. A secret with a date here has no resource policy or versions in the document, because the plugin skips those calls. |
config.recovery_window_days | integer | Recovery window the secret was deleted with, taken from a matching CloudTrail DeleteSecret event. 0 when no such event was found. |
config.owning_service | string | AWS service that manages the secret. Empty for a secret you manage yourself. |
config.replication_status | array of objects | One entry per replica region: region, status, last_accessed_date and status_message, all strings. An empty array when the secret is not replicated. |
config.resource_policy_present | boolean | Whether the secret has a resource policy. |
config.resource_policy.hash | string | Hash of the policy text. Empty when there is no policy. |
config.resource_policy.document | object or null | The resource policy as parsed JSON. null when there is no policy. {"_parse_error": "..."} when the text is not valid JSON. |
config.resource_policy.principals | array of objects | One entry per principal per statement, with principal (string), action (array of strings), condition (the statement's condition object, or null) and effect (Allow or Deny). Empty when there is no policy. |
config.versions | array of objects | Every version of the secret, deprecated ones included: version_id (string), created_date (string), kms_key_ids (array of strings) and stages (array of strings, such as AWSCURRENT). Empty for a secret scheduled for deletion. |
config.deprecated_version_count | integer | Number of versions that have no stage label. |
dynamic.cloudtrail_events | array of objects | Secrets Manager CloudTrail events in the lookback window that name this secret. Each has event_name, event_time, user_identity_arn, aws_region, event_id (strings) and resources (array of strings). Raw event payloads are not included. Empty when CloudTrail returned nothing. |
dynamic.iam_credential_removal_events | array of objects | IAM credential-removal events, such as DeleteAccessKey, whose user or role appears in one of the secret's resource-policy principals. Same fields as dynamic.cloudtrail_events. |
tags | object (string to string) | The secret's own tags. |
collection.collected_at | string (RFC 3339 time) | When the plugin collected the data. |
collection.collector_version | string | Always aws-secretsmanager. |
collection.collection_type | string | config_dynamic when CloudTrail data was collected, otherwise config. |
collection.lookback_window.start | string (RFC 3339 time) | Start of the CloudTrail window, set by the lookback_days setting. |
collection.lookback_window.end | string (RFC 3339 time) | End of the CloudTrail window. |
collection.raw_payload_hashes | object (string to string) | Hashes of the raw AWS responses under describe, policy and versions. |
collection.errors | array of objects | Failures that affected only this secret, each with scope (the secret's ARN) and message. Empty when everything succeeded. |
policy_inputs | object | The policy_inputs (or policy_input) setting from the plugin configuration, passed through unchanged. {} when not set. |
An example input:
{
"schema_version": "v1",
"source": "aws-secretsmanager",
"account": {
"account_id": "111122223333",
"role_arn": "arn:aws:iam::111122223333:role/ccf-readonly",
"tags": {
"environment": "prod"
}
},
"region": {
"name": "eu-west-1"
},
"resource": {
"id": "payments/db/credentials-AbCdEf",
"arn": "arn:aws:secretsmanager:eu-west-1:111122223333:secret:payments/db/credentials-AbCdEf",
"type": "secret"
},
"config": {
"secret_arn": "arn:aws:secretsmanager:eu-west-1:111122223333:secret:payments/db/credentials-AbCdEf",
"name_hash": "sha256:9f2c4e7a1b5d83c60a47e1f2d9b8c3a5e6f70812a3b4c5d6e7f8091a2b3c4d5e",
"description_hash": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"kms_key_id": "arn:aws:kms:eu-west-1:111122223333:key/1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"rotation_enabled": true,
"rotation_lambda_arn": "arn:aws:lambda:eu-west-1:111122223333:function:rotate-db",
"rotation_rules": {
"automatically_after_days": 30,
"schedule_expression": "",
"duration": ""
},
"last_rotated_date": "2026-10-12T03:00:00Z",
"last_changed_date": "2026-10-12T03:00:00Z",
"last_accessed_date": "2026-11-16T14:22:11Z",
"deleted_date": "",
"recovery_window_days": 0,
"owning_service": "",
"replication_status": [
{
"region": "eu-central-1",
"status": "InSync",
"last_accessed_date": "2026-11-16T14:22:11Z",
"status_message": ""
}
],
"resource_policy_present": true,
"resource_policy": {
"hash": "sha256:7d1a0c9e5b3f2a48c6e0d1f9b7a5c3e18f2d4b6a8c0e1f3a5b7d9c2e4f6a8b0c",
"document": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:role/app-reader"
},
"Action": "secretsmanager:GetSecretValue",
"Resource": "*"
}
]
},
"principals": [
{
"principal": "arn:aws:iam::111122223333:role/app-reader",
"action": [
"secretsmanager:GetSecretValue"
],
"condition": null,
"effect": "Allow"
}
]
},
"versions": [
{
"version_id": "6f3a9c1e-2b4d-4e8f-9a0b-1c2d3e4f5a6b",
"created_date": "2026-10-12T03:00:00Z",
"kms_key_ids": [
"arn:aws:kms:eu-west-1:111122223333:key/1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
],
"stages": [
"AWSCURRENT"
]
},
{
"version_id": "0b8e7d6c-5a4f-4e3d-8c2b-1a0f9e8d7c6b",
"created_date": "2026-09-12T03:00:00Z",
"kms_key_ids": [
"arn:aws:kms:eu-west-1:111122223333:key/1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
],
"stages": [
"AWSPREVIOUS"
]
}
],
"deprecated_version_count": 0
},
"dynamic": {
"cloudtrail_events": [
{
"event_name": "RotateSecret",
"event_time": "2026-10-12T03:00:00Z",
"user_identity_arn": "arn:aws:sts::111122223333:assumed-role/rotate-db/rotate-db",
"aws_region": "eu-west-1",
"event_id": "3c5e7a91-4b2d-4f68-8a0c-9d1e2f3a4b5c",
"resources": [
"payments/db/credentials-AbCdEf"
]
}
],
"iam_credential_removal_events": []
},
"tags": {
"Owner": "platform-team",
"Environment": "prod",
"DataClassification": "confidential"
},
"collection": {
"collected_at": "2026-11-17T12:00:00Z",
"collector_version": "aws-secretsmanager",
"collection_type": "config_dynamic",
"lookback_window": {
"start": "2026-08-19T12:00:00Z",
"end": "2026-11-17T12:00:00Z"
},
"raw_payload_hashes": {
"describe": "sha256:b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f70819203",
"policy": "sha256:c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7081920314",
"versions": "sha256:d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192031425"
},
"errors": []
},
"policy_inputs": {}
}
Subject templates
The subject templates this plugin registers. Each example is built from sample data.
aws-secretsmanager-secret
One Secrets Manager secret, evaluated for compliance posture. Title: Secrets Manager secret {{ .resource_id }} in {{ .account_id }}/{{ .region }}. The evidence also carries a resource_arn label that is not part of the identity.
| Identity key | Description |
|---|---|
account_id | AWS account ID. |
region | AWS region. |
resource_id | The secret's friendly name followed by its six-character suffix. |
Example:
{
"name": "aws-secretsmanager-secret",
"type": "component",
"title": "Secrets Manager secret payments/db/credentials-AbCdEf in 111122223333/eu-west-1",
"description": "AWS Secrets Manager secret payments/db/credentials-AbCdEf.",
"purpose": "Represents a Secrets Manager secret evaluated for compliance posture.",
"identityLabels": {
"account_id": "111122223333",
"region": "eu-west-1",
"resource_id": "payments/db/credentials-AbCdEf"
}
}
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-secretsmanager-policies | v0.1.2 | ctrl-c1-1-003, ctrl-c1-2-001, ctrl-c1-2-006, ctrl-c1-2-007, ctrl-c1-2-011, ctrl-cc5-1-006, ctrl-cc5-2-005, ctrl-cc5-3-033, ctrl-cc6-2-014, ctrl-cc6-2-018, ctrl-cc6-2-019, ctrl-cc6-2-020, ctrl-cc6-2-023, ctrl-cc6-2-024, ctrl-cc6-2-025, ctrl-cc6-2-026, ctrl-cc6-3-004, ctrl-cc9-2-007, ctrl-p6-1-004, ctrl-p6-5-002 | latest |