Treat the pipeline as production infrastructure

A continuous integration and continuous delivery (CI/CD) pipeline can read source code, access secrets and publish a release. Give it a clear owner and limit who can change workflow definitions.

Require review for changes to deployment steps. Protect the main branch and restrict write access to release credentials.

Limit credentials and permissions

Give each job only the permissions it needs. Use short-lived credentials or a trusted identity flow when available. Store secrets in the platform’s secret manager, not in workflow files or logs.

Separate build, test and production credentials. Review third-party actions and plugins before use, and pin important dependencies to a trusted version or commit.

Protect artifacts and deployment steps

Keep build logs and artifacts with release identifiers. Prevent an untrusted pull request from accessing production secrets. Require an approved person for high-impact deployments.

Test the pipeline recovery process. If a credential is exposed, know how to revoke it, rebuild the artifact and confirm which releases used the affected path.