Prompt
How do I audit who accessed or changed a secret?
Latest observation
To audit who accessed or changed a secret, you generally need both:
- Audit logging enabled on the secret store
- A trail that ties the secret event to an identity (user, role, service account, app)
The exact steps depend on where the secret lives. Here’s the general approach:
What to look for
You want log events such as:
- Read/access of the secret
- Create/update of the secret value
- Delete/rotate of the secret
- Permission/policy changes affecting the secret
- Failed access attempts too, if you care about probing
Typical audit sources by platform
AWS Secrets Manager
Use CloudTrail and look for:
GetSecretValue→ secret read/accessPutSecretValue→ secret updatedUpdateSecretDeleteSecretTagResource,UntagResource- IAM-related events if access changed
Azure Key Vault
Use Key Vault diagnostic logs / Azure Monitor:
SecretGetSecretSetSecretDeleteSecretList- Access policy / RBAC changes
Google Secret Manager
Use Cloud Audit Logs:
AccessSecretVersionAddSecretVersionDestroySecretVersion- IAM policy changes
HashiCorp Vault
Use Vault audit devices:
readcreateupdatedelete- Includes request path, auth token identity, and response metadata
Kubernetes secrets
Kubernetes itself does not provide strong native auditing for secret reads unless audit logging is enabled and the request goes through the API server. Check:
- Kubernetes audit logs
- RBAC bindings for service accounts/users
- External secret controllers, if used
What to inspect in the audit record
A useful audit entry should show:
- Who: user/role/service principal/service account
- What: secret name/path/version
- When: timestamp
- Action: read/write/delete/rotate
- Where from: IP, host, region, workload
- Result: success/failure
- Correlation info: request ID / trace ID
If you don’t see audit logs
If auditing wasn’t enabled before the event, you usually cannot reconstruct exact secret reads retroactively. You may only infer from:
- IAM policy changes
- application logs
- access logs from the secret store
- downstream system behavior
Recommended practice
- Enable audit logging on the secret manager
- Send logs to a centralized immutable store/SIEM
- Alert on secret reads outside expected apps, times, or regions
- Rotate secrets after suspicious access
- Use least-privilege IAM/RBAC and short-lived credentials
If you tell me which secret system you’re using (AWS, Azure, GCP, Vault, Kubernetes, etc.), I can give you the exact audit steps and example queries.