See who has read a secret
Read a secret's access log, and see where its value comes from, every place it is wired to, and which version each one last read.
Replace 5b8c1d2e-3f4a-4b6c-8d7e-9f0a1b2c3d4e with the secret's id.
Prerequisites
- For the access log,
secrets:GetSecretAccessLogon the secret. Every call that reaches the permission check is recorded in the audit log, allowed or refused. - For the flow,
secrets:GetSecret; its last reads also needsecrets:GetSecretAccessLog. - In the console, also
secrets:ListSecretsto open Secrets; without it the page says "You do not have permission to list secrets."
Read the access log
- Open Secrets and choose the secret.
- In its panel, read Last read: the version, the consumer or how it was read, and the time.
Without the permission, the section says "The access log needs secrets:GetSecretAccessLog."
dcloud secrets secrets access-log 5b8c1d2e-3f4a-4b6c-8d7e-9f0a1b2c3d4eGET /secrets/api/secrets/5b8c1d2e-3f4a-4b6c-8d7e-9f0a1b2c3d4e/accessThe API returns the 20 latest reads, newest first: version, consumer (null for a person's
read), iamUserId, context, resource (the reader's resource name) and at. The console shows
the 8 latest.
See where a secret goes
In the secret's panel, read Flow.
dcloud secrets secrets flow 5b8c1d2e-3f4a-4b6c-8d7e-9f0a1b2c3d4eGET /secrets/api/secrets/5b8c1d2e-3f4a-4b6c-8d7e-9f0a1b2c3d4e/flowThe flow shows, from left to right:
- Where the value comes from: our store, or the source and reference it syncs from, with the sync status.
- The secret: its active version and the key it is encrypted under.
- What it is wired to: an app's environment variable, database, cache or registry binding, or Error Tracking binding; a workflow grant, per repository; a database's or cache's own password; a source's credential. Each shows the version it last read and when. One that last read an older version than the active one is stale until its next rollout or run.
Function bindings and pull-through cache logins are not drawn as wiring: their reads appear in
the list below it, "Also read by, though no longer wired to it", with every other read by a
resource not drawn. Without secrets:GetSecretAccessLog, the wiring is shown and the reads are
hidden (reads: "hidden").
See the secrets an app uses
GET /secrets/api/apps/{appId}/flow (dcloud secrets secrets app-flow <appId>, needs
deploy:DescribeApp) lists each secret the app uses, how, where it comes from and the version the
app last read. Secrets you may not describe are left out; an unknown app answers an empty list.