Search LA24X

Keyboard shortcut: Ctrl / ⌘ + K

Type two characters to search, or explore the library.

Open the topic library →

Privacy choices

Choose what suits you. Reading and tools work without analytics or optional saving.

Necessary — always active

Page delivery, language and privacy preferences.

Advertising

Storage details ↗

Protect CI/CD credentials from the code your pipeline builds

Separate untrusted checks from privileged releases, scope workflow permissions and review third-party actions as executable dependencies.

Illustration for Protect CI/CD credentials from the code your pipeline builds
✓ Log redaction does not stop running code from using a credential.✓ A third-party action is code executed in your workflow.

In brief

A build pipeline executes repository code and dependencies. Giving every build production secrets turns a code or dependency compromise into an access problem beyond the build itself.

Separate low-trust pull-request checks from the reviewed workflow that can publish or deploy.

Draw the trust boundary around inputs

Inspect who can change the code, workflow and artifacts used by the privileged job. Do not execute untrusted pull-request content in a privileged event simply to obtain secrets. Treat downloaded build artifacts as inputs with provenance, not automatically trusted because they came from another job.

Limit the credentials

Set explicit token permissions and prefer supported short-lived federation for deployment where appropriate. Scope stored secrets to the environment needing them. A test that only reads source should not receive registry publish or cloud administration credentials.

Review and recover

Pin third-party actions to reviewed immutable revisions where suitable, and maintain their updates. Protect workflow files and deployment branches. If a credential leaks, revoke it at its issuer and review affected runs; deleting a log or rerunning the pipeline does not invalidate the exposed value.

Before you act

Secret masking in logs is not a complete boundary: running code with access to a secret can still use it. Fork handling, workflow events and permissions must be understood for the platform you use.

What to do next

  1. List workflows, events, tokens and environments that can reach production.
  2. Give ordinary checks read-only or narrowly required permissions and no unnecessary secrets.
  3. Protect release changes, use reviewed actions and require appropriate approval for privileged environments.
You’ve reached the end. Save this guide for later.Back to top ↑