DevSecOps, Governance & Platform Operations
Lesson opener
In one line: Embed security, governance, and accountability into the engineering platform itself so that the safe path and the fast path are the same path for every team.
Why it matters: Security bolted on at the end is expensive to retrofit and easy to skip under deadline pressure. Governance that lives in a spreadsheet reviewed once a year does not govern anything. Platform operations that depend on heroic individuals do not scale. When policy is code, audit is automatic, and the developer portal makes the right way the easy way, compliance becomes a property of the system rather than a monthly checkbox.
Before this lesson: Source Control & Collaboration through Reliability Engineering & Incident Management.
Cross-domain references: Cybersecurity Foundations, Network & Cloud Security, Cloud Security for Data & AI, Security Architecture & Governance, Security Architecture & Governance (SAD), Architecture Communication & Decision Making, LLMOps: Governance, Operations & Incident Response, Cloud Data & AI Engineering Capstone.
What you will be able to do
- Describe the DevSecOps shift-left model and name the specific controls added at each pipeline stage.
- Apply the principle of least privilege to IAM roles, service accounts, and secrets access.
- Explain how a secrets management system works and why environment variables and source code are not acceptable secret stores.
- Describe software supply chain risk and name the key mitigations (SBOM, signing, dependency pinning).
- Explain what policy as code is, name an implementation (OPA/Gatekeeper), and describe what it enforces in a Kubernetes cluster.
- Design an audit logging strategy that supports forensic investigation without containing personal data.
- Distinguish change governance from change control and describe how each applies to a continuous-delivery pipeline.
- Explain the concept of an internal developer platform (IDP), describe a service catalogue, and name three DX metrics that indicate platform health.
- Describe FinOps awareness at the platform level and name two platform KPIs.
Deliverable: a DevSecOps controls matrix and platform operations plan for Northline: a control per pipeline stage, an IAM model, a secrets strategy, a policy-as-code policy set, an audit log design, a change governance decision matrix, a service catalogue template, three DX metrics, two FinOps guardrails, and four platform KPIs.
Prerequisites
| Prerequisite | Why it matters here |
|---|---|
| Security in the Pipeline | SAST, DAST, and SCA scanning are the shift-left controls this lesson extends to governance. |
| CI/CD Pipelines | Policy-as-code checks and security gates run as pipeline stages. |
| Kubernetes & Managed Runtimes | Admission controllers and Gatekeeper enforce policy inside the cluster. |
| Infrastructure as Code | IaC is the mechanism for least-privilege IAM, network policy, and reproducible environments. |
| Observability: Metrics, Logs, Traces & Alerts | Audit logs feed the observability platform; security events feed alerting. |
| Reliability Engineering & Incident Management | Security incidents follow the same command model; CAPAs close the security feedback loop. |
| Cybersecurity Foundations | Foundational threat model, CIA triad, and authentication concepts. |
| Security Architecture & Governance | Enterprise security policies and governance frameworks. |
| LLMOps: Governance, Operations & Incident Response | Governance patterns for AI-assisted platforms that the IDP may host. |
Plain English
DevSecOps and the shift-left model
DevSecOps integrates security practices into the software development lifecycle at every stage, rather than treating security as a gate at the end of the pipeline or a separate team's responsibility. "Shift left" means moving security checks earlier (to the left on the timeline), where they are cheaper and faster to fix.
The shift-left maturity progression:
| Stage | Security control | Tool examples |
|---|---|---|
| IDE / pre-commit | Secret scanning (no credentials in commits), basic linting for known insecure patterns | GitLeaks, Detect-Secrets, IDE plugins |
| Pull request | SAST (static analysis), dependency vulnerability scan (SCA) | Semgrep, Snyk, Dependabot, Trivy |
| CI build | Container image scan, licence compliance check, SBOM generation | Trivy, Grype, Syft |
| Pre-deploy (staging) | DAST (dynamic scan against running service), infrastructure policy check | OWASP ZAP, Checkov, Terraform Sentinel |
| Cluster admission | Policy-as-code enforcement (no privileged pods, image from allowed registry only) | OPA Gatekeeper, Kyverno |
| Runtime | Anomaly detection, audit log ingestion, vulnerability feed for running images | Falco, AWS GuardDuty, Wiz |
| PIR / governance | Security findings reviewed in PIR; CAPA created for each finding above threshold | Jira RELIABILITY project |
Security controls at each stage catch defects at the lowest possible cost. A secret found by a pre-commit hook costs seconds to fix; the same secret found after a production deployment costs a credential rotation, a security incident, a PIR, and potentially a breach notification.
No security control found in the pipeline removes the developer's responsibility to write secure code. Automation finds what it is programmed to find. Novel vulnerabilities, logic flaws, and authorisation gaps require human review.
IAM and least privilege
Identity and Access Management (IAM) governs who (or what) can do what to which resource. The principle of least privilege states that every actor—human, service account, CI runner, pipeline job—receives only the permissions required for its stated purpose, for the minimum time required, and no more.
Common violations:
- Service accounts with
*permissions on all resources in a cloud account. - CI runners with production write access to avoid managing separate credentials.
- Developers with direct database write access to production "for emergencies".
- Shared credentials stored in a
.envfile committed to the repository.
Least-privilege implementation:
- Separate IAM roles per environment. The CI runner for the development environment has no access to production resources. The production deploy role can deploy to production but cannot read development secrets.
- Short-lived credentials. Use workload identity federation (GitHub OIDC to AWS, GCP, or Azure) so that CI jobs receive time-limited tokens that expire after the job ends, rather than long-lived static credentials stored as secrets.
- Service account scoping. Each microservice runs with a Kubernetes service account that has only the permissions it needs: read from one S3 bucket, publish to one SNS topic, write to one database.
- Break-glass access. Emergency production access requires a separate approval step, generates an audit log entry, is time-limited (4 hours), and triggers a notification to the security team. It is never the default.
- Regular access review. IAM permissions are reviewed quarterly. Accounts and roles unused for 90 days are suspended and reviewed before reactivation.
Disabling authentication or access controls for performance reasons is never acceptable. A slow IAM check means the IAM check needs to be optimised, not removed.
Secrets management
A secret is any value that grants access: an API key, a database password, an OAuth client secret, a TLS private key, a signing key. Secrets must never appear in:
- Source code or configuration files committed to a repository (even a private one).
- Environment variables passed directly from CI configuration (they appear in pipeline logs).
- Container image layers.
- Log lines.
- Artefact metadata or build manifests.
A secrets manager (HashiCorp Vault, AWS Secrets Manager, Azure Key Vault, GCP Secret Manager) provides:
- Encrypted at-rest storage with access-policy enforcement.
- Dynamic secrets: the manager generates a short-lived database credential for each application startup, rather than a static password shared across all instances.
- Automatic rotation on a defined schedule, or on-demand rotation after a potential compromise.
- Audit log of every read, write, and rotation event with the caller identity.
Secrets injection pattern in Kubernetes:
- The pod's service account has an IAM policy that allows
secretsmanager:GetSecretValuefor its specific secrets only. - An init container or sidecar (Vault Agent, External Secrets Operator) reads the secret at pod startup and writes it to an in-memory tmpfs volume.
- The application reads from the tmpfs file, never from an environment variable.
- The tmpfs volume is not logged and not accessible from outside the container.
If a secret is committed to a repository, treat it as compromised immediately: rotate it before removing it from the history. Removing from git history does not un-expose it if it was ever pushed to a remote.
Software supply chain security
A software supply chain is the set of components, dependencies, build tools, and pipelines that produce a deployable artefact. Attacks on the supply chain compromise a dependency or build tool rather than the target system directly (SolarWinds, Log4Shell, XZ Utils are supply-chain incidents).
Key mitigations:
Dependency pinning. Pin every dependency to an exact version or a content hash (npm ci, pip install -r requirements.txt with a lock file, Go module checksums). Floating versions (^1.2.0) mean a dependency update during a build can introduce a vulnerability without any change to your code.
Dependency vulnerability scanning (SCA). Run a software composition analysis tool against the dependency manifest on every pull request and nightly against the production container. Alert on CVSS ≥ 7 (high/critical). Track the mean time to remediate by severity.
SBOM (Software Bill of Materials). A machine-readable inventory of every component in a deployed artefact—direct dependencies, transitive dependencies, OS packages, licences. Generate an SBOM in SPDX or CycloneDX format as part of the CI build and attach it to the artefact in the registry. An SBOM enables rapid assessment of blast radius when a new vulnerability is announced.
Image signing. Sign container images with Sigstore/Cosign after scanning passes. The cluster's admission policy allows only images signed by the CI pipeline's signing key. This prevents unsigned or externally sourced images from running in production.
Trusted base images. Use a small, minimal base image (distroless, scratch, or a hardened base from an approved internal registry). Update base images on a weekly schedule; critical patches within 24–48 hours. Rebuild and redeploy all services when a base image is patched.
Vulnerability management and patching
A vulnerability management programme for a platform team:
- Inventory: know every running image and its SBOM (from the registry; see Artefact 8 in the capstone).
- Feed: subscribe to CVE feeds (NVD, vendor advisories, Snyk intelligence) and correlate against the SBOM inventory.
- Triage: assess exploitability in context (is the vulnerable code path reachable? is the service internet-facing?). CVSS alone is not enough; use EPSS or SSVC to prioritise.
- Remediate: upgrade the dependency or base image, rebuild, scan again, deploy. Target: critical CVEs within 24 hours of confirmed exploitability; high within 7 days; medium within 30 days.
- Verify: confirm that the scan now shows the vulnerability as resolved in the production environment.
- Report: platform KPI: "% of critical/high CVEs resolved within SLA". Review monthly.
Patching is not a one-time event. It is a repeating operational process that must be allocated engineering time in every sprint.
Policy as code
Policy as code expresses governance rules as machine-executable policies that are version-controlled, reviewed, and automatically enforced—not as a PDF in a shared drive reviewed annually. The policies run at multiple points: in the CI pipeline (before deployment) and in the cluster (at admission time, before a workload starts).
OPA (Open Policy Agent) is a general-purpose policy engine that evaluates Rego policies against any JSON/YAML input. Gatekeeper is the Kubernetes admission controller that integrates OPA into the cluster.
Example policies (Northline platform):
| Policy | Enforcement point | Effect if violated |
|---|---|---|
No container runs as root (runAsNonRoot: true) | Cluster admission (Gatekeeper) | Pod rejected; error returned to deployer |
No images from outside the approved registry (*.dkr.ecr.eu-west-1.amazonaws.com) | Cluster admission | Pod rejected |
No privileged containers (privileged: false) | Cluster admission | Pod rejected |
| Memory and CPU limits must be set | Cluster admission | Pod rejected |
No latest tag in production manifests | CI pipeline (OPA check on manifests) | Pipeline fails; PR blocked |
Terraform resources must have owner and team tags | CI pipeline (Checkov) | Pipeline fails |
| Secrets must not appear in CI logs | Pre-commit hook + CI log scanner | Commit rejected; build fails |
Policy violations fail the pipeline, not the deployment. The deployer receives an actionable error message with a link to the policy documentation and a fix example. Policies are version-controlled in the platform repository; changes require a review from the platform security team.
Never add a policy exemption without a documented, time-limited exception record. Exceptions are tracked in the security register and reviewed monthly.
Audit logging
Audit logs record who did what to which resource and when. They are distinct from application logs (which record what the application did) and differ in their audience (security and compliance, not operations) and their retention requirement (longer, immutable).
An audit log entry must contain:
timestamp(UTC, nanosecond resolution)actor(human identity or service account, never anonymous)action(create, read, update, delete, approve, reject)resource(type and identifier)result(success, failure, partial)source_ipanduser_agent(for human actions)request_id(for cross-system correlation)change_diff(for mutation events: before and after, excluding secret values)
Audit logs must be:
- Immutable: written to an append-only store; no service can delete them.
- Centralised: aggregated in one platform, not scattered across team-owned systems.
- Retention-compliant: retained for the period required by policy and applicable regulation (commonly 1 year or longer for security-relevant events).
- Privacy-aware: must not contain secret values, full credentials, or personal data beyond what is necessary for accountability (for example, a user ID is sufficient; full PII is not needed).
- Alertable: anomaly detection rules run against audit logs (failed logins, privilege escalation attempts, unusual access patterns at unusual hours).
Disabling audit logging for performance or storage reasons is never acceptable. Audit logging is a security and accountability control; its absence is a control failure.
Change governance
Change governance is the set of rules and processes that manage how changes to a system are authorised, reviewed, implemented, and verified. It is not the same as change control, which is the administrative workflow (ticket, approval, CAB meeting). In a DevOps context, change governance is engineered into the pipeline:
| Change type | Governance mechanism |
|---|---|
| Code change | Pull request + required reviewer approval + passing CI (including security gates) |
| Infrastructure change | Terraform plan reviewed in PR + atlantis apply with required approval |
| Configuration/secret change | Changes in the secrets manager require approval from a named role; automated rotation does not require approval |
| Policy change | PR to the policy repository; requires platform security team approval |
| Emergency change | Break-glass deploy with a post-hoc PIR required within 2 working days |
Governance must have a defined owner. The platform team owns the platform's governance rules. Each product team owns the governance of their own service. "Everyone is responsible" is equivalent to "no one is responsible."
CAB (Change Advisory Board) has a limited role in a continuous-delivery organisation. High-frequency, low-risk changes (a feature behind a feature flag, a container image version bump with passing tests and scan) should not require CAB approval; the pipeline and the automated gates are the control. High-risk changes (database schema migration with no rollback path, new external network egress, key rotation) warrant human review.
Platform ownership and the internal developer platform
An Internal Developer Platform (IDP) is the curated set of tools, templates, pipelines, and self-service capabilities that the platform team provides so that product teams can build, test, deploy, and operate their services without reinventing infrastructure or bypassing governance.
The IDP is a product, not a collection of scripts. It has:
- Customers (product engineering teams).
- A product manager (or platform lead who acts as one).
- A roadmap and prioritisation based on adoption and DX metrics.
- Documentation and support.
- A deprecation policy for old templates and pipelines.
The platform team's job is to make the compliant path the easy path. If teams are bypassing the platform (running their own pipelines, managing their own secrets, deploying from laptops), the platform has failed to meet their needs—not the teams.
Service catalogue. A service catalogue (implemented in Backstage, OpsLevel, or a bespoke tool) is the single place where every service is registered with its owner, tier, SLO, on-call rotation, repository, runbook, and dependency map. It is the answer to "who owns this?" at 3 a.m. during an incident.
A service catalogue entry contains:
- Service identifier and display name.
- Owning team and business owner.
- Tier (Tier 1 = revenue-critical; Tier 2 = important; Tier 3 = internal tooling).
- SLO target and current SLO compliance.
- On-call rotation and escalation path.
- Repository link, CI/CD pipeline link, deployment dashboard link.
- Runbook link and PIR log link.
- Dependency list (upstream and downstream).
- Last production deployment date and artefact version.
Developer experience (DX) metrics
DX metrics measure whether the platform is actually useful:
| Metric | What it measures | Target (Northline) |
|---|---|---|
| DORA: deployment frequency | How often teams deploy to production | Daily for Tier 2; multiple per day for Tier 1 |
| DORA: change lead time | Time from commit merged to production | < 1 hour for Tier 1 and Tier 2 |
| DORA: change failure rate | % of deployments causing a degradation or rollback | < 5 % |
| DORA: time to restore | Mean time to restore after an incident | < 1 hour for Tier 1 |
| Platform NPS | Developer survey: "How likely are you to recommend the platform to a colleague?" | ≥ 60 |
| Self-service adoption | % of onboarding actions completed via self-service (no platform-team ticket) | ≥ 80 % |
| Policy violation rate | Policy violations per 100 deployments | Trend towards zero |
DORA metrics (from the DORA State of DevOps research) are industry-standard leading indicators of software delivery performance and organisational capability. They are not targets to game; they are signals to diagnose.
FinOps awareness
FinOps is the practice of bringing financial accountability to cloud spending. For a platform team:
- Chargeback / showback: tag every cloud resource with
team,service, andenvironment. Use a cost allocation tool (AWS Cost Explorer, Kubecost, Infracost) to show each team what its services cost per month. Showback makes cost visible; chargeback assigns it. Even showback changes behaviour. - Rightsizing guardrails: enforce CPU and memory request/limit ratios in the admission policy (Kyverno or Gatekeeper) so that services cannot claim vastly more resources than they use. Alert when a service's average CPU utilisation is below 20 % of its request.
- Idle resource cleanup: automated job identifies and flags persistent volumes, load balancers, and static IPs in non-production environments that have been unused for more than 7 days. Teams receive a notification; resources are deleted after 14 days without action.
- Reserved instance and savings plan coverage: the platform team, not individual product teams, manages commitment purchasing. Central management prevents commitment overlap and ensures the discount applies to baseline capacity.
- Cost gate in CI: Infracost or a similar tool runs against Terraform plans in the CI pipeline and adds a cost estimate to the PR. Changes that increase monthly cost by > £5,000 require an additional approval step.
Platform KPIs
Four KPIs the platform team reports to engineering leadership monthly:
| KPI | Description | Target |
|---|---|---|
| Platform adoption rate | % of Tier 1/2 services using the standard IDP pipeline | 100 % |
| Mean time to onboard | Time from team request to first production deployment via the platform | < 2 business days |
| Critical/high CVE resolution SLA | % of critical and high CVEs resolved within policy (24 h critical, 7 d high) | ≥ 95 % |
| Policy compliance rate | % of production deployments that passed all automated policy gates without exemptions | ≥ 98 % |
KPIs are reviewed in a monthly platform operations review attended by the platform team lead and engineering managers. Trends matter more than point values.
Teacher walkthrough
Build the DevSecOps controls matrix and platform operations plan for Northline step by step.
- Map the pipeline stages to controls. For each stage (IDE, PR, CI build, pre-deploy, cluster admission, runtime, PIR), list the security control, the tool, and the failing criterion. The matrix becomes the platform team's configuration checklist and the auditor's evidence source.
- Define the IAM model. Draw a boundary diagram: developer laptops → GitHub Enterprise → GitHub Actions runner → AWS ECR (push) → EKS deploy role (production) → RDS (read-only for app). Each arrow is an IAM boundary with least-privilege credentials. Use OIDC federation for GitHub Actions; no long-lived static keys in CI.
- Configure the secrets manager. Deploy HashiCorp Vault (or AWS Secrets Manager) with one path per environment per service. Each service account has a policy that allows read on its own path only. Document the injection pattern (External Secrets Operator writing to a tmpfs-backed Kubernetes Secret). Add the secret-leak scanner to the pre-commit hook.
- Generate SBOMs. Add a Syft step to the CI pipeline that generates an SPDX-format SBOM and attaches it to the ECR image as an OCI artifact. Add a Grype step that scans the SBOM against the CVE database and fails the build on CVSS ≥ 9 (critical). Add a Cosign step that signs the image after a successful scan. Add the Gatekeeper admission policy that requires a valid Cosign signature from the CI signing key.
- Write the OPA/Gatekeeper policy set. Start with five policies (no root, no privileged, approved registry only, resource limits required, no
latesttag). Version-control them inplatform/policy/. Require the platform security team as a required reviewer on all changes to that directory. Document each policy with a rationale and a fix example.
- Design the audit log schema. Define the eight fields above. Configure CloudTrail (AWS API calls), Kubernetes audit log (API server), and application audit events (payment and authentication events) to flow to a centralised log platform (OpenSearch or Splunk) with a 1-year retention policy and delete protection. Add two alert rules: > 5 failed login attempts for one identity within 10 minutes; any access to a production secret from an IP not in the office or VPN range.
- Define the change governance matrix. Four change types (code, infrastructure, config/secret, policy) with their governance mechanisms. Identify the two high-risk change types that warrant a human review step outside the automated pipeline (database schema migration, new egress rule). Document the emergency change path and the post-hoc PIR requirement.
- Build the service catalogue. Register all 15 engineering teams' Tier 1 and Tier 2 services in Backstage. The platform team provides the Backstage template; each team owns their service's entry. The catalogue is the source of truth for on-call ownership during incidents. Link it from the incident-response runbook.
- Instrument DX metrics. Add deployment-frequency and lead-time tracking via the deployment pipeline (each production deployment emits an event). Run a developer NPS survey quarterly. Track self-service adoption by measuring the ratio of platform-ticket-required onboardings to self-service onboardings. Report monthly to engineering leadership.
- Implement FinOps guardrails. Enable Kubecost in the cluster; share per-team cost dashboards with team leads. Add the Infracost comment bot to Terraform PRs. Write the idle-resource cleanup Lambda (runs nightly; notifications to
#platform-costSlack channel). Enforce CPU/memory limit ratio policy in Gatekeeper.
Worked example
The script below simulates three DevSecOps governance controls: a policy checker for Kubernetes manifest fields, a secret hygiene scanner for environment variables, and a platform KPI reporter. All values are synthetic and deterministic.
# devops11_devsecops.py
# DevSecOps governance primitives for the Northline IDP.
# All data is illustrative.
# --- 1. Kubernetes manifest policy checker ---
POLICIES = [
{
"id": "POL-001",
"name": "No root containers",
"check": lambda c: c.get("securityContext", {}).get("runAsNonRoot") is True,
"fix": "Set spec.containers[].securityContext.runAsNonRoot: true",
},
{
"id": "POL-002",
"name": "No privileged containers",
"check": lambda c: not c.get("securityContext", {}).get("privileged", False),
"fix": "Remove or set spec.containers[].securityContext.privileged: false",
},
{
"id": "POL-003",
"name": "Resource limits set",
"check": lambda c: "limits" in c.get("resources", {}),
"fix": "Add spec.containers[].resources.limits.cpu and .memory",
},
{
"id": "POL-004",
"name": "No 'latest' image tag",
"check": lambda c: not c.get("image", "").endswith(":latest"),
"fix": "Pin the image to a digest or a specific version tag",
},
{
"id": "POL-005",
"name": "Approved registry only",
"check": lambda c: c.get("image", "").startswith(
"123456789.dkr.ecr.eu-west-1.amazonaws.com/"
),
"fix": "Use only images from the approved ECR registry",
},
]
def check_manifest(container_spec):
violations = []
for pol in POLICIES:
if not pol["check"](container_spec):
violations.append((pol["id"], pol["name"], pol["fix"]))
return violations
# --- 2. Secret hygiene scanner ---
import re
# Value-based patterns (look inside the value string)
SECRET_VALUE_PATTERNS = [
("40-char random string (possible AWS key)", re.compile(r"[A-Za-z0-9/+=]{40}")),
("Inline assignment (key=value in value string)", re.compile(r"(?i)(api[_-]?key|apikey|password|passwd|pwd)\s*=\s*\S+")),
]
# Key-name patterns: a non-empty value under a sensitive-named key is a finding
SECRET_KEY_PATTERNS = re.compile(
r"(?i)(password|passwd|pwd|secret|api[_-]?key|apikey|token|credential|auth_key)"
)
SAFE_PLACEHOLDER_VALUES = {"", "***", "REDACTED", "none", "null", "placeholder"}
def scan_env_vars(env_dict):
"""
Scan environment variables for secret-like content.
Checks both the key name (sensitive naming convention) and the value
(pattern match for embedded secrets).
"""
findings = []
for key, value in env_dict.items():
val_str = str(value).strip()
# 1. Key name reveals this is a secret
if SECRET_KEY_PATTERNS.search(key) and val_str.lower() not in SAFE_PLACEHOLDER_VALUES:
findings.append((key, "sensitive key name — store in secrets manager, not env var"))
continue
# 2. Value contains an embedded secret pattern
for pattern_name, pattern in SECRET_VALUE_PATTERNS:
if pattern.search(val_str):
findings.append((key, pattern_name))
break
return findings
# --- 3. Platform KPI reporter ---
PLATFORM_KPIS = [
{
"name": "Platform adoption rate",
"target": 1.00,
"actual": 0.87,
"unit": "%",
"format": lambda v: f"{v:.0%}",
},
{
"name": "Mean time to onboard (days)",
"target": 2.0,
"actual": 1.6,
"unit": "days",
"format": lambda v: f"{v:.1f}",
"lower_is_better": True,
},
{
"name": "Critical/high CVE resolution SLA",
"target": 0.95,
"actual": 0.92,
"unit": "%",
"format": lambda v: f"{v:.0%}",
},
{
"name": "Policy compliance rate",
"target": 0.98,
"actual": 0.994,
"unit": "%",
"format": lambda v: f"{v:.1%}",
},
]
def report_kpis(kpis):
for kpi in kpis:
lower = kpi.get("lower_is_better", False)
on_target = (kpi["actual"] <= kpi["target"]) if lower else (kpi["actual"] >= kpi["target"])
status = "PASS" if on_target else "MISS"
print(f" [{status}] {kpi['name']}: {kpi['format'](kpi['actual'])} (target: {kpi['format'](kpi['target'])})")
# --- Run ---
# Synthetic container spec: two violations
container = {
"image": "nginx:latest", # violates POL-004 and POL-005
"securityContext": {
"runAsNonRoot": True, # POL-001 passes
"privileged": False, # POL-002 passes
},
"resources": {
"requests": {"cpu": "100m", "memory": "128Mi"},
# no limits — violates POL-003
},
}
print("=== Policy check: order-processing container ===")
violations = check_manifest(container)
if violations:
for v_id, v_name, v_fix in violations:
print(f" VIOLATION [{v_id}] {v_name}")
print(f" Fix: {v_fix}")
else:
print(" All policies pass.")
print()
# Synthetic env vars: one secret leak
env = {
"LOG_LEVEL": "info",
"DB_HOST": "postgres.internal.northline.com",
"DB_PASSWORD": "hunter2", # secret leak
"API_KEY": "mySecretToken", # secret leak
"PORT": "8080",
}
print("=== Secret hygiene scan: environment variables ===")
findings = scan_env_vars(env)
if findings:
for key, pattern in findings:
print(f" FINDING: {key!r} matches pattern '{pattern}' — move to secrets manager")
else:
print(" No secrets detected.")
print()
print("=== Platform KPIs — October 2026 ===")
report_kpis(PLATFORM_KPIS)Expected output (deterministic with synthetic data):
=== Policy check: order-processing container ===
VIOLATION [POL-003] Resource limits set
Fix: Add spec.containers[].resources.limits.cpu and .memory
VIOLATION [POL-004] No 'latest' image tag
Fix: Pin the image to a digest or a specific version tag
VIOLATION [POL-005] Approved registry only
Fix: Use only images from the approved ECR registry
=== Secret hygiene scan: environment variables ===
FINDING: 'DB_PASSWORD' matches pattern 'sensitive key name — store in secrets manager, not env var'
FINDING: 'API_KEY' matches pattern 'sensitive key name — store in secrets manager, not env var'
=== Platform KPIs — October 2026 ===
[MISS] Platform adoption rate: 87% (target: 100%)
[PASS] Mean time to onboard (days): 1.6 (target: 2.0)
[MISS] Critical/high CVE resolution SLA: 92% (target: 95%)
[PASS] Policy compliance rate: 99.4% (target: 98%)Check your understanding
- A developer argues that running the CI runner with an admin-level IAM role is "simpler because it never gets permission errors." What is wrong with this approach, and what should the IAM model look like instead?
- A team stores their database password in an environment variable set in the CI pipeline's secret settings. Why is this not a secure secrets management approach, and what should replace it?
- A Gatekeeper policy blocks a pod because the container image is tagged
:latest. The developer argues the policy is slowing them down and asks for an exemption. What is the correct response from the platform team? - The audit log for a payment-processing service contains entries with the field
"card_number": "4111111111111111". Name two problems with this, and describe what the audit log entry should contain instead. - A team runs their own custom CI pipeline because "the platform pipeline doesn't support their framework." What does this tell the platform team, and what should happen next?
- A FinOps review shows that a non-production EKS cluster is costing £12,000/month but is used only during business hours. Name two actionable changes the platform team could make to reduce this cost.
Summary
| Concept | One-line definition |
|---|---|
| Shift left | Moving security checks earlier in the pipeline where defects are cheaper to fix. |
| Least privilege | Every actor has only the permissions it needs, for the minimum time, and no more. |
| Secrets management | Centralised, encrypted, audited, and rotated storage for credentials; never in source code or environment variables. |
| SBOM | Machine-readable inventory of every component in an artefact; enables rapid blast-radius assessment. |
| Image signing | Cryptographic proof that an image was produced by the authorised CI pipeline; enforced at cluster admission. |
| Policy as code | Governance rules expressed as version-controlled, machine-executable policies enforced in the pipeline and the cluster. |
| Audit log | Immutable, centralised record of who did what to which resource and when; never disabled for performance. |
| Change governance | Policies that govern how changes are authorised, implemented, and verified; engineered into the pipeline. |
| IDP | Internal Developer Platform: curated tools and self-service capabilities that make the compliant path the easy path. |
| Service catalogue | Single register of every service with its owner, tier, SLO, on-call, runbook, and dependency map. |
| DX metrics | DORA metrics and developer NPS; leading indicators of platform health and adoption. |
| FinOps | Financial accountability for cloud spend; chargeback, rightsizing, and cost-gate policies. |
| Platform KPIs | Adoption rate, onboarding time, CVE resolution SLA, and policy compliance rate. |
The chain is complete: source control → CI → testing → security gates → artifact registry → containers → orchestration → IaC → deployment → observability → incident response → governance. The Capstone: Enterprise DevOps Internal Developer Platform assembles all twenty-eight artefacts into one reviewable design pack for the Northline IDP scenario.