Devsecops Culture Building

Production-grade guide to devsecops culture building covering architecture patterns, implementation strategies, testing approaches, and operational best practices for enterprise engineering teams.

Orientation

This page is about the cultural and organizational practices that make devsecops sustainable over time. It matters when a team has moved beyond installing scanners and needs the human habits, rituals, and shared responsibilities that turn ad‑hoc checks into a resilient security posture. The focus is on what engineers actually do day‑to‑day: the commands they run, the checks they verify, the failures they encounter, and the routines they institutionalize so that security stays attached to delivery rather than becoming a bottleneck or a after‑thought. The following sections are organized by the specific thing a reader is trying to accomplish, with concrete commands, exact error text, and the sharp edges that only appear after a production incident.

Onboard new team members to security‑aware development

A foundational culture practice is making security visible in the version‑control workflow. Many teams add a pre‑commit hook that scans for secrets before a commit ever reaches the CI system. A real, widely used tool for this is git-secrets. The following command scans the staging area:

git secrets --scan --cached

If a credential matching a known pattern is found, the exact output written to stdout is:

git-secrets: potential secret detected: aws_access_key_id AKIAIOSFODNN7EXAMPLE

The command exits with code 1, blocking the commit. If no secrets are present, the command exits with code 0 and produces no output.

Culture habit: The hook is installed once per clone via git config --global core.hooksPath .git-templates/hooks or added as a CI job step. The PR template includes a checklist item: “Run git secrets --scan --cached locally before requesting review.” Engineers who habitually run the scan before pushing develop a mental model of what constitutes a rotatable secret, and the team reviews blocked commits in the sprint retro as data, not as punishment.

Sharp edge: git-secrets relies on regex patterns maintained in a pattern file. Base64‑encoded keys, recently rotated credentials, or keys that happen to match a loose pattern can produce false positives. Over time, some engineers learn to append --ignore flags or to git commit --no-verify to bypass the block. The failure mode is that the bypass becomes routine, the scan loses teeth, and the culture practice degrades into a ceremonial gate. Teams that survive this learn to rotate patterns quarterly and to treat every blocked commit as a ticket that requires a root‑cause discussion, not a simple exception.

Enforce secret hygiene without slowing merges

When a secret is discovered in history, the fastest remediation path is rotation plus history sanitization. The following git filter‑replace pattern is a real, scriptable approach that many open‑source projects embed in their onboarding docs:

git filter-repo --path .env --replace-text <(echo '*.env export SECRET=REPLACE_ME')

Running this rewrites the local history, after which the engineer runs:

git secrets --scan --full-history --no-cache

If the rewrite was successful, the exact output is empty and the exit code is 0. If any reference survives, the command again prints lines like:

git-secrets: potential secret detected: aws_access_key_id AKIAIOSFODNN7EXAMPLE

Culture habit: The team maintains a “secrets rotator” runbook that records the old secret’s service, the rotation ticket number, and the commit hash where the secret was originally introduced. The runbook step “Run git filter-repo on all developer forks” is checked off in the PR that merges the rotation. This ties secret hygiene to the same ticketing system used for feature work, reinforcing that credential management is development work, not a security‑team side‑car.

Sharp edge: git filter-repo rewrites public history. If the repository is shared or has forks that haven’t been force‑pushed, the command can leave dangling references or cause merge conflicts that are invisible until the next git pull. Engineers who have learned this the hard way now add a post‑run verification step: git log --all --oneline | wc -l compared before and after the filter, and a mandatory “force‑push only after all team members have rebased” rule in the runbook. The silence of a successful rewrite with dangling refs is the most common cause of “secret still appears in old PR comments” incidents.

Validate runtime permissions before production deploys

RBAC drift is a silent culture killer. Before any production deploy, engineers are encouraged to run a dry‑run authorization check using the Kubernetes CLI. The exact command and its two possible outcomes are:

kubectl auth can-i create deployments --as=system:serviceaccount:myapp:prod

If the service account holds the privilege, the command exits 0 with no output. If the privilege is missing, the exact error text returned is:

Error: services "deployments" is forbidden: User "system:serviceaccount:myapp:prod" cannot create deployments at the cluster level

Culture habit: The deployment runbook includes a mandatory “Auth‑check step” where the engineer copies the exact kubectl auth can-i command, runs it against the target namespace, and pastes the result (success or error) into the deployment ticket. If the error appears, the ticket is triaged as an RBAC gap, assigned to the platform team, and the deployment is paused. This turns a potential “why did my pod fail?” post‑mortem into a predictable, repeatable checkpoint.

Sharp edge: kubectl auth can-i only reflects the RBAC matrix at the moment of execution. If a ClusterRole is being rolled out via kubectl apply in a separate terminal, the check may pass in one instant and fail seconds later, or vice‑versa. Engineers who have encountered this during an incident learn to run the check immediately before the kubectl apply -f deployment.yaml step, not minutes earlier. Another common confusion is between kubectl auth can-i (effective as the current user) and kubectl auth who-can (lists all subjects that could perform the action). The latter is often misused as a “does anyone have this?” query, but its output includes group mappings that are not immediately readable, leading engineers to assume no one has the privilege when in fact a service account inherited it through a cluster‑wide role binding. The runbook now explicitly documents the difference and schedules who-can checks only in quarterly audits, not per‑deploy.

Make scanner findings actionable and routed to the right owner

Vulnerability scanners produce a flood of findings; culture determines whether they become tickets or noise. A concrete pattern used by many teams is to pipe a scanner’s JSON output into a lightweight filter that extracts only the fields needed for a ticket. The following trivy command (a real, open‑source scanner) generates a focused report:

trivy image --exit-code 1 --severity HIGH,CRITICAL myregistry/app:latest --format json | jq -r '.Results[0].Vulnerabilities[] | "\(.VulnerabilityID) \(.Severity) \(.PkgName) \(.InstalledVersion)"'

If findings exist, the exact output per line looks like:

CVE-2023-12345 HIGH openssl 3.0.2
CVE-2023-9876 CRITICAL curl 7.88.1

If the image is clean, the command exits 0 and produces no stdout.

Culture habit: The CI job posts the jq‑filtered output to a dedicated Slack channel #sec-findings. A small automation (a GitHub Action or GitLab pipeline stage) reads the channel and auto‑creates a ticket in the team’s work‑management system, pre‑populating the title with the CVE ID, severity, and affected package. The engineer who merged the image tag is auto‑assigned, and the ticket is labeled “security‑remediation.” This closes the loop between scanner output and delivery workflow without requiring a manual triage meeting.

Sharp edge: trivy’s severity mapping depends on the CVE database version bundled with the binary. If the team runs an older trivy version, a vulnerability that has been assigned a higher severity in the public NVD may still appear as “LOW” in the report, causing the auto‑ticket to be labeled “low priority” when it should be urgent. Engineers who have seen this mismatch now pin the trivy version in the CI image and run trivy image --check-updates weekly to refresh the internal DB. Another subtle failure: when a private registry requires authentication, trivy image may silently skip the scan and exit 0 with no output, leaving the engineer unaware that the image was never evaluated. The runbook now includes a pre‑step docker login $REGISTRY before the scan, and the CI job fails if the login step returns a non‑zero exit code.

Institutionalize security rituals that survive sprint pressure

Rituals that are tied to system services rather than “remember to run” are the most durable. The following systemctl command checks the status of a timer that runs a quarterly audit script:

systemctl status devsecops-audit.timer

Typical active output (real systemctl format) is:

● devsecops-audit.timer - Run quarterly security audit load
   Loaded: loaded; enabled; vendor preset: enabled
   Active: active since Tue 2024-06-11 09:00:00 UTC; 3 weeks 2 days ago
   Trigger: Tue 2024-06-11 09:00:00 UTC; 3 weeks 2 days ago (and could be repeated once again)

If the timer has failed, the active line changes to:

Active: failed since Tue 2024-06-11 09:01:00 UTC; 3 weeks ago
Trigger: Tue 2024-06-11 09:01:00 UTC; 3 weeks ago (and could be repeated once again)

Culture habit: The timer unit file is stored in a version‑controlled infra/ directory. Changes to the timer (new audit scripts, schedule adjustments) go through the same PR process as infrastructure code. The sprint retro always includes a “timer health” check: “Did the quarterly audit run? Did anyone receive the Slack webhook?” If the timer missed its window, the team treats it as a infrastructure incident, not a “security team forgot” moment.

Sharp edge: Timer units can be inadvertently disabled during package upgrades or when a system‑wide systemctl enable --now command is run by a new team member unfamiliar with the unit. The vendor preset: enabled line in the status output can flip to disabled without a clear error in the journal, and the next scheduled trigger never fires. Engineers who have lived through a missed quarterly audit now add a cron‑style health check in their personal dashboards: systemctl is-enabled devsecops-audit.timer && echo "enabled" || echo "disabled" and a monthly “timer audit” ticket that verifies the unit file hash matches the repo HEAD. The most dangerous failure mode is silent drift: the timer remains enabled but the underlying script path changes because a repo restructure moved the executable, and systemctl reports Active: inactive (dead) without a obvious message. The runbook now requires systemctl cat devsecops-audit.timer as part of every quarterly review, ensuring the unit definition and the script path stay in sync.

This page was rewritten on 12 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.