Skip to main content

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.

KeyDefaultNotes
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_days90Positive 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_concurrency4Positive worker count for account/region targets; 0 is normalized to 1.
api_timeout_seconds120Positive 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:

NameTypeIdentity labels
aws-secretsmanager-secretcomponentaccount_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.

FieldTypeDescription
schema_versionstringVersion of this document layout. Always v1.
sourcestringAlways aws-secretsmanager.
account.account_idstringAWS account ID the secret belongs to.
account.role_arnstringARN of the role the plugin assumed for the account. Empty when it used its own credentials.
account.tagsobject (string to string)Tags set on the account in the plugin configuration. Not the secret's tags.
region.namestringAWS region the secret lives in.
resource.idstringThe secret's friendly name followed by the six-character suffix AWS adds, the last part of the ARN.
resource.arnstringARN of the secret.
resource.typestringAlways secret.
config.secret_arnstringARN of the secret, as in resource.arn.
config.name_hashstringHash of the secret name.
config.description_hashstringHash of the secret description. The hash of an empty string when there is no description.
config.kms_key_idstringKMS key that encrypts the secret. aws/secretsmanager when AWS reports none, which means the AWS-managed default key.
config.rotation_enabledbooleanWhether automatic rotation is turned on.
config.rotation_lambda_arnstringARN of the Lambda function that rotates the secret. Empty when none.
config.rotation_rules.automatically_after_daysintegerDays between automatic rotations. 0 when no interval is set.
config.rotation_rules.schedule_expressionstringRotation schedule as a cron or rate expression. Empty when none.
config.rotation_rules.durationstringLength of the rotation window. Empty when none.
config.last_rotated_datestring (RFC 3339 time)When the secret was last rotated. Empty when never.
config.last_changed_datestring (RFC 3339 time)When the secret or its metadata last changed. Empty when AWS reports none.
config.last_accessed_datestring (RFC 3339 time)The last day the secret value was retrieved. Empty when AWS reports none.
config.deleted_datestring (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_daysintegerRecovery window the secret was deleted with, taken from a matching CloudTrail DeleteSecret event. 0 when no such event was found.
config.owning_servicestringAWS service that manages the secret. Empty for a secret you manage yourself.
config.replication_statusarray of objectsOne 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_presentbooleanWhether the secret has a resource policy.
config.resource_policy.hashstringHash of the policy text. Empty when there is no policy.
config.resource_policy.documentobject or nullThe resource policy as parsed JSON. null when there is no policy. {"_parse_error": "..."} when the text is not valid JSON.
config.resource_policy.principalsarray of objectsOne 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.versionsarray of objectsEvery 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_countintegerNumber of versions that have no stage label.
dynamic.cloudtrail_eventsarray of objectsSecrets 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_eventsarray of objectsIAM 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.
tagsobject (string to string)The secret's own tags.
collection.collected_atstring (RFC 3339 time)When the plugin collected the data.
collection.collector_versionstringAlways aws-secretsmanager.
collection.collection_typestringconfig_dynamic when CloudTrail data was collected, otherwise config.
collection.lookback_window.startstring (RFC 3339 time)Start of the CloudTrail window, set by the lookback_days setting.
collection.lookback_window.endstring (RFC 3339 time)End of the CloudTrail window.
collection.raw_payload_hashesobject (string to string)Hashes of the raw AWS responses under describe, policy and versions.
collection.errorsarray of objectsFailures that affected only this secret, each with scope (the secret's ARN) and message. Empty when everything succeeded.
policy_inputsobjectThe 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 keyDescription
account_idAWS account ID.
regionAWS region.
resource_idThe 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.

BundleLatest versionControls coveredCompatible plugin lines
plugin-aws-secretsmanager-policiesv0.1.2ctrl-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-002latest