Based on the DOP-C02 exam guideReport an error
The direct cause of the 2019 Capital One breach that leaked 106 million customers' data was an SSRF vulnerability in a WAF, but the real reason it grew into an incident that large is that nowhere in the build pipeline was there an automated security gate that could catch SSRF. One line of SAST, one code review step, one IMDS hop-limit check wired into the PR stage would have stopped the incident before it happened. DevSecOps' "Shift Left" is the work of moving those gates from operations (right) to PR/IDE (left).
Today we map those gates onto AWS tooling: the three CodeGuru services, the chain of trust built with AWS Signer, Inspector's automatic CVE scanning, and how all of it weaves together with industry standards like SLSA, SBOM, and OCI into a single pipeline. The exam does not ask for tool names — it asks "at which stage of this scenario should which verification go in?"
| Service | Timing | Analysis Target | Output | Can Block |
|---|---|---|---|---|
| CodeGuru Reviewer | On PR/code change | Java, Python source (static) | PR comments (performance, security, best practices) | ❌ (comments only) |
| CodeGuru Security | On PR/Build | Multi-language security patterns | Findings (CWE/CVSS mapped) | ❌ (needs an external gate) |
| CodeGuru Profiler | Runtime | Java/Python/Node processes | Flame graphs, cost optimization advice | ❌ (observability) |
💡 Reviewer and Security have been increasingly consolidated since 2024. Security is evolving faster on a Bedrock LLM foundation. CodeGuru Reviewer's Java/Python analysis is scheduled to end in June 2025 → CodeGuru Security and Amazon Q Developer are the successors.
How to connect repositories:
🔍 Deep Dive: CodeGuru Reviewer's analysis engine works in two stages. ① Program analysis: AST (Abstract Syntax Tree) based data-flow analysis. For example, it traces SQL injection patterns (
request.getParameter()→Statement.executeQuery()) with taint propagation. ② ML augmentation: a model trained on billions of lines of Amazon's internal codebase pattern-matches "this shape of code usually leads to an incident." That is why false positives are lower than with plain grep. But it is still LLM-based and therefore not 100% — on the exam, an option claiming "CodeGuru catches every security problem" is always a trap.
💡 Related Theory: The precision-recall trade-off of SAST tools. When there are too many false positives (bogus alerts), developers start ignoring them (alert fatigue) and real findings get buried too. SonarQube, Checkmarx, Snyk Code, and CodeGuru Security all pick their own position on that trade-off. Data from the OWASP Benchmark Project (an annual SAST tool evaluation) comparing each tool's Youden Index (TPR - FPR) leads to one conclusion: there is no perfect tool.
A managed code signing service. AWS manages the KMS-backed signing keys and the customer only creates a Signing Profile.
| Use Case | Signing Target | Verification Point | Profile platform_id |
|---|---|---|---|
| Lambda | Lambda function code zip | At Lambda deployment | AWSLambda-SHA384-ECDSA |
| Containers (Notary v2) | OCI container images | EKS Admission / ECS task launch | Notation-OCI-SHA384-ECDSA |
| IoT | IoT device OTA firmware | Device boot | AmazonFreeRTOS-* |
| SAM/Generic | Arbitrary binaries | User-defined verification | AWSIoTDeviceManagement-SHA256-ECDSA |
Signing Profile: a bundle of signing key and policy. When the profile version changes, a new ARN is issued (/profile/v123).
aws signer put-signing-profile \
--profile-name LambdaProdSigner \
--platform-id AWSLambda-SHA384-ECDSA \
--signature-validity-period value=12,type=MONTHS \
--tags Env=Production,Team=SRELambda Code Signing Config:
UntrustedArtifactOnDeployment: Warn or EnforceEnforce: code that is unsigned or signed by an untrusted profile is rejected at deployment (CodeSigningConfigNotFoundException)Warn: only records a warning in CloudWatch Logs; the deployment proceeds⚠️ Trap: It is a common incident to switch
Warnmode on "for testing" and leave it that way in prod. The Capital One post-mortem shows the same recurring pattern: "the security tooling existed, but it was not in blocking mode." On the exam, if "enforce signature verification" is the keyword, the answer is always Enforce.
🔍 Deep Dive: AWS Signer's verification stage checks two things. ① Signature validity: can the signature be verified with the profile's public key? ② Profile trust: is this profile in the
allowed-publisherslist? Both conditions must pass. Profile version is checked as well, so after key rotation you must add the new profile version ARN toallowed-publishers(the previous version coexists until it expires).
Inspector v2 automatically scans three resource types.
| Resource | Trigger | Analysis Target |
|---|---|---|
| EC2 instances | Inventory changes via SSM Agent | OS packages + language libraries (Java, Python, .NET, etc.) |
| Container images (ECR) | Automatically on ECR push + rescan every 24h | OS layer + language dependencies |
| Lambda functions | On function update (Code & Layer) | Code + dependencies |
Core mechanisms:
Standard vs Enhanced (ECR):
🔍 Deep Dive: The reason ECR Enhanced Scanning does a "24h rescan" is that CVEs are newly discovered even when the code never changes. An image built once may have been clean yesterday, but if a new CVE like Log4j is disclosed at dawn today, the same image suddenly becomes vulnerable. Inspector rematches the CVE database against image manifests every day to surface "now-known vulnerabilities." This is the heart of security for containers already running in prod — scanning at build time alone is not enough.
💡 Related Theory: The biggest lesson from Log4Shell (CVE-2021-44228, CVSS 10.0), disclosed on December 9, 2021, is that "you must track the dependencies of workloads already running in prod in real time." AWS added Lambda function code scanning to Inspector the very next month, in January 2022, and that is no coincidence. SBOM being effectively mandated by the US executive order EO 14028 (2021) belongs to the same current.
Pre-commit (developer local)
├─ pre-commit hook (git-secrets, lint)
├─ IDE integration: CodeWhisperer + Amazon Q Developer security review
└─ block AWS key leaks with git-secrets
Pull Request
├─ CodeGuru Reviewer/Security (automatic comments)
├─ SAST: Snyk Code, Checkmarx, SonarQube
├─ SCA: npm audit, pip-audit, Snyk Open Source
├─ Secret scan: GitHub Secret Scanning + Push Protection
├─ Branch Protection: Required Status Check
└─ Approval Rule Template (CodeCommit) / Required Reviewers (GitHub)
Build (CodeBuild)
├─ Inspector (image scan on ECR push)
├─ Trivy / Grype (container OSS scanning, IaC scanning)
├─ SBOM generation (Syft → CycloneDX / SPDX)
├─ SLSA provenance generation (in-toto attestation)
└─ signing with AWS Signer (Lambda zip or OCI image)
Deploy (CodeDeploy / EKS Admission)
├─ Signer verification
├─ Admission Controller (ECS/EKS): Kyverno, Gatekeeper, ratify
├─ Policy as Code (OPA)
└─ Pre-deploy hook (smoke test)
Runtime
├─ GuardDuty (runtime threats + Malware Protection)
├─ CodeGuru Profiler
├─ Macie (S3 PII detection)
├─ Security Hub (aggregation + automatic remediation)
└─ AWS Config (drift detection)
SLSA (Supply-chain Levels for Software Artifacts) is a four-level model Google created after the 2021 SolarWinds incident.
| Level | Requirements | AWS Mapping |
|---|---|---|
| L1 | Documented build process, provenance generation | CodeBuild + buildspec checked in |
| L2 | Version control + hosted build service + signed provenance | CodeCommit/GitHub + CodeBuild + Signer |
| L3 | Source/build platform isolation, isolated build, non-falsifiable provenance | VPC CodeBuild + isolated IAM Role + in-toto attestation |
| L4 | 2-person review + hermetic/reproducible build | + Approval Rule Template + guaranteed build determinism |
📚 Case Study: The December 2020 SolarWinds Orion incident was a case where the build system itself was penetrated and the SUNBURST backdoor injected into otherwise legitimate code. 18,000 organizations were affected, among them the US Treasury, the Department of Homeland Security, Microsoft, and FireEye. The post-mortem found: ① permissions granting direct access to the build server were far too broad ② there was no provenance, so a legitimate build could not be distinguished from a compromised one ③ signatures existed, but the signing key itself sat on the build server and was stolen along with everything else. SLSA L3 is precisely the standard for blocking those three things.
🔍 Deep Dive: SLSA L3's "non-falsifiable provenance" means signing the provenance with a signing key outside the build service. On AWS, the pattern is that after CodeBuild finishes, a separate Lambda creates an in-toto attestation signed with KMS and pushes it as a separate layer of the ECR OCI artifact. AWS Signer for Containers (Notation-based) standardizes this. Compared with cosign/Sigstore's keyless mode, AWS is KMS-backed so key rotation and access control are clearer, but it lacks the simplicity of OIDC keyless where "there is no key at all."
[ 4 layers of secret-leak defense ]
Layer 1: IDE/Local
git-secrets (pre-commit hook)
IDE plugin (CodeWhisperer security review)
↓
Layer 2: Push
GitHub Secret Scanning + Push Protection
(rejects the push itself)
↓
Layer 3: Repository
GitHub Advanced Security
TruffleHog / GitGuardian webhook
↓
Layer 4: Build/Runtime
Secrets Manager automatic rotation
CodeBuild env.secrets-manager integration
never keep a .env file in the repository
AKIA[A-Z0-9]{16}), pre-commit hookenv.secrets-manager: reference a secrets-manager ARN directly from buildspecDeveloper → CodeBuild build → upload zip to S3
|
v
aws signer start-signing-job
(source S3 → destination S3)
|
v
Signed S3 object
(zip + signed metadata)
|
v
aws lambda update-function-code
--code-signing-config-arn ...
|
v
Lambda verifies the Signing Profile
Untrusted → CodeSigningConfigNotFoundException
Trusted → normal deployment
⚠️ Trap:
UntrustedArtifactOnDeployment=Warnonly leaves a warning in CloudWatch Logs and lets the deployment proceed. Actual deployment blocking isEnforce. On the exam, if "enforce (strict)" is the keyword, the answer is Enforce.
allowed-publishers (cross-region trust)| Tool | Standard | Key Management | Verification Tool |
|---|---|---|---|
| AWS Signer for Containers | Notary v2 (Notation) | KMS-backed | ratify (CNCF, AWS-sponsored) |
| cosign (Sigstore) | OCI 1.1 + Fulcio CA | OIDC-based keyless (short-lived X.509) | cosign verify, policy-controller |
| Notary v1 | Docker Content Trust | TUF + local | Being deprecated |
Enforcing image policy on EKS uses the ratify admission webhook (AWS Signer) or the Sigstore policy-controller (cosign). Both can express policy through OPA Gatekeeper / Kyverno.
🔍 Deep Dive: Sigstore's keyless signing is a combination of short-lived X.509 certificates and a transparency log (Rekor). When a developer submits a GitHub OIDC token to the Fulcio CA, a 10-minute X.509 certificate is issued; the developer signs with that certificate and records it in the Rekor transparency log. There is no key management, so there is no risk of losing a key, but the downside is depending on Fulcio + Rekor at verification time. AWS Signer keeps the key permanently in KMS, giving a different operating model — AWS Signer suits enterprise environments with centralized IAM, while cosign suits open source projects with distributed trust.
| Tool | Strength | AWS Integration | Pricing Model |
|---|---|---|---|
| Inspector | Native to ECR/EC2/Lambda, automatic Security Hub, 24h rescan | Strongest | Per resource |
| Trivy | Free OSS, multipurpose for IaC/SBOM/images, fast | Run in CodeBuild | Free |
| Snyk | Developer-friendly UX, IDE integration, automatic fix PRs | External SaaS, AWS Marketplace | License |
| CodeGuru Security | LLM-based code analysis, multi-language | Native | Per line |
Combination pattern: CodeGuru Security (SAST) at the PR stage + Trivy (images) at the build stage + Inspector on ECR push + GuardDuty at runtime.
Shift-Left Security Pipeline (Full)
==================================================
Developer Laptop
├─ git-secrets (pre-commit)
├─ IDE: Amazon Q Developer / CodeWhisperer security
└─ pre-commit framework (lint + sast)
|
v
CodeCommit / GitHub
├─ CodeGuru Reviewer (PR auto-comment)
├─ CodeGuru Security (PR Finding → Security Hub)
├─ GitHub Secret Scanning + Push Protection
└─ Approval Rule Template
|
v
CodeBuild
├─ SAST (CodeGuru Security or Snyk Code)
├─ SCA (Snyk Open Source / npm audit / pip-audit)
├─ Container build → Trivy → ECR
├─ SBOM generation (Syft → CycloneDX)
└─ SLSA L3 provenance (in-toto attestation)
|
v
ECR (Push)
├─ Inspector Enhanced Scanning (24h rescan)
├─ Image signing (AWS Signer Notary v2)
└─ Attestation push (OCI artifact)
|
v
CodeDeploy / EKS Admission Controller
├─ Verify signature (ratify)
├─ OPA Gatekeeper / Kyverno policy
├─ Verify SBOM attestation
└─ Pre-deploy smoke test
|
v
Production
├─ GuardDuty Runtime + Malware Protection
├─ Macie (S3 PII)
├─ Security Hub aggregation (ASFF)
└─ EventBridge → SSM Automation auto-remediation
UntrustedArtifactOnDeployment=Enforceenv.secrets-manager; never keep them in the repository# 1) Create a Signing Profile
aws signer put-signing-profile \
--profile-name LambdaProd \
--platform-id AWSLambda-SHA384-ECDSA \
--signature-validity-period value=12,type=MONTHS
# 2) Create a Code Signing Config
aws lambda create-code-signing-config \
--description "Prod CodeSigning" \
--allowed-publishers SigningProfileVersionArns=arn:aws:signer:ap-northeast-2:123456789012:/signing-profiles/LambdaProd/abc123 \
--code-signing-policies UntrustedArtifactOnDeployment=Enforce
# 3) Upload the build zip to S3, then sign it
aws signer start-signing-job \
--source 's3={bucketName=builds,key=app.zip,version=abc123}' \
--destination 's3={bucketName=signed,prefix=signed/}' \
--profile-name LambdaProd \
--client-request-token unique-request-id-12345
# 4) Update the Lambda function (linked to the Code Signing Config)
aws lambda update-function-code \
--function-name MyFn \
--s3-bucket signed \
--s3-key signed/abc123/app.zip
# 5) Attach the Code Signing Config to the Lambda
aws lambda put-function-code-signing-config \
--function-name MyFn \
--code-signing-config-arn arn:aws:lambda:ap-northeast-2:123456789012:code-signing-config:csc-xxxWhen attempting to deploy unsigned code (Enforce mode):
An error occurred (CodeSigningConfigNotFoundException) when calling UpdateFunctionCode:
Code signing config not found, or artifact is not signed by trusted publisher
# buildspec.yml
version: 0.2
phases:
pre_build:
commands:
- aws ecr get-login-password | docker login --username AWS --password-stdin $ECR_URI
build:
commands:
- docker build -t $ECR_URI:$IMAGE_TAG .
- trivy image --severity CRITICAL,HIGH --exit-code 1 $ECR_URI:$IMAGE_TAG
- syft $ECR_URI:$IMAGE_TAG -o cyclonedx-json > sbom.json
- aws s3 cp sbom.json s3://my-sbom-bucket/$IMAGE_TAG.json
post_build:
commands:
- docker push $ECR_URI:$IMAGE_TAG
# Inspector Enhanced Scanning scans automatically at the moment of the push
artifacts:
files:
- sbom.jsonClick a choice to reveal the answer and explanation.
Question 1
Which of the following is the most appropriate AWS service for automated code review at the PR stage?
Question 2
Which setting is required to enforce signature verification on Lambda deployments?
Question 3
How do you automatically scan every image pushed to ECR, including OS and language dependencies?
Question 4
Which action best matches the "Shift Left" principle?
Question 5
A build needs a DB password. What is the safest way to inject it?
Question 6
How do you make CodeGuru Reviewer a mandatory gate for PR merges?
Question 7
Which tooling is appropriate for generating and managing an SBOM (Software Bill of Materials)?
Question 8
What does a build pipeline need in order to reach SLSA L3?
Question 9
A company wants to enforce "never run an unsigned container image" on production EKS. Which mechanism is most appropriate?
Question 10
A new CVE has been found in a Lambda function's dependencies, but the function code has not changed. What is the fastest way to learn about it?
Question 11
A company worried about supply chain attacks wants to strengthen the trustworthiness of its build artifacts. Which combination is most suitable for reaching SLSA L3?
Question 12
A security team receives a report that "there are so many security gates at the PR stage that developers are routing around them." What is the most appropriate response?
UntrustedArtifactOnDeployment=Enforce