Skip to content
Source
Sign inSign up

Read the audits

CI / Secrets and trust

Read the egress and secret audits

You want to know who read or used a secret value, and where a job sent its requests. The forge records both: each write, read and use of a secret value, and each outbound request of a job.

3 min read

You need admin access to the repository to read the secret audit.

1. Read the newest entries

src secret audit

The command shows the 30 newest entries of the secret audit.

2. Narrow it to one environment or one secret

src secret audit --env production
src secret audit --name NPM_TOKEN --limit 100
  • --env shows one environment.
  • --name shows one secret.
  • --limit shows more than the 30 newest entries.

Done

You see who wrote, read, deleted or used each secret value, and when. The Activity part of the Secrets section in Settings shows the latest entries of the chosen environment too.

The secret audit

The forge records what happens to each secret value:

  • A person or a token writes it, reads it back (src secret get, src env pull) or deletes it.
  • The first request of a job needs it, and the forge reads it for that job.

Admins read the trail. An entry names the secret, the environment, the time, who acted, and for the read of a job, the job. It never holds a value.

  • REST: GET /ci/secrets/audit?name=&environment=&limit=&cursor=, at most 200 entries a page, with next as the cursor of the older page.
  • MCP: list_ci_secret_audit.

The forge keeps each entry for 12 months by default, then deletes it. A site admin can change this time with the Audit retention limit. See Set the limits of the site.

The egress audit

Every outbound request of a job goes through the forge, and the forge records it in the record of the job:

  • The first 500 requests, one by one: the method, the URL, the decision and the status. The URL has no credentials, and each placeholder shows as the name of its secret.
  • All requests after those, as a count for each host and decision. After 64 such counts, the requests to other hosts share one count for each decision.

A job makes at most 50,000 outbound requests. A request past that gets 429, and the job error says why.

The audit stays in the record of the job until its run is deleted. The forge deletes a run 1 year after it ends, by default, and an admin can delete it sooner. The logs of the job go after 90 days by default, but the audit stays. The limits list both times.