DevSecOps
Security built into the merge path, not bolted on after - lint, secret, and vulnerability scanning as required checks, so unsafe change cannot reach main.
What it is & why I use it
DevSecOps in AutomationLab means the security checks live in the pull-request
gate, next to the linters and tests, rather than in a periodic scan someone reviews
later. Every change to main goes through branch protection with a set of
required checks - and if a security check fails, the merge does not happen.
I do it this way because security that runs after merge is security that finds problems already shipped. Moving the checks left, onto the branch, turns "we found a vulnerability in production" into "the PR could not merge until it was fixed" - a far cheaper place to catch things.
How I use it in the lab
- Secret scanning. Every change is scanned for committed credentials before it can merge, so a leaked token is caught at the gate rather than discovered later.
- Vulnerability scanning. Built container images are scanned for known CVEs, so a base image dragging in a critical vulnerability is visible before it is deployed.
- Config and IaC linting. YAML, Ansible, and Terraform are linted as checks, so malformed or unsafe declarations fail fast instead of at apply time.
- Required, not advisory. These run as required status checks under branch protection - a red check blocks the merge; they are gates, not suggestions.
Architecture
In action
Lessons learned & gotchas
- Required beats scheduled. A scan that runs nightly finds yesterday's problem in production. The same scan as a required PR check finds it before it exists downstream - same tool, completely different value.
- Not every vulnerability is instantly fixable - decide deliberately. A base image can carry a CVE with no patched version yet. The check surfacing it is correct; the judgement is whether to wait, swap the base, or accept and track it - explicitly, not by silently muting the scanner.
- Keep secrets out of the repo entirely. The cleanest way to pass secret scanning is to have no secrets to find - they belong in the secrets manager, fetched at run time, never committed in the first place.
Impact
DevSecOps is what keeps the lab's "everything is a reviewed PR" discipline from being only about correctness - it makes it about safety too. The rotate-not-delete lesson is the one I would want any team to internalize: once a secret has touched version control it is spent, and the only honest response is to make the leaked value useless.
Code & further reading
Published CI configuration is scrubbed of hostnames, addresses, and any real finding detail before it goes public.