Security that depends on heroics does not scale. The highest-leverage move is making the easy path the safe path.
Most organizations run security as a series of checkpoints outside the delivery path: a review before launch, a penetration test once a year, a scanner report nobody owns. Findings arrive late, when fixing them means rework and delay, so they get negotiated down or deferred. The alternative is to put controls where work already happens, in templates, pipelines, and platform defaults, so a team following the normal path is secure without having to think about it.
Put controls where work already happens
Ask where a developer makes each security-relevant decision, and move the control there:
- Choosing a base image happens in the service template, so the template should pin an approved, minimal image.
- Adding a dependency happens in a pull request, so dependency and license checks belong in pull request CI.
- Getting cloud access happens in the pipeline, so the pipeline should use short-lived identity rather than stored keys.
- Deploying happens in the cluster, so the cluster should verify what it runs.
A control that lives in a separate portal or a separate review meeting will always lose to a deadline. A control that is simply how the template works does not need to win an argument.
Replace long-lived credentials with identity
Stored cloud keys in CI are one of the most common findings we see, and one of the most dangerous. They are copied between projects, rarely rotated, and usually over-privileged. OIDC workload identity federation removes them entirely: the pipeline presents a short-lived token that proves which repository, branch, and environment it is running for, and the cloud grants a narrowly scoped role in return.
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::123456789012:role/deploy-orders-prod
aws-region: us-east-1On the cloud side, the role's trust policy should restrict the token's subject to the specific repository and protected environment. Then delete the old keys. Rotating them is not the same as removing them.
Protect the path to production
The pipeline is part of your production system and deserves the same protection:
- Require reviews and passing checks on the default branch, with no direct pushes, including for administrators.
- Use protected environments for production deploys, with required approvers where the risk warrants it.
- Pin third-party CI actions and build dependencies to a specific version or digest, not a floating tag.
- Run builds on ephemeral runners so nothing persists between jobs.
- Keep pipeline definitions under the same review rules as application code.
Know what you ship and prove where it came from
Supply-chain security comes down to three questions: what is in this artifact, who built it, and has it changed since?
- Software bill of materials: generate an SBOM at build time and store it with the artifact, so you can answer "are we affected?" within minutes when the next widely exploited vulnerability is announced.
- Signing: sign images and artifacts at build time, ideally with keyless signing tied to the pipeline's identity.
- Provenance: record how and where the artifact was built, following a framework such as SLSA, and attach it to the artifact.
- Verification: have the deployment target verify the signature and provenance before running anything. Signing without verification is paperwork.
Promote artifacts by immutable digest through environments rather than rebuilding them for each one. What was tested should be exactly what runs.
Automate the hygiene nobody enjoys
Some controls are dull but high-value, and they only happen reliably when they are automated:
- Secret scanning in pre-commit hooks and in CI, with push protection so a leaked key never lands.
- Automated dependency update pull requests, grouped and scheduled so they do not become noise.
- Static analysis tuned to a small set of high-confidence rules. A scanner that produces hundreds of low-value findings trains people to ignore it.
- Infrastructure-as-code checks for common misconfigurations such as public storage, missing encryption, and overly broad network rules.
Make exceptions visible and temporary
Every real organization needs exceptions. The problem is exceptions that are silent and permanent. Policy-as-code makes them manageable: an exception is a reviewed change with an owner, a reason, and an expiry date. When it expires, the check fails again and someone has to decide.
An exception without an expiry date is not an exception. It is the new policy, adopted without anyone deciding.
Measure adoption, not just findings
Counting vulnerabilities tells you about the past. Measuring adoption of the paved road tells you about the future. Track the share of services built from current templates, the share of pipelines using workload identity, the share of production workloads running verified images, and the number and age of open exceptions. When those numbers rise, findings fall as a consequence.
Where to start
- Inventory long-lived credentials in CI and replace the highest-privilege ones with workload identity first.
- Turn on branch protection and secret scanning with push protection across all repositories.
- Add SBOM generation and image signing to the standard pipeline template.
- Enable signature verification at admission in audit mode, review what would have been blocked, then enforce.
- Move exceptions into policy-as-code with owners and expiry dates, and review them monthly.
Security reviews become easier when the answer to most questions is "that is how every service is built."