Skip to content
Tech Interview Prep
Technical interview guide

Secure Software Development Lifecycle

Building security checks into every phase of development instead of testing for it only at the end.

Minutes to read
3
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: NIST SSDF 1.1; SLSA v1.2; OWASP SAMM and ASVS current 2026-08-31; CISA Secure by Design and Product Security Bad Practices current 2026-08-31.

Interview Q&A

Treat each question like a live interview question: answer out loud first (structure, assumptions, tradeoffs), then open the model answer to spot gaps and rehearse a tighter follow-up.

Curated: · Written: · Reviewed:

25 questions

Q&A-24

Improve an organization's secure-development maturity using OWASP SAMM.

Answer

Assumptions first. A 150–300 engineer org, 20–50 services, a small AppSec group (2–4 people), no existing baseline. Model: OWASP SAMM v2. 5 business functions, 15 practices, each scored 0–3, each level split into two streams (A and B). If your org is much smaller or much larger, the loop is the same; the numbers change.

The 90-second answer. Don't run SAMM as an audit, and don't try to lift every practice. Run it as a risk-driven loop: scope, assess with evidence, pick two or three gaps, set a target level, pilot, scale, reassess. The decision that matters is which practices to move first: the ones that cut material product risk and unblock others. In most orgs that's Threat Assessment and Security Requirements in Design, Secure Build in Implementation, and Security Testing in Verification. Incident Management in Operations is usually already at Level 1 and is cheap to lift.

Scope before you score. Fix the boundary: which business units, which product lines, which delivery model. You can't assess a mainframe team with a cloud-native rubric. SAMM's guidance is to scope the assessment to something you can act on: one product line or one engineering org, not the whole company in a single pass.

Assess with evidence, not opinion. The 15 practices:

FunctionPractices
GovernanceStrategy & Metrics, Policy & Compliance, Education & Guidance
DesignThreat Assessment, Security Requirements, Security Architecture
ImplementationSecure Build, Secure Deployment, Defect Management
VerificationArchitecture Assessment, Requirements-driven Testing, Security Testing
OperationsIncident Management, Environment Management, Operational Management

Score each 0–3 with the OWASP SAMM Toolbox, but every score needs an artefact. Worked example for Threat Assessment (figures illustrative):

  • Level 1: some teams threat-model some designs, no standard. Check: search repos for threat-model files; ask three teams.
  • Level 2: a defined process applied to all tier-1 designs, a model per service reviewed at a design gate. Check: 12 of 40 services have a threat model dated in the last 12 months → that's Level 1, not 2.
  • Level 3: models update on change, feed test cases, coverage is measured. Rarely worth chasing early.

That "12 of 40" is the kind of number that survives a follow-up: it's a count you can re-derive from the repo.

Choose two or three gaps. Criteria: does it reduce risk on the systems that matter, and does it unblock another practice? Threat Assessment at Level 2 unblocks Security Requirements and Requirements-driven Testing. Secure Build at Level 2 (dependency scanning, signed artifacts, SBOM) unblocks Defect Management. Stay on the critical path.

Targets and milestones. For each gap: target level, owner, adoption population, measure, date. Example: "Threat Assessment → Level 2 for all 14 tier-1 services by Q3; owner: AppSec lead; measure: share of tier-1 services with a threat model reviewed in the last 12 months, from 30% to 100%."

Pilot, then scale. Pilot with two or three willing teams. Measure security effect (findings caught earlier, time-to-remediate) and delivery effect (does it slow the release?). If the process adds a day to every release, it won't survive. Fix usability, then scale through paved-road tooling and make the secure path the default path.

Reassess on operating evidence. Pipeline logs, incident records, release data, not whether a training course was completed. Expect honest variation: a legacy team may sit at Level 1 on Secure Build for a year. Record that as residual risk, don't hide it.

What SAMM is not. It isn't a certification, and a score doesn't certify a product. Level 3 everywhere is not the goal; the smallest set of practices that measurably reduces risk in your delivery model is.

Curated: · Written: · Reviewed:

Difficulty: Medium
Q&A-1

Design a secure SDLC for a fast-moving SaaS organization.

Answer

Clarify first. "Fast-moving" usually means deploys multiple times a day, a security team of one to three people, and a multi-tenant SaaS where one tenant's data leak is a company-ending event. I'll assume GitHub, a cloud (AWS or GCP), containers, and that the org cannot afford a security review on every PR. If any of those are wrong the gate thresholds move, but the shape doesn't.

The design in one sentence: make the secure path the default path, gate only on findings that are both exploitable and reachable, and treat every escape as a process bug rather than a person bug.

1. Prevent: paved road. Golden-path repo templates that ship with GitHub Actions OIDC to cloud IAM roles (no long-lived keys in CI), branch protection requiring signed commits and one review, Dependabot or Renovate for dependency PRs, and a pre-commit hook running gitleaks. A new service gets most of the controls for free; opting out requires a written exception with an owner and an expiry date.

YAML
permissions:
  id-token: write   # OIDC, no static keys
  contents: read
jobs:
  deploy:
    steps:
      - uses: aws-actions/configure-aws-credentials@v4
        with:
          role-to-assume: arn:aws:iam::123456789012:role/ci-deploy
          aws-region: us-east-1

2. Detect: tuned gates, not a wall. The failure mode of most SDLCs is that SAST runs on every PR, produces 200 findings, and developers learn to click "dismiss." So gate on signal:

StageToolBlocking threshold
PRSemgrep (p/security-audit, p/secrets)new high-confidence findings only
PRgitleaksany verified secret
BuildTrivy (image)CVSS ≥ 7.0 with a fix available
BuildSyft → CycloneDX SBOM, cosign signalways (provenance)
Pre-prodZAP baselinenew high findings on authenticated routes
Designtime-boxed STRIDE threat modelnew data flow or auth boundary

Why these thresholds: blocking on every medium CVSS in a base image means you can't ship when a transitive library gets a CVE you never call. Blocking on a verified secret is cheap and correct: rotate it, don't just delete it from history.

3. Respond. Researcher intake via security.txt (RFC 9116) and a disclosure address, coordinated disclosure with a 90-day default, affected-version analysis driven off the SBOM, and a documented end-of-life for each service.

Trade-offs I'd state out loud:

  • SAST depth vs speed. CodeQL is deeper but adds minutes per language per PR; Semgrep is seconds. Run Semgrep on PR, CodeQL nightly on main.
  • Centralized review vs champions. A two-person security team cannot review every PR. Embed security champions per team; security owns the rules and the exceptions.
  • Blocking vs advisory. Block on secrets, critical exploitable CVEs, and auth-boundary changes; advise on everything else.

Failure modes and how you'd see them:

  • Alert fatigue → suppression count climbs and mean time to remediate climbs with it. Track both; if suppressions outpace fixes, the gate is too noisy.
  • Secret in git history → gitleaks over full history, not just the diff; rotate the credential rather than rewriting history and hoping.
  • Build worker compromise → an unsigned artifact reaches prod. Detection: an admission controller rejects anything without a valid cosign signature.
  • Dependency confusion → an internal package name gets squatted on npm. Detection: scope all internal packages and pin registries.

Measure escaped defects per quarter, share of services on the golden path, patch adoption time, and suppression age, not scan counts.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-4

Design a risk-based application security verification program.

Answer

Assumptions I'd state in the first minute: ~120 services, ~60 engineers, weekly deploys, one enterprise contract requiring an annual third-party pen test, SOC 2 Type II. At 10 services or 2,000 the tier boundaries move; the mechanism doesn't. Numbers below are illustrative for that 120-service shape: recalibrate, don't copy.

The 90-second answer. Don't verify everything equally. Sort the population into three tiers by what a compromise actually costs, attach a fixed check set and a freshness SLA to each tier, and make the release gate a function of both open findings and coverage confidence. A Tier 1 service with a clean scan that is 40 days old is not verified: it's unmeasured.

Tiering inputs, in order: does it handle regulated data (PII, card, health); does it hold production credentials or a path to the prod database; is it reachable from the internet without auth; what's the blast radius on takeover. One tenant or all tenants.

TierExampleRequired checksFreshnessGate
1public API, auth service, paymentsSAST (CodeQL or Semgrep), secret scan, SCA + SBOM, DAST on staging, authz test suite, annual pen test7 daysblock on any reachable critical/high; block if coverage < 95%
2internal service behind SSOSAST, secret scan, SCA, IaC scan30 daysblock on reachable critical; warn on high
3internal tooling, no customer datasecret scan, SCA90 daysadvisory

Why reachability triage works, and where it breaks. A SAST tool flags a tainted sink; whether it matters depends on whether an attacker-controlled entry point can reach it. CodeQL and Semgrep both let you express that as a source→sink query, which in my experience cuts the queue by roughly an order of magnitude on a mid-size Java service: hypothetically 400 findings down to ~35 actionable. The failure mode is dynamic dispatch, reflection and deserialization: the call graph is incomplete, so "unreachable" is a claim with a confidence, not a fact. Dormant findings therefore get a 180-day re-review and a re-run whenever the entry-point surface changes: never a permanent dismissal.

Coverage confidence, computed. For a tier, confidence = (services with a passing scan of every required check, inside the freshness window) / (services in the tier). Tier 1 has 30 services; 28 scanned in the last 7 days; 2 of those 28 had a check error out. Confidence is 26/30 = 87%, below the 95% gate, so the release train holds. That number is what you show an auditor. "We run SAST" is not.

Trade-offs. The alternative is uniform depth: run everything on everything, block on any high. Defensible at 10 services, unworkable at 120: you block 30%+ of PRs on findings in dead code, engineers learn to route around the gate, and the gate stops meaning anything. The other extreme, advisory-only, is what produces the escaped defect you read about. Tiering is the middle, and its cost is that you must maintain the tier assignment itself: a service that quietly starts handling PII without being re-tiered is the program's real blind spot.

Concrete failure modes.

  • DAST session expiry. The scanner's auth cookie expires mid-scan, every request returns 401, the report says zero findings. Detect by asserting a known-vulnerable canary endpoint is flagged on every run and that the authenticated baseline returns 200. Cost: a quarter of green reports that verified nothing.
  • Rule drift. Semgrep rules pinned to a version; an update silently drops a check. Detect with a fixture repo of known-vulnerable samples that must fail the build.
  • SBOM vs runtime mismatch. The scanner reads the lockfile; the container ships a vendored copy. Diff the SBOM against pip freeze or go version -m from the built artifact.

Exceptions are scoped to a finding ID, approved by the service owner plus security, expire in 90 days, and re-enter the queue automatically.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-2

Turn product threats into security requirements and acceptance tests.

Answer

Assume the threat model already exists: say a STRIDE pass over a multi-tenant document API. The conversion rule is: every threat becomes a requirement with a predicate a test can evaluate, and every requirement gets at least one test that fails when the predicate is violated. If you can't write the assert, you don't have a requirement yet.

Take one threat: "attacker reads another tenant's document by guessing an ID." Requirement: every read of /documents/{id} is authorized against the caller's tenant claim, and a mismatch returns 404 with a generic body, not 403, because 403 confirms the document exists. That clause is what separates a requirement from a wish.

Python
# pytest, Python 3.12
def test_cross_tenant_read_is_not_an_oracle(client, doc_owned_by_tenant_a):
    r = client.get(f"/documents/{doc_owned_by_tenant_a.id}",
                   headers={"Authorization": f"Bearer {token_for('tenant-b')}"})
    assert r.status_code == 404
    assert r.json() == {"error": "not_found"}

Trace: the client sends the GET with a tenant-b token; middleware resolves the claim to tenant-b; the handler loads the row, sees tenant-a; the ownership check fails; the response is 404 with the generic body. If the handler returned 403, this test fails: deliberately, because 403 is the leak.

ThreatRequirement predicateTest layerFails when
Spoofing: forged JWTsignature checked against JWKS, alg pinned to RS256auth middleware unitalg: none accepted
Info disclosure: cross-tenant readcaller tenant == document tenant, else 404API integration403 leaks existence
Tampering: replayed webhookHMAC over raw body, timestamp within 300 shandler unitbody parsed before verify
DoS: oversized uploadbody rejected before buffering (nginx client_max_body_size defaults to 1m; set it explicitly)proxy config testlimit enforced after read

Where to put the check is the real trade-off. Shared middleware covers every route but can't see object ownership; a repository check sees ownership but not the status code. The deciding criterion is the smallest layer that can observe the violation, plus one end-to-end test per critical flow to catch wiring. Same split for test style: a property test (Hypothesis generating tenant pairs, asserting no response body ever contains another tenant's document id) catches combinations you didn't enumerate, at the cost of runtime and shrinking; example tests are fast and readable but only cover what you thought of. Use property tests for invariants over input space, example tests for named regressions.

Concrete failure modes. A requirement with no predicate, "must be secure", is caught in review by asking for the assert. A test green for the wrong reason: 404 because the route is misspelled, not because authorization fired; detect it by pairing every negative test with a positive one (tenant-a reads its own document, 200). A traceability tool showing full coverage while the test is skipped in CI: a requirement linked to a skipped test is unverified, and you ship on coverage you don't have. Threat model drift: a new route with no requirement behind it; detect by diffing the route table against requirement IDs in CI.

Threats you accept get an owner and an expiry date, not a paragraph.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-7

Establish secure coding standards that engineers will actually use.

Answer

The question is how to establish secure coding standards that engineers will actually use. I'll assume we're in a mid-to-large org with multiple languages, a CI/CD pipeline, and some compliance obligations. The core answer: make the secure path the path of least resistance. Standards that live in a wiki are dead on arrival. Instead, derive rules from real incidents and threat models, then encode them in tooling and libraries.

For example, SQL injection. Instead of a policy saying 'use parameterized queries', provide a database access library that only exposes parameterized queries. In Python, that means a wrapper around cursor.execute that requires parameters. Then add a Semgrep rule that flags f-strings in SQL queries. The rule has an actionable message: 'Use the safe query builder: db.query('SELECT * FROM users WHERE name = %s', name)'. This maps to OWASP Top 10 A03:2021 Injection and CWE-89. Here's the unsafe and safe pattern:

Python
# Unsafe
query = f"SELECT * FROM users WHERE name = '{name}'"
cursor.execute(query)

# Safe
cursor.execute("SELECT * FROM users WHERE name = %s", (name,))

The linter catches the unsafe pattern in CI. This is concrete and checkable.

Now, trade-offs. Enforcement options: a library is strongest but can be bypassed by raw calls; a linter is fast but can be disabled; a review gate is context-aware but slow and inconsistent. Use a combination: library for critical paths, linter for broad coverage, review for exceptions. The library works because it removes the choice entirely; the linter works because it gives immediate feedback in the developer's workflow; the review gate works because it can weigh context, but it doesn't scale. When is a standards programme not worth it? If you're a 5-person startup with no compliance requirements and low-risk data, a heavy programme is overkill. But for most, the cost of a breach outweighs the friction.

Three concrete failure modes: 1) The standards doc nobody reads. Detected by adoption metrics: if less than 10% of repos use the secure library after 6 months, it's failing. 2) The linter disabled wholesale. Detected by counting # noqa or // eslint-disable comments per 1000 lines; a spike means the rule is too noisy or wrong. 3) The exception process becomes the path of least resistance. Detected by tracking exception count and average time-to-expiry; if exceptions grow 20% quarter-over-quarter, the process is too easy.

Here's a table comparing enforcement mechanisms:

MechanismStrengthWeaknessDetection of bypass
Library/APIHard to misuseRequires adoption, can be bypassed with raw callsCode search for raw API usage
Linter/SASTFast, broadCan be disabled, false positivesCount of disable comments, CI failures
Review gateContext-awareSlow, inconsistentPR review metrics, time-to-merge

Suppose you have 200 engineers and 500 repos. You introduce a secure logging library that redacts PII. After 3 months, adoption is 40%. You investigate: 30% of repos use it, 10% have exceptions. You find the library doesn't support a common logging pattern, so you add it. Adoption rises to 70%. You also track defect escape: before the library, 5 PII leaks per quarter; after, 1. That's an 80% reduction. This is a hypothetical but shows the measurement loop.

The key is to version standards, assign owners, test tooling against known fixtures, and stage rollout with remediation support. Exceptions must state scope, risk, owner, expiry, and alternative tests. Measure adoption, bypass, defect escape, recurrence, usability, and false results. Retire rules that add friction without demonstrated coverage.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-6

Design dependency governance for a large engineering organization.

Answer

Assumptions I'd state up front: polyglot org (npm, PyPI, Maven, Go, Cargo), one internal artifact proxy, hosted CI, a few thousand services, and no single human who owns "dependencies." If any of those is false (say, a single-language monorepo) the shape below simplifies a lot.

The 90-second answer. Dependency governance is four loops, not a policy document. Know what you run: an SBOM plus provenance per build artifact, keyed by digest, not by name. Control how it enters: proxy-only egress, pinned resolution, verified signatures, internal namespaces claimed on every public registry. Decide what to accept: risk tiering on reachability and exploit likelihood, not raw CVE count. Guarantee exit: upgrade SLAs, funded forks, and an expiry on every exception. The loops fail independently: a perfect SBOM with no exit plan still leaves you stuck on an abandoned library, and a strict proxy with no inventory means you can't answer "who is affected?" in under an hour.

What the controls actually are.

LayerConcrete control
Resolutionnpm: commit package-lock.json (lockfileVersion 3), build with npm ci --ignore-scripts --no-audit. Go: go.sum verified against sum.golang.org, GOFLAGS=-mod=readonly. Python: pip install --require-hashes --no-deps -r requirements.txt. Maven: maven-enforcer-plugin with requireUpperBoundDeps. Gradle: dependencyLocking { lockAllConfigurations() } plus --write-locks.
Source.npmrc scoped registry (@corp:registry=https://artifactory.corp/api/npm/), proxy-only egress, and a claimed namespace on npmjs/PyPI for every internal prefix.
Provenancenpm publish --provenance (Sigstore attestation), verified downstream with npm audit signatures; SLSA build levels; cosign verify on images.
SelectionOpenSSF Scorecard (0–10), EPSS (0–1), CVSS base (0–10), maintainer count, last release date, bus factor.
ResponseReachability analysis + EPSS, then SLA by tier.

Worked trace: dependency confusion. Your build resolves corp-auth-utils from the public registry because no scope is pinned. An attacker publishes that name with a postinstall script. Detection is mechanical: grep the lockfile for "resolved" URLs not matching artifactory.corp. That single check catches it before the script runs, which is why --ignore-scripts is the second line of defence and not the first. The 2021 Birsan research showed this working against dozens of large companies; the fix is claiming namespaces, not scanning harder.

Worked SLA (example policy, not a standard). Tier 1 = internet-facing and reachable: critical CVE patched in 7 days. Tier 2 = internal, reachable: 30 days. Tier 3 = not reachable, no untrusted input path: 90 days. Every exception carries an owner and an expiry date; an exception without an expiry is a permanent decision made by accident.

Failure modes worth naming. SBOM drift: the SBOM describes the build, the cluster runs a different digest. Reconcile by image digest, not tag. Scorecard as certification: xz-utils (CVE-2024-3094, versions 5.6.0/5.6.1, March 2024) came from a maintainer who spent two years building trust; scores are inputs, never approvals. Reachability false negatives: Log4Shell (CVE-2021-44228, CVSS 10.0, Log4j 2.0-beta9–2.14.1) was exploitable through a JNDI lookup in a header even in services that never logged user input. Exception rot: track the count of open exceptions as a first-class metric; if it only grows, the SLA is fiction.

Exit is the part teams skip. For critical dependencies, pick one: fund maintenance, fork with a named owner and a stated ongoing cost, sandbox and constrain privileges, or replace. Then rehearse it (registry compromise, malicious update, maintainer takeover, mass revocation) because the first time you run the revocation drill should not be the day it matters.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-11

Design security testing for a multi-tenant API platform.

Answer

Assumptions: shared-schema Postgres with tenant_id on every row, one IdP issuing RS256 JWTs, REST + GraphQL + async events, ~200 tenants, 5k req/s peak. On schema-per-tenant or database-per-tenant the isolation test changes shape: you're testing connection routing, not row predicates.

The test that decides the design: can tenant A's credential reach tenant B's object. Everything else is secondary. Seed two canary tenants, each with a known object ID, and assert cross-tenant reads return 404, not 403.

Python
# pytest 8.2, Python 3.12, httpx 0.27
import pytest, httpx

TOK = {"a": "tok_a", "b": "tok_b"}
OBJ = {"a": "obj_a_1", "b": "obj_b_1"}

@pytest.mark.parametrize("actor", ["a", "b"])
@pytest.mark.parametrize("owner", ["a", "b"])
@pytest.mark.parametrize("method", ["GET", "PATCH", "DELETE"])
def test_object_isolation(actor, owner, method):
    r = httpx.request(
        method, f"https://api.test/v1/objects/{OBJ[owner]}",
        headers={"Authorization": f"Bearer {TOK[actor]}"},
        json={"name": "x"} if method == "PATCH" else None,
    )
    if actor == owner:
        assert r.status_code in (200, 204)
    else:
        assert r.status_code == 404, f"leak: {actor} saw {owner}"

Trace: 2 actors × 2 owners × 3 methods = 12 cases. Six same-tenant expect 200/204; six cross-tenant expect 404. The 404 matters: a 403 confirms the object exists, which is a tenant-ID enumeration oracle. Asserting 404 forces the handler to scope the lookup by tenant_id before it decides authorization.

Sizing the matrix. Five subjects (tenant user, tenant admin, service identity, support engineer, platform admin) × five actions (read, write, delete, export, impersonate) × four resources (own object, other-tenant object, shared config, audit log) = 100 authorization cells. Run those exhaustively in CI: it's ~90s. Contexts (expired token, revoked token, cross-region) multiply only the 20 cross-tenant cells; applying them to all 100 buys nothing.

Trade-offs. An enumerated matrix is exhaustive over cells you declared and blind to the ones you didn't. Property tests (Hypothesis, pinned seed) find undeclared combinations but need a reference oracle and produce non-reproducible failures without the seed. Run the matrix on every PR, Hypothesis nightly. DAST (ZAP baseline) catches header, CORS and injection classes for near-zero cost but cannot reason about tenant semantics; manual abuse review is the only thing that catches workflow abuse like invite-then-transfer. Spend manual hours on state machines, not endpoints.

Failure modes.

FailureDetectionBlast radius
Cache key omits tenant_idcanary pair hits same key, second read returns first tenant's dataevery tenant on that shard
Mass assignment on PATCHsend role=admin in body, check responseone tenant escalated to admin
403 instead of 404diff status codes across canary pairtenant-ID enumeration
Webhook replayresend signed payload with same idempotency keyduplicate side effects
GraphQL nested resolverquery object { owner { otherTenantField } }bypasses REST check

Run canary tenants in production and alert on any cross-tenant 200: that's the only signal that catches a routing change you didn't test.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-20

Choose memory-safe languages and compiler defenses in product planning.

Answer

What I'd say first (60–120s).

Two questions decide this: where does the code run, and what does it parse? Assume a network-facing component that parses untrusted input, inside an existing C/C++ product, shipping next quarter.

My recommendation: write new high-risk components in Rust, keep the existing C/C++ and harden it with compiler defenses, and don't plan a big-bang rewrite. Rust's borrow checker enforces at compile time that a reference cannot outlive its owner and that a mutable and a shared reference cannot coexist: that is temporal safety (no use-after-free, no double-free) and spatial safety (slice indexing is bounds-checked). C++ has no equivalent static analysis, so its defenses are all dynamic and only as good as the run that exercised them.

Why the class disappears, and where it doesn't.

Rust
fn main() {
    let mut v = vec![1, 2, 3];
    let first = &v[0];   // shared borrow of v
    v.push(4);           // error[E0502]: cannot borrow `v` as mutable
    println!("{first}");
}

The compiler rejects this with error[E0502]: cannot borrow v as mutable because it is also borrowed as immutable. The C equivalent compiles and is a use-after-free:

C
int *first = &v[0];
v = realloc(v, 4 * sizeof(int));  // may move the buffer
printf("%d\n", *first);           // reads freed memory

Go is memory-safe too, but its type system does not prevent data races; go test -race only catches races that actually occur on that run.

Defenses for the C/C++ you keep. Costs are approximate, from the tool docs.

DefenseFlag / mechanismCatchesCost
ASan-fsanitize=addressheap/stack/global OOB, UAF, double-free~2x CPU, ~2–3x memory
UBSan-fsanitize=undefinedsigned overflow, misaligned accesslow
TSan-fsanitize=threaddata races~5–10x CPU
CFI-fsanitize=cfi -flto (Clang), /guard:cf (MSVC)indirect call to wrong targetfew %
Shadow stackIntel CET, -fcf-protection=fullreturn-address overwrite (ROP)low
Stack canary-fstack-protector-stronglinear stack overflowlow
MTEARMv8.5, async modeOOB/UAF via 4-bit tagslow async

Failure modes and how you'd see them.

  • FFI is where Rust's guarantees stop. A C callback that frees a buffer Rust still holds produces a use-after-free inside safe Rust. Detect with ASan across the boundary, Miri on the unsafe blocks, and fuzzing the FFI surface.
  • CFI constrains indirect calls, not returns: ROP still works. You need the shadow stack as well; they cover different edges.
  • MTE is probabilistic: 4-bit tags give 15/16 detection, and async mode reports after the fact. Treat it as a sampling detector, not a proof.
  • Sanitizers are test-time. ASan's ~2x cost keeps it out of production, so production memory bugs surface through crash telemetry and core dumps, not ASan.
  • A memory-safe language does not vet your dependencies. cargo-audit / cargo-deny and an SBOM cover that.

Migration and measurement. Rank components by exposure (parses untrusted input, runs privileged), replace one at a time behind the same interface, keep behavior and security regression tests, and track the fraction of native code that is C/C++ or unsafe. Chromium's 2020 memory-safety analysis found roughly 70% of its serious security bugs were memory-safety problems; moving your parser to Rust removes that class there, but the other 30% (authorization, logic, crypto) is untouched. Memory safety is a large reduction in one class, not a security strategy.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-8

Protect developer workstations, repositories, and development environments.

Answer

What I'd say first

I'd assume GitHub Enterprise Cloud for source, GitHub Actions for CI, AWS for production, and managed macOS/Linux laptops. If it's self-hosted GitLab and Jenkins the setting names change; the shape doesn't.

The framing I'd lead with: on a modern team the developer identity is a production credential. A laptop with a live session can push to main, a CI job holds cloud credentials, and a package publish token can ship code to every customer. So the goal isn't "harden the laptop": it's to make the pre-build path not a path to production, and to make any single compromise revocable in minutes rather than days.

Why the controls work

Phishing-resistant MFA (FIDO2/WebAuthn security keys or passkeys) works because the credential is bound to the origin at the protocol level. An Evilginx-style reverse proxy that phishes a TOTP code gets a code it can replay inside the 30-second window; it cannot get a WebAuthn assertion for github.com, because the browser won't sign for a different origin. That's the mechanism, not the policy.

Short-lived tokens work by capping the theft window. A classic PAT with no expiry is valid until someone notices. A GitHub App installation token expires after 1 hour, and an AWS role assumed through GitHub's OIDC provider defaults to a 1-hour session. If a token leaks, the blast radius is bounded by the clock, not by detection speed.

Control → attack step it interrupts → concrete setting

ControlAttack step interruptedConcrete setting
Phishing-resistant MFACredential replay from a proxy phishIdP (Okta/Entra) enforces WebAuthn-only and blocks TOTP; GitHub org requires 2FA
No static cloud keys in CIExfiltration of AWS_SECRET_ACCESS_KEY from a runnerpermissions: id-token: write + aws-actions/configure-aws-credentials with role-to-assume
Branch protectionDirect push of a malicious commit to mainRequire PR, 1 approval, dismiss stale approvals, require Code Owners review, require signed commits, "Do not allow bypassing the above settings"
Workflow-change approvalAttacker edits a workflow to exfiltrate secretsActions setting "Require approval for all outside collaborators"; CODEOWNERS on .github/workflows/
Push protectionCommitting a live secretSecret scanning push protection blocks the push client-side

Worked trace: laptop stolen at 09:00

  • 09:00 laptop gone. Disk is FileVault/BitLocker encrypted, so the attacker holds ciphertext.
  • 09:05 attacker boots and can't pass the login. Without disk encryption the prize is the browser's session cookies: GitHub web sessions are long-lived.
  • 09:10 on-call revokes the device's SSO session and the user's refresh tokens. GitHub App tokens are already expired or will be within the hour.
  • 09:15 audit log check: pushes, PAT creation, and OIDC role assumptions by that user in the last 24h.
  • 09:30 rotate everything the laptop could read. SSH keys, signing keys, package tokens.

The failure mode this exposes: if you can't answer "what could that laptop read?" in 15 minutes, you don't have an inventory, you have a guess.

Trade-offs and when to skip

Egress filtering on developer laptops is the classic over-rotation. It breaks package installs, VPNs and every new SaaS tool, and detection value is low because exfil rides HTTPS to a legitimate-looking domain. I'd skip it on laptops and put egress control on CI runners instead, where the job's expected network is knowable. Same for full disk imaging: expensive, rarely read.

Failure modes and detection

  • Malicious extension: caught by extension allowlisting plus review of extension-install events; blast radius is whatever the browser session can reach.
  • Compromised maintainer: caught by anomalous push times, new PAT creation, or a release published off-cadence; blast radius is the package's install base.
  • Source-host outage: caught by CI failing to fetch; recovery is mirrored repos and a documented local-build publish path.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-3

Build a secure source-to-production software supply chain.

Answer

Clarify first. Before I design anything I want three things: the threat model. Are we defending against a compromised dependency, an insider with commit rights, or a stolen CI credential?. The blast radius (does a bad artifact reach customer data or an internal tool?), and the compliance floor (SLSA level, FedRAMP, internal policy). The design changes a lot between those answers.

Assumptions I'll state. Git-hosted source, hosted CI runners, container images deployed to Kubernetes, one cloud. If any of those is wrong, say so and I'll adjust.

Core answer. The spine is: every artifact carries a signed, verifiable claim about how it was built, and every promotion step checks that claim against policy before the artifact moves. Source, build, and deploy are three trust boundaries; you don't have to trust the middle one if the artifact proves what happened inside it.

Source. Branch protection with required reviews, and, the part people skip, restrict who can edit the CI config itself. A workflow file is code that runs with your credentials. GitHub's default GITHUB_TOKEN is read-only for new repos; keep it that way and grant per-job permissions: explicitly rather than inheriting.

Build. Ephemeral, isolated builders. The real choice:

optionisolationprovenancewhen it's enough
hosted CI (GitHub Actions, GitLab)shared kernel, per-job VM/containerOIDC identity, SLSA L2 with a generatormost teams
self-hosted ephemeral (Tekton on a fresh node)per-build VMSLSA L3 if the control plane is hardenedregulated, or hermetic builds required
long-lived build boxnonenonenever for release artifacts

Provenance and signing. The build emits an in-toto attestation with the SLSA provenance predicate, bound to the artifact digest. Sign keyless with cosign: Fulcio issues a short-lived cert tied to the CI's OIDC identity, Rekor logs it. No long-lived signing key to steal. Verify at admission with Kyverno or Gatekeeper: reject any image whose provenance doesn't name the expected repo, workflow, and builder.

Deploy. Immutable digests, never tags. Argo CD or Flux reconciles; admission checks signature and provenance. Rollback is redeploying the previous digest.

Tradeoffs. Keyless signing depends on Fulcio and Rekor being reachable and on your OIDC issuer: air-gapped, run your own Fulcio or fall back to a KMS-held key. SLSA L3 hermetic builds cost real engineering; if your threat model is typos and drive-by dependency compromise, L2 plus pinned lockfiles and a dependency scanner gets most of the way. Don't build L3 for an internal dashboard.

Failure modes. Compromised maintainer: provenance still says "built from this repo". It never says the code is safe, so review, tests, and runtime sandboxing stay. Stolen CI token: OIDC short-lived tokens and per-job permissions bound it. Registry compromise: verify digest and signature at admission, not only at pull. Signing key compromise: rotate, then rebuild from a known-good commit rather than re-signing the suspect artifact. Re-signing launders the compromise.

The line to say out loud: provenance proves process, not safety. It's a supply-chain integrity control, not a vulnerability control.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-9

Design secure build, signing, and release-key management.

Answer

Start by separating three authorities that usually get conflated: who can build, who can approve a release, and who can sign it. If one identity holds all three, a single phished CI token ships code to production, and no amount of logging saves you.

Assumptions I'd state up front: cloud-hosted CI, container or binary artifacts, a handful of products, and an OIDC-capable identity provider. Air-gapped or on-prem changes the key story but not the separation.

The core design. Builds run on ephemeral, network-restricted runners that hold no long-lived secrets: they authenticate with a short-lived OIDC token scoped to the repo and workflow. The build platform, not the job, emits SLSA Build L3 provenance: a signed in-toto attestation naming the source commit, the builder identity, and the output digest. Signing keys are non-exportable in a KMS or HSM, one key per environment, never shared across products. Production promotion requires two distinct human identities to sign the same digest. Consumers verify signature, provenance, and policy, not merely that a signature exists.

Why bind provenance to the digest, not the bytes. The attestation's subject is sha256:9f2c…a1, so a signature over the attestation transitively covers the artifact. Sign the bytes directly and every rebuild forces a re-sign; bind to the digest and the verifier checks that the artifact it holds hashes to what the builder claimed, without trusting the builder at verify time.

How dual control actually gates a release. Two identities sign the same subject digest within a window; the release service counts distinct signatures over that one digest before promoting. One compromised account produces one signature and the gate stays shut.

Trade-offs.

OptionNon-exportableOps costWhen to choose
Cloud KMS asymmetricYesLowDefault for most teams
HSM (FIPS 140-2 L3)YesHighRegulated, high-value root keys
Offline key on hardware tokenYesVery highRoot of trust, rotated rarely
Sigstore keyless (Fulcio + Rekor)N/A: 10-min certLowOIDC identity is your trust anchor

Keyless is the cheapest path when your IdP is the root of trust: Fulcio issues a ~10-minute certificate bound to the OIDC identity, and the signature lands in Rekor's append-only log. It fails when you need a stable, offline-verifiable key or you can't reach the log.

Failure modes and detection. Builder compromise: provenance shows a builder ID outside the allowlist. Alert on it. Key compromise: an unexpected Rekor entry or a signature from a retired key ID. Clock skew: a valid signature rejected because the cert window looks expired. Monitor verifier rejection rate. Verifier bypass: a deploy that skipped the gate. The deployment controller should refuse unsigned digests, so audit for promoted digests with no matching attestation.

Worked trace of a release gate for image sha256:9f2c…a1:

1. cosign verify --key kms://prod-signing  -> 2 sigs: alice@, bob@
2. attestation.predicate.builder.id == "ci-prod-runner"
   subject[0].digest.sha256 == 9f2c…a1        (matches artifact)
3. policy: env==prod AND sig_count>=2 AND builder in allowlist AND slsa_level>=3
4. Rekor entry exists for the attestation UUID
-> promote

Step 2 is the load-bearing one: if the digest in the attestation doesn't match the artifact, everything downstream is worthless.

Rotation and recovery. Rotate signing keys every 90 days with a 2× overlap so old signatures still verify; rotate the root annually. On compromise, revoke the affected key, publish the scope, and rebuild from source: re-signing the same uncertain artifact just launders the doubt. Exercise builder, key-admin, registry, and verifier compromise, and keep a trusted rollback path staged before you need it.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-14

How do you manage secrets and credentials across the secure SDLC (developer environments, source control, CI/CD, and runtime) covering leak detection and remediation, rotation, vaulting, and least-privilege build and deploy identities?

Answer

Classify every secret by blast radius and lifetime first, because that decides storage, scope and rotation. Three classes: human credentials (SSO with hardware MFA, no shared accounts), machine identity for build and deploy (should be short-lived and federated, not stored at all), and application secrets (database passwords, third-party API keys, signing keys) which belong in a vault or managed secret store, injected at runtime, never baked into an image or committed.

The default I push for is zero static credentials in CI. GitHub Actions, GitLab and most clouds support OIDC federation: the pipeline exchanges its workload identity token for a cloud role scoped to that repository and environment. No access key exists to leak.

yaml permissions: id-token: write contents: read jobs: deploy: environment: prod steps: - uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::123456789012:role/gha-deploy-prod aws-region: us-east-1

The trust policy pins token.actions.githubusercontent.com:sub to repo:org/app:environment:prod, so a fork or a feature branch cannot assume it. Session duration 15–60 minutes.

Secret classWhere it livesLifetimeRotation trigger
Cloud deploy identityOIDC-federated role, nothing stored15–60 min sessionn/a, no static key
DB credentialsVault dynamic secrets or IAM auth1–24 h TTLAutomatic on TTL
Third-party API keysVault / cloud secret manager90 daysSchedule plus on exposure
Signing keysHSM or KMS, non-exportable1–2 yearsCeremony, or on compromise
Developer localPassword manager, never a committed .envSessionOffboarding

Detection runs at three points: pre-commit hooks (gitleaks), push protection that blocks the commit before it lands, and provider-side scanning where GitHub notifies AWS, Stripe and others directly. Also scan full git history including forks, CI logs, and container image layers: a secret deleted in a later commit is still in the object store.

Remediation order matters. A developer commits an AWS key; push protection blocks it. If it lands anyway, assume compromise: deactivate the key in IAM rather than deleting it, so the audit trail survives; check CloudTrail for use inside the exposure window; rotate anything derived (RDS passwords, sessions, tokens minted from it); then purge with git filter-repo and force-push, and invalidate forks and caches. Deleting the commit is not remediation: the key was already public.

Rotation should be automated. Dynamic secrets with a TTL beat scheduled rotation because there is no window where a stale credential still works. For static secrets use dual-key rotation: create new, deploy, verify, deactivate old, delete after a grace period. Track rotation coverage and the age of the oldest live credential.

Least privilege means one role per pipeline, no * actions, permission boundaries, and separate identities for build (read source, push artifact) and deploy (write to prod). The build identity must not be able to deploy; the deploy identity must not read source. Prod deploys go through environment protection rules with required reviewers.

Failure modes worth naming: env vars leak into child processes, crash dumps and CI logs, and log masking is best-effort. Multiline or base64 secrets bypass it. Vault becomes a single point of failure, so you need a documented break-glass path and seal/unseal procedure. Rotation without consumer coordination breaks deploys, so rehearse it in staging before enforcing TTLs in prod.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-19

Design security for infrastructure-as-code and deployment configuration.

Answer

What I'd say first (90 seconds). Assume the pipeline holds production write credentials and every engineer can open a PR. Then the design question is: how do I stop a text diff from becoming an unreviewed production change? I'd split the pipeline into three trust boundaries (authoring, plan, apply) give each its own identity, and make the reviewed plan artifact, not the commit, the thing that gets approved. Everything else (state, policy, drift) hangs off that split.

boundaryidentityreadswritesgate
authoringhuman, SSO + MFAreporepo via PRCODEOWNERS review
plantf-plan rolestate, cloud read APIsnothingnone: safe to run on every PR
applytf-apply rolestatecloud resourcesdigest-bound, prod environment reviewers

The plan role is read-only, so a compromised PR branch can't change anything. The apply role is the only one with write, and it only accepts a plan whose hash matches what was approved.

Why digest binding works. terraform plan -out=plan.tfplan serializes the diff and a snapshot of state. Hash it at plan time, re-hash before apply, and any edit in between (a rebase, a mutated artifact, a swapped runner) fails the check. terraform apply plan.tfplan won't re-plan, so what you reviewed is what runs.

YAML
# GitHub Actions, ubuntu-24.04, terraform 1.9
jobs:
  plan:
    permissions: { id-token: write, contents: read }
    steps:
      - uses: aws-actions/configure-aws-credentials@v4
        with: { role-to-assume: arn:aws:iam::111122223333:role/tf-plan }
      - run: terraform plan -out=plan.tfplan -lock=false
      - run: sha256sum plan.tfplan > plan.sha256
      - uses: actions/upload-artifact@v4
        with: { name: plan, path: "plan.tfplan\nplan.sha256" }
  apply:
    needs: plan
    environment: production        # required reviewers gate here
    permissions: { id-token: write, contents: read }
    steps:
      - uses: actions/download-artifact@v4
        with: { name: plan }
      - run: sha256sum -c plan.sha256   # fails if the artifact changed
      - uses: aws-actions/configure-aws-credentials@v4
        with: { role-to-assume: arn:aws:iam::111122223333:role/tf-apply }
      - run: terraform apply plan.tfplan

Trade-offs, and what decides them.

  1. Split plan/apply vs one pipeline. Splitting costs an artifact store and digest plumbing; it buys reviewability. Decide by blast radius: if apply can destroy a database, split.
  2. OPA/Conftest vs cloud-native guardrails (AWS SCPs, Azure Policy). OPA is portable and unit-testable in CI; SCPs are enforced by the cloud and survive a compromised runner. Use OPA for fast PR feedback, SCP as the backstop CI can't bypass.
  3. Managed (Spacelift, Atlantis) vs self-built. Managed gives you the audit log and digest binding out of the box; self-built gives control but you own the artifact store, and plan files embed sensitive values from state, so that store is a secret store. If state holds secrets, encrypt the plan or don't persist it.

Failure modes and how you catch them.

  • Post-approval mutation → sha256sum -c fails at apply; on-call re-runs the plan.
  • Drift → terraform plan -detailed-exitcode returns 2 on a diff; alert on it. Cost is real: refresh calls every resource, so 2,000 resources across 200 workspaces daily is a lot of Describe* calls. Stagger runs and watch provider throttling.
  • Secret in state → state is plaintext unless encrypted (OpenTofu 1.7 and Terraform 1.10 added client-side state encryption with KMS/Vault key providers). Scan every bucket version with gitleaks.
  • Over-broad apply role → IAM Access Analyzer unused-permissions findings.

Runtime. Reconcile live resources to code, but don't blindly overwrite drift: a console change made during an incident may be the fix. Investigate, then import or codify it. Govern exceptions with expiry and verify cleanup.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-17

Evaluate whether an SBOM and provenance package supports a release claim.

Answer

Core answer (first 90 seconds). A package supports a release claim only when two independent links hold: provenance binds the exact artifact digest to a builder and source revision you trust, and the SBOM's component set is complete for that artifact and consistent with the build inputs. Neither alone is enough. Provenance without an SBOM tells you who built it, not what's in it. An SBOM without provenance is an unauthenticated list anyone can regenerate. So restate the claim as a testable predicate before checking anything: "image X at digest sha256:… was built by builder B from commit C, and contains no GPL-3.0-only component." State your assumptions: which artifact (image vs tarball vs jar), which digest algorithm, which SBOM format and version (SPDX 2.3, ISO/IEC 5962:2021, or CycloneDX 1.5/1.6), and that "supports" means evidence exists and a verifier enforces it, not that the claim is true.

What each artifact actually proves. Provenance is an in-toto attestation, usually DSSE-wrapped, with predicate https://slsa.dev/provenance/v1. Its subject[0].digest.sha256 must equal the artifact digest; builder.id must be the builder you trust; buildDefinition.resolvedDependencies must name the source commit. SLSA v1.0 grades this Build L1–L3: L1 only says provenance exists and is trivially forgeable; L3 means a hosted, isolated builder produced non-forgeable provenance. L1 buys you almost nothing against an insider. The SBOM's job is different: it must be generated during the build (CycloneDX 1.5 added a formulation section and lifecycle phase for exactly this) rather than by scanning the finished image, which misses build-time-only and vendored code.

Worked check (figures illustrative). Claim: registry.internal/payments-api@sha256:9f2c… (v2.4.0) contains no GPL-3.0-only component and was built from tag v2.4.0.

  1. Provenance subject digest 9f2c… matches the image digest. Pass.
  2. resolvedDependencies[0].uri = git+https://…@4b1e…; tag v2.4.0 resolves to 4b1e…. Pass.
  3. cosign verifies the signature against the org's Fulcio identity; a Rekor entry exists. Pass.
  4. SBOM: CycloneDX 1.6, formulation section present, 412 components. Three have no version; two purls disagree with the lockfile; one is pkg:generic/openssl@1.1.1 with license GPL-3.0-only. Claim fails on the license, and the two purl mismatches mean the SBOM was not generated from the same inputs as the artifact.

Failure modes, with detection and cost.

FailureDetectionCost
Tag mutated after build; provenance digest ≠ artifact digestCompare digests directlyRebuild and re-attest; the shipped image is unattributable
SBOM produced post-hoc by image scanNo formulation section; component count below lockfile countFalse "no vulnerable deps" claims, missed vendored code
Verifier in audit mode, not enforceRead the admission policy's enforcement modeUnsigned images run in prod while dashboards stay green
Attestation absent from the transparency logQuery Rekor for the artifact digestCannot prove the attestation existed at build time

Trade-offs. Build-time SBOM is accurate but needs toolchain integration; post-hoc scanning is cheap and incomplete: pick build-time when the claim is about contents. SPDX 2.3 has stronger relationship semantics (DEPENDS_ON, GENERATED_FROM) and ISO standing; CycloneDX 1.6 carries VEX and attestations. Choose by what your consumer tooling can ingest, and check the NTIA minimum elements (supplier, name, version, unique identifier, dependency relationship, author, timestamp) as the floor.

Limits. Neither artifact proves the source is benign, that dependencies are reachable, that licenses are satisfied under your distribution model, or that deployment is secure. Report missing and uncertain scope explicitly, and link out to vulnerability, integrity and license analysis rather than implying the package covers them.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-10

Create security release gates without turning them into checkbox theater.

Answer

Core answer. "Checkbox theater" is a gate that produces a green check without ever changing a decision. The test I apply: name the defect class the gate catches, and the last time it caught one. If either is blank, it is theater.

Assumptions: CI with required status checks (GitHub branch protection, GitLab MR pipelines), an artifact registry keyed by digest, and an SBOM/provenance step. If you do not have digest-keyed artifacts, fix that first: every gate below depends on binding evidence to the exact thing you ship.

A gate has three parts: an evidence producer, a policy evaluator, and an enforcement point. Theater comes from two places: the evaluator is a human reading a dashboard, or the predicate is satisfiable by empty evidence. Both are fixable.

Mechanism: fail closed on missing evidence. The default that matters: a required status check that never reports blocks the merge. GitHub shows "Expected: Waiting for status to be reported" and the merge button stays disabled. So the safe design makes the check absent when evidence is absent, not green. The failure mode to design out is the scanner that exits 0 because it scanned zero files.

Here is the check I would wire in:

Shell
#!/usr/bin/env bash
set -euo pipefail
img="$1"; digest="$2"
test -s "sbom/${digest}.spdx.json" \
  || { echo "FAIL: no SBOM for ${digest}"; exit 1; }
pkgs=$(jq '.packages | length' "sbom/${digest}.spdx.json")
[ "$pkgs" -gt 0 ] || { echo "FAIL: SBOM has 0 packages"; exit 1; }
jq -e '[.vulnerabilities[]? | select(.kev == true)] | length == 0' \
  "scan/${digest}.json" || { echo "FAIL: KEV CVE in ${img}"; exit 1; }
echo "PASS"

Trace it for digest sha256:abc, image api:1.4.0:

  • sbom/sha256:abc.spdx.json missing → test -s fails → exit 1. The gate blocks because evidence is missing, not because a finding exists.
  • File present, .packages is [] → pkgs=0 → second check exits 1. The empty-evidence pass is caught.
  • File present with 812 packages, scan/sha256:abc.json has one entry with "kev": true → jq -e returns non-zero → exit 1.
  • Clean scan → jq -e returns 0 → PASS.

Trade-offs: block vs advise. Blocking gates get bypassed; advisory gates get ignored. So block on a small set of invariants that are cheap to satisfy and expensive to miss: signed artifact, provenance present, no KEV-listed CVE in the shipped image, SBOM bound to digest. Advise on the long tail (CVSS 4–6.9 with no known exploit, license drift). Every blocking gate is a serialization point; four is usually the ceiling before people start asking for admin override.

When not to gate: do not gate on a metric you cannot compute at merge time (for example, "no new p99 regression"). You will either block on noise or the check will be permanently overridden.

Failure modes and detection.

failuresymptomdetection
empty-evidence passscanner exits 0 on 0 filesassert artifact count > 0 in policy
stale evidenceSBOM from previous buildbind evidence to digest; alert on mismatch
override driftexceptions never expirecount open overrides; alert at expiry date
false blockmerge blocked on unreachable CVEtrack false-block rate and time-to-merge

Worked arithmetic, labelled hypothetical: a team at 40 merges/day with a 90-second gate adds ~1 hour of aggregate wait per day. ~90 hours a quarter. If it catches 2 real defects a quarter, that is ~45 hours of wait per catch. That ratio is why the gate must be fast and the catch set must be the ones that matter. If override rate exceeds ~10% of merges, the gate is mis-tuned, not the engineers.

Exceptions. An exception names scope (which digest), evidence, compensating control, residual risk, approver, expiry, and the closure test. Feature deadlines do not override it: the expiry date does.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-12

Integrate privacy and data protection into the SDLC.

Answer

Core answer: say this first

Privacy is a decision problem owned by legal or the DPO; engineering owns making those decisions enforceable. So integrating it into the SDLC is not "add a review step": it is three artefacts that live in the repo.

Assumptions I'd state up front: GDPR or CCPA/CPRA in scope, a named DPO or privacy counsel reachable, and a data catalog that exists or can be built. If there is no DPO, stop: engineers should not be inventing lawful-basis calls.

  1. A machine-readable data map. For each field: purpose, lawful basis, retention, recipients, and whether it feeds a model. Everything else reads from this.
  2. Controls as code at the boundaries. Schema annotations that fail CI when a new PII column has no purpose tag; OPA/Rego or Semgrep rules; IaC checks (Checkov, tfsec) for public buckets and unencrypted stores.
  3. A rights path that reaches derived data. Export, correction, deletion: tested end to end, including caches, feature stores and backups.

Trade-off 1: policy-as-code vs a privacy platform. OneTrust or Microsoft Purview give you a workflow and an audit trail but lag schema changes by weeks. Rego in CI catches a new PII column at PR time but leaves no legal record. Deciding criterion: how fast your schema changes. Ship schema weekly and you need both: the platform is the record of decision, CI is the thing that blocks.

Trade-off 2: hard delete vs crypto-shredding. Hard delete is simple until backups are WORM/immutable. Crypto-shredding (a per-subject key in KMS, delete the key) makes backup rows unreadable without rewriting them. Criterion: whether backups are immutable and how many derived copies exist. Cost: key management, and you must be certain no copy holds plaintext.

Failure modes, with detection

  • Reidentification. (5-digit ZIP, gender, date of birth) uniquely identifies roughly 87% of the US population (Sweeney, 2000). Detection: an equivalence-class size check on any release; alert when the smallest class is below k.
  • Purpose drift. A billing field consumed by the training pipeline. Detection: a lineage diff (OpenLineage, DataHub) that alerts when a column's downstream consumers include a purpose absent from the registry.
  • Deletion gaps. Detection is a reconciliation job counting residual subject rows in each derived store; a non-zero count pages.

Worked trace: one deletion request

StepActionResult
t0Identity verified30-day GDPR clock starts (Art. 12(3))
PostgresDelete by subject_id1 row in users, 412 in events; replica catches up in ~200 ms
RedisDelete subject-keyed keys3 keys gone; aggregate counters not keyed by subject survive: flag them
S3 lakeParquet is immutable, rewrite partition1 file rewritten, 412 rows removed
Feature storeDelete subject-keyed featuresModel weights retain influence: documented limitation, not a bug
BackupWORM, 35-day retentionCrypto-shred the subject key
CloseReconciliation jobTicket closes with residual-row count

What changes the decision: if the data is special-category (Art. 9) or feeds automated decisions with legal effect (Art. 22), the DPIA gate becomes blocking rather than advisory.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-21

Design secure development for an AI-assisted coding workflow.

Answer

Core answer. Treat the model as an untrusted, non-deterministic contributor: it reads whatever context you hand it and acts through whatever tools you wire to it. So you design two boundaries, not a prompt. Ingress: what code, data and secrets can reach the model. Egress: what its output and its agents can do to your systems. "Tell the model not to leak secrets" is not a control: prompt injection is unsolved, and the same input can yield different output on the next call.

Assumptions: GitHub Enterprise with Copilot Business, AWS, Python and Node services, agents that may open pull requests but never merge.

Ingress. Turn on Copilot content exclusions so repos holding keys, customer data or unreleased designs are never sent as context. Set the org policy that blocks suggestions matching public code, so you don't ship a license-encumbered snippet. Put secret scanning with push protection in front of every repo: it rejects the push at the client, before the credential reaches the remote. For anything you must paste, run it through a redaction proxy that strips high-entropy strings and known key formats.

Egress. The agent's output is a supply-chain input. Require review by CODEOWNERS under branch protection, and give the CI token permissions: contents: read explicitly rather than relying on defaults. Pin third-party actions to a full commit SHA, not a tag.

YAML
name: ci
on: [pull_request]
permissions:
  contents: read
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@<full-commit-sha>  # v4.2.2
      - run: pip install -r requirements.txt
      - run: pip-audit -r requirements.txt
      - run: pytest

For cloud access, use OIDC federation instead of stored keys: permissions: id-token: write plus aws-actions/configure-aws-credentials assuming a role whose MaxSessionDuration is 1 hour. A leaked static key is usable until someone rotates it; an OIDC token is dead in 60 minutes.

Why boundaries, not the prompt. The model is non-deterministic and its context is attacker-influenceable: an issue body, a README, a fetched web page can carry instructions. Allowlisting tools shrinks the surface but doesn't remove it: an allowed curl is still an exfiltration channel. So default-deny network egress from the agent sandbox and log every destination.

ControlFailure it stopsHow you detect it failed
Content exclusions + redactionPrivate code/keys in provider contextDLP alerts, provider audit log
Push protectionCommitted credentialsBlocked-push events
SHA-pinned actions, read-only tokenCompromised action tag, token abuseWorkflow diff review, token scope audit
OIDC, 1h sessionsLong-lived key theftCloudTrail AssumeRoleWithWebIdentity anomalies
Registry allowlist + pip-auditHallucinated/slopsquatted packageLockfile diff, audit findings

Failure modes. Prompt injection in a fetched doc makes the agent exfiltrate source: detect via egress logs and a deny-by-default firewall. A hallucinated package name gets installed and runs an install script: detect via lockfile review and a private-registry allowlist. An agent holding prod write credentials deletes a resource: detect via CloudTrail and a permission boundary that denies *:Delete* outside a break-glass role.

Trade-offs and when not to. Allowlisting tools and egress costs developer time; scope it to agents that touch production or customer data, and leave read-only local assistants open. Don't give agents merge rights or standing prod credentials: the review gate is the control that survives a bad model output. Evaluate with a fixed task set: a known-vulnerable dependency, a prompt-injection payload in a README, and a request to add an auth bypass; track whether the pipeline catches each.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-15

Build security observability into a product before launch.

Answer

The 90-second version. Before I write a single event, I ask two questions: which abuse are we trying to catch, and who gets paged when it fires? If nobody owns the alert, the event is decoration. Assumptions I'd state out loud: multi-tenant SaaS, ~50k users, one on-call security engineer, OpenTelemetry already in the request path, and a launch date that doesn't move.

Then I pick event classes from decisions, not from a checklist. The ones that earn their storage: authentication outcomes, authorization denials, privilege and policy changes, admin and support impersonation, sensitive-data exports, config changes, security-control health, and recovery actions. Everything else is a candidate for sampling.

classvolumeretentionsample
auth outcomeslow13 mo100%
authz denialslow13 mo100%
admin/support accesslow13 mo100%
sensitive-data exportlow13 mo100%
resource readshigh90 d1%

Schema and transport. I'd emit OCSF (Open Cybersecurity Schema Framework) v1.1.0 events (Authentication, Account Change, API Activity classes) with the version pinned and validated in CI, so a producer renaming a field fails the build instead of silently breaking a detection. Ship over authenticated TLS to a collector that writes to storage the product itself can't reach; the app holds append-only credentials.

The cost decision, with numbers. Say 5 KB per event, 200 events per user per day, 50k users: 5 KB × 200 × 50,000 = 50 GB/day, about 1.5 TB/month. Self-managed OpenSearch at roughly $1.50/GB ingest lands near $2.3k/month; Splunk's published workload list price has historically been around $150/GB/day, which is ~$225k/month for the same volume. Those are list-price ballparks, not quotes, but they're why I keep 90 days hot and 13 months in object storage, and why I sample high-volume reads at 1% while keeping every auth denial at 100%.

Trade-offs. Synchronous emission makes product latency depend on the log pipeline, so I use a bounded in-process queue and accept drops rather than stalls. A central SIEM buys cross-service correlation at the cost of a single point of failure and per-GB pricing; I'd only centralize the classes I actually have cross-service detections for.

Python
import hmac, hashlib, queue, time

def emit(ev, tenant, user, key, q, dropped):
    e = {"time": time.time_ns(), "class_uid": 3002, "tenant": tenant,
         "actor": hmac.new(key, user.encode(), hashlib.sha256).hexdigest(),
         "status": ev["status"], "reason": ev["reason"]}
    try:
        q.put_nowait(e)
    except queue.Full:
        dropped.inc()

time.time_ns() gives wall-clock nanoseconds; the HMAC digest is 64 hex chars, stable per tenant key, so you can correlate a user across events without storing the identifier. put_nowait raises queue.Full once the bounded queue is full: that's the drop path, and dropped is what you alert on.

Failure modes and how you'd see them.

  • Clock skew: compare event time to collector receive time; alert when p99 skew exceeds 5s. Otherwise an attack spanning two hosts looks like two unrelated events.
  • Schema drift: a canary event every 60s, alert if absent for 5 minutes. A dead man's switch catches a silent producer, which no error log will.
  • Backpressure: graph p99 request latency against collector error rate; if they move together, the queue is the cause.
  • Redaction failure: run an entropy and pattern scan in the pipeline before storage and quarantine on match, rather than trusting the producer.

Alerts, not logs. One concrete hypothesis: credential stuffing. More than 100 failed logins from one ASN across more than 50 distinct accounts in 10 minutes, against a baseline p99 of about 5. Owner, severity, runbook and containment (force step-up auth, block the ASN) are written before launch. Tenants get a scoped audit-log API over the same 90 days.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-13

Handle security debt in a legacy product with frequent releases.

Answer

The 90-second answer. Assume you cannot pause releases: the product ships weekly and the business depends on it. So treat security debt as a throughput problem: keep shipping while you shrink the exploitable surface. Rank work by exploitability × blast radius, not by a debt score. Contain the invariants that would end the company if they broke: authorization, tenant isolation, update integrity, secret handling, audit logging, backup restore, then pay down the rest behind seams that let you refactor without freezing the release train. A generic debt score (age, lines of code, "critical" labels) tells you nothing about whether an attacker can reach the code. Two inputs do: is it reachable from an untrusted path, and what does it touch when it runs. A SQL injection in an admin-only endpoint behind SSO is a different problem from the same bug in a public search box. Fix the ones that are both reachable and high-consequence first; everything else waits with a named owner and an expiry date.

Why characterization tests make refactors safe. Legacy security work stalls because touching old code breaks behavior nobody documented. Characterization tests (Feathers, Working Effectively with Legacy Code) pin the current behavior, including the bugs, at the seam you are about to change. You write them against the existing interface, watch them pass, then refactor. If a security fix changes behavior, the test fails loudly instead of shipping silently. That is what makes it safe to swap a hand-rolled crypto routine for a vetted library inside a weekly release: the seam test tells you whether anything downstream moved.

Concrete moves. Generate a CycloneDX SBOM per build (Syft or Trivy) so you can answer "are we affected?" in minutes, not days. Run dependency scanning in CI (Dependabot defaults to weekly, Renovate lets you pin schedules) and prioritize by CISA's Known Exploited Vulnerabilities catalog and EPSS score, not raw CVSS alone. Add Semgrep or CodeQL as a required check. Turn on compiler hardening: -fstack-protector-strong, -D_FORTIFY_SOURCE=2 (needs -O1 or higher), -Wl,-z,relro,-z,now, -fPIE -pie on Linux; /GS /guard:cf /DYNAMICBASE /NXCOMPAT on Windows. Scan for committed secrets with gitleaks or trufflehog and rotate anything found. Track EOL runtimes and libraries as first-class work items, because an unsupported component is a permanent, unpatchable finding.

Failure modes to watch.

  • Characterization tests that encode a bug as correct. You lock in the vulnerability and the test now defends it. Detect by reviewing each new assertion against the security intent, not just against current behavior.
  • A canary that passes because it saw no traffic. The change looks safe because the path was never exercised. Detect by asserting the canary actually hit the changed code path, not just that error rates stayed flat.
  • Deferrals with no expiry. Exceptions age forever and the risk silently becomes permanent. Detect with an exception-age metric; anything past its expiry blocks the next release.
  • Rollback that was never rehearsed. You discover the rollback is broken during the incident. Detect by running rollback in staging on every release, not just documenting it.

When not to do this. If the product cannot be made acceptably supportable (the runtime is dead, the architecture cannot isolate tenants) stop promising indefinite patches and plan a transparent migration or retirement. Continuing to ship on a foundation you cannot secure is the debt, not the fix.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-5

Create a coordinated vulnerability disclosure and response program.

Answer

What I'd say in the first two minutes

Assume I'm the vendor: I ship a product, I run a security@ mailbox, I have legal counsel, and I release quarterly plus emergency hotfixes. I'm not yet a CNA. The job is to run disclosure and response as one program, not two: a report that never reaches a shipped fix is a press release, and a fix nobody can act on is a ticket closure.

Build it against ISO/IEC 29147 (vulnerability disclosure) and ISO/IEC 30111 (vulnerability handling). Those are the two standards enterprise customers and auditors ask about, and they map onto four loops that feed each other: intake, handling, coordinated disclosure, and a retrospective that changes the product.

LoopConcrete commitmentArtefact it produces
Intake/.well-known/security.txt per RFC 9116, PGP key, auto-ack in 1 business hour, human reply in 2 business daysTracking ID, reporter contact, published scope and safe-harbor text
HandlingReproduce in a lab within 5 business days; CVSS v3.1 vector plus a written rationaleRoot cause, affected versions/configurations, sibling-product check
DisclosureCVE via your CNA or MITRE; advisory 14 days after the patch ships, or at 90 days, whichever comes firstAdvisory with impact, detection, mitigation, fixed version, credit
FeedbackBlameless retro within 30 days of closureA requirement, test, or dependency change with a named owner

A worked timeline. Day 0: report lands encrypted, auto-ack fires. Day 2: reproduced in the lab, CVSS 8.1 (AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H), confirmed to the reporter with a proposed disclosure date and a credit offer. Day 10: root cause is a missing authorization check; two sibling services share the pattern. Day 30: fix merged with a regression test that fails on the old code. Day 45: patch ships, CVE requested. Day 59: advisory published. The 14-day grace, so downstream integrators hear it from us, not from a scanner. Day 90: the backstop. If no patch exists by then, we disclose with mitigations and say plainly that no fix is available.

Trade-offs. Coordinated disclosure is the default: an agreed window, with 90 days as the ceiling and a written justification required to extend it. Full disclosure is the lever when a vendor stalls: it's what makes the deadline credible. Private-only is the wrong choice when users can't assess their own risk without knowing, or when the vendor has no commercial incentive to fix (abandoned products, end-of-life firmware). Say which one you're running and why.

Failure modes, with detection. Reporters ghosted: watch median time-to-first-human-reply; past 2 business days they go to social media instead. Downstream surprised: count partners who learned from the advisory rather than from you. Any nonzero is a coordination bug. Indefinite embargo: track the age of the oldest open embargo; past 90 days without written justification is a policy breach. CVSS-only triage: if a customer can't derive "upgrade now" versus "schedule it" from the advisory text, the score isn't doing the work.

Why safe harbor matters. Researchers decide whether to report based on legal exposure. DOJ's 2022 CFAA charging policy says good-faith research shouldn't be prosecuted, but that's prosecutorial discretion, not a defense: your own safe-harbor statement and a scope that admits what you don't control (third-party components) are what actually produce reports.

Patch adoption is the real clock. At 3% of installs updating per week, half the fleet is still exposed after ~23 weeks (0.97ⁿ = 0.5). That's why mitigation guidance ships with the fix, and why CVSS or a CVE record is never the whole customer decision.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-18

Respond to a compromised build or release pipeline.

Answer

First 60 seconds. Declare an incident, freeze promotions, and preserve evidence before rotating anything. The deciding criterion is whether the pipeline identity can write to production: if it can, contain first, revoke the deploy identity, because a malicious artifact landing in prod is worse than losing the attacker's live session logs. If it can only build internally, snapshot first; you have a short window before log retention or runner teardown eats the evidence. Then scope by digest, not by tag, rebuild from source, re-sign, verify provenance, deploy.

Containment, in order

  1. Freeze: gh workflow disable release.yml, and set the deployment environment to require manual approval. Disable scheduled and workflow_run triggers too: those fire without a human.
  2. Revoke the deploy identity, not "all secrets": the OIDC trust policy (AWS sts:AssumeRoleWithWebIdentity subject claim, GCP workload identity provider attribute condition), GitLab CI_JOB_TOKEN, registry push credentials, and any long-lived deploy key. GITHUB_TOKEN dies with the job, so it is not the lever.
  3. Snapshot: git bundle create evidence.bundle --all, git ls-remote origin > refs.txt, CI logs, runner image digest, registry manifest.
ActionCommandEvidence cost
Freeze promotionsgh workflow disable release.yml; environment approvalin-flight runs lost
Snapshot refs + objectsgit bundle create evidence.bundle --all; git ls-remote origin > refs.txtnone
Snapshot registrycrane manifest $IMAGE > manifest.json; cosign tree $IMAGEnone
Revoke deploy identityedit AWS trust policy / GCP WIF attribute condition; rotate registry credsmay cut the attacker's live session

Evidence that decides scope

Shell
# 1. Does the commit the artifact claims to come from exist?
git cat-file -e "$SRC_SHA^{commit}" && echo "commit exists" || echo "MISSING - forged provenance"

# 2. Hidden refs: PR refs, replace refs, notes
git ls-remote origin | grep -E 'refs/(pull|merge-requests|replace|notes)/'
git for-each-ref refs/replace/ refs/notes/

# 3. Dangling objects the attacker left behind
git fsck --unreachable --no-reflogs 2>/dev/null | head

# 4. What the registry actually holds
crane digest "$IMAGE"          # or: docker buildx imagetools inspect "$IMAGE"
cosign tree "$IMAGE"           # signatures + attestations attached

Trace: git cat-file -e exits 0 if the object is present, 1 if not. A build whose provenance names a commit that returns 1 is forged, or the repo was rewritten: that is the smoking gun. git ls-remote on GitHub shows refs/pull/1234/head; a commit reachable only from a PR ref will not appear in git log --all on a normal clone, which is exactly where an attacker parks a payload. refs/replace/ is not fetched by a default clone either.

Verify the artifact, don't trust the name

Shell
cosign verify "$IMAGE" \
  --certificate-identity-regexp '^https://github\.com/acme/api/\.github/workflows/release\.yml@refs/heads/main$' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

cosign verify-attestation "$IMAGE" \
  --type https://slsa.dev/provenance/v1 \
  --certificate-identity-regexp '^https://github\.com/acme/api/\.github/workflows/release\.yml@refs/heads/main$' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Since cosign v2.0 the identity flags are mandatory; a bare cosign verify that only checks "signed by someone" is the check that lets a re-signed artifact through. Fulcio certs live 10 minutes, so the binding is the SAN's workflow path and the issuer, not the key.

Failure modes

  • Rotating secrets without rebuilding the runner: the attacker re-enters through a poisoned dependency or cached layer. GitHub Actions caches are scoped per branch, capped at 10 GB/repo, evicted after 7 days idle, so a PR cannot write into main's cache scope directly. The real vector is pull_request_target or workflow_run checking out fork code with a write token and secrets. Detect by diffing SBOMs between the last known-good build and the rebuild.
  • Trusting CI logs: with runner access the attacker edits the log stream. Cross-check CloudTrail AssumeRoleWithWebIdentity events or GCP audit logs for the WIF provider, and Rekor, which is append-only: rekor-cli search --sha <digest> returns the log index, rekor-cli get --log-index <n> returns the entry and inclusion proof.
  • Re-signing an artifact you cannot explain: a valid signature over a malicious artifact is still malicious. Signature validity is not build integrity.

Recovery. Rebuild from a clean checkout on a fresh runner, re-sign with a new identity, verify SLSA Build L2+ provenance (L3 if the build platform is hardened and isolated), deploy, and watch for recurrence. Post-incident: replace pull_request_target with pull_request plus permissions: contents: read (the default for repos created since Feb 2023), pin actions by SHA, and reject unsigned or wrong-identity images at admission. GitHub Actions logs default to 90 days retention (1–400 configurable on private repos) and GitLab artifacts to 30 days, if your window is shorter than your investigation, that is the first thing to fix.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-23

Measure secure-SDLC effectiveness and resist metric gaming.

Answer

The 90-second answer

Assume you cannot trust any security metric whose denominator you did not establish yourself. So the first measurement is the inventory: how many products, repos and releases exist, and how confident you are that the list is complete. Report the missing count as its own number, not as a smaller denominator. If you know of 1,200 repos and your inventory confidence is 92%, roughly 96 repos are invisible, and "98% of repos scanned" is really about 90% of the estate. That one arithmetic move kills most gaming, because the cheapest way to raise a coverage percentage is to delete things from the bottom.

Then measure coverage of the practices that block the attack paths you actually modelled: threat-model and requirements coverage on high-risk paths, protected build and provenance coverage, test freshness and negative-fixture performance, secure-default adoption, and how much unsupported surface is still reachable. Then measure outcomes you cannot self-report: escaped defects by severity and recurrence, exploitation, customer harm, and time-to-fix distributions rather than averages. Segment all of it by product, technology, deployment model and risk tier, and report missing inventory rather than shrinking the denominator.

Why each metric resists gaming

MetricHow it gets gamedCounter-metric that closes the hole
Scan coverageShrink the denominator; scan generated codeInventory confidence and missing-repo count reported separately
Findings closedClose without retest; bulk-close as "risk accepted"Failed-retest count; exception age distribution
Training completionClick-throughNegative-fixture pass rate on the team's own code
SBOM row countEmit rows for transitive noiseShare of components with a resolved, current version
Time to fixReset the clock on reassignmentAge from first detection, not from ticket open

Worked check (hypothetical figures)

A program reports 96% patch coverage. Pull the inventory: 1,200 repos at 92% confidence means 96 unknown. Of the 1,104 known, 40 are archived but still deployed. Real denominator 1,144, real coverage 92.6%. Then pull exception age: 30% of "closed" findings are exceptions older than 180 days with no owner. The dashboard said 96%; the defensible number is closer to 65% of the estate with a current, owned fix. That gap is the finding, and it is the thing you take to leadership.

Trade-offs, and when this is wrong

Every security metric costs developer time to produce and to argue about. Pair each security outcome with a friction number (false-block rate, developer hours, release delay, update failure, accessibility) or teams will optimise the security number by making the control unusable, and you will get shadow pipelines. If you are three engineers pre-product-market-fit, this program costs more than the risk it manages; measure escaped defects and incident review only. If you are under PCI DSS or FedRAMP, the coverage metrics are the audit, so you cannot drop them even when they are gamed: you add the counter-metrics instead.

Failure modes

Gaming shows up as denominator shrinkage, exception aging, retest theatre, and silence: no findings because reporting is punished. Detect it by sampling automated evidence against manual review, and by comparing what reviews, red teams, external researchers, incidents and customer reports each found; the blind spots are where one source is silent. Track validation, fix, advisory and update-adoption time separately, because a fast fix with slow update adoption is still exposure. The cost of a gamed metric is a green dashboard over a real hole, discovered by an attacker.

Use distributions and narratives, protect disclosure and learning incentives, and tie leadership decisions to systemic remediation rather than to the score.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-16

Run a secure-SDLC program across many teams and technology stacks.

Answer

I would not run one program across six stacks. I would run one tiered control catalog, per-stack paved roads, and evidence collected in CI, and leave risk ownership with the product teams.

Assume 300 engineers, ~120 services, six stacks (JVM, Go, Python, Node, one .NET team, a data platform), and a compliance obligation that names NIST SSDF (SP 800-218).

Tier by consequence, not by team

Three tiers. Tier 1 is the customer-data or payment path: call it 15 services. Tier 2 is internal but reachable: maybe 60. Tier 3 is the rest. Tier 1 gets the full set: threat model per material change, two approvers via CODEOWNERS, SAST (CodeQL or Semgrep) blocking on new high findings, dependency scanning (Dependabot or Renovate) with a 7-day SLA for criticals, build provenance at SLSA Build Level 3 signed with Sigstore/cosign, a CycloneDX SBOM per release, and a documented rollback. Tier 2 gets the same controls advisory rather than blocking, and a 30-day critical SLA. Tier 3 gets dependency and secret scanning only.

The catalog maps to SSDF practices: PO for ownership, PS for producing well-secured software, PW for the build, RV for vulnerability response, so the compliance story is a mapping table, not a second program.

Paved roads

Each stack gets a reference pipeline a team can adopt in an afternoon: a reusable GitHub Actions workflow or GitLab CI include that runs the scanners, uploads SARIF, and fails the build on that tier's policy. Owned like a product: named maintainer, a p95 pipeline-time budget, a support channel. If the paved road is slower or flakier than skipping it, teams route around it and you have lost.

Who owns what

Product teams own their risk and their exceptions. Security champions (one per team, roughly 10% time, not a full-time role) do enablement. Central security does threat modeling for Tier 1 designs, incident response, and shared controls (secret management, signing infrastructure, the scanner fleet). Central does not do per-team reviews; that stops scaling somewhere around 20 teams.

Tier table (hypothetical numbers, tuned to the org)

TierServicesReviewSASTCritical SLAProvenanceSBOM
1~152 approvers, CODEOWNERSblocking7 daysSLSA L3, cosignper release
2~601 approveradvisory30 daysSLSA L2per release
3~451 approveroff90 daysnonequarterly

Exception arithmetic

If 120 services each file 2 exceptions a year at 90 days average age, that is 240 open exceptions at steady state. One reviewer cannot hold that. So exceptions expire by default, need a named owner and a compensating control, and anything past 90 days escalates to the engineering director. Track exception age, not exception count.

Failure modes and how you see them

  • Exception rot: median age trending up. Cap at 90 days.
  • Champion burnout: champion tenure under 6 months.
  • Evidence theater: dashboards read 100% because teams self-report. Re-run the scanner on 10 random repos a quarter and compare.
  • Tool sprawl: five scanners, nobody reads the output. Consolidate to one SAST, one SCA, one container scanner.

Prioritization

Rank fixes by EPSS and the CISA KEV catalog, not raw CVSS. A CVSS 9.8 in a library you never call is not the same as a CVSS 7.5 on the KEV list. Escaped defects and incidents set next quarter's roadmap.

First 90 days

Inventory repos and teams so unknown coverage is visible. Ship the paved road for the two highest-consequence stacks. Publish the tier table and the exception policy. Then measure adoption, time to remediate criticals, exception age, and developer friction: pipeline p95 and false-positive rate.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-22

Plan product security end of life and decommissioning.

Answer

Assume a commercial product with deployed devices, a signing/update chain, and contractual support commitments. The core answer: EOL is a trust-transfer problem, not a date announcement. You retire four things in a fixed order (support obligations, update trust, data, and customer dependencies) and the critical path is the update trust chain. If you revoke a signing key before every customer has a verified replacement, you strand every deployed device that tries to verify a patch. So the first move is not picking a date; it's inventorying what you owe and what your own infrastructure is part of the product's trust chain.

Phase 0: Inventory and classify. Use an SBOM in SPDX or CycloneDX to know what's actually deployed. Map each version to customers, contracts, and regulatory regimes. A medical device under FDA premarket cybersecurity guidance carries different obligations than a consumer IoT device under the EU Cyber Resilience Act. For automotive, UNECE R155/R156 adds type-approval conditions.

Phase 1: Notice. Distinguish four dates: sales end, feature support end, security support end, and service shutdown. Communicate through channels users actually receive: in-product banners, email to registered owners, security advisories, distributor bulletins. Microsoft publishes these dates years ahead on its lifecycle page; Ubuntu publishes ESM dates. A 90-day notice is not enough for a 10-year deployed device. For security support end, 12–24 months is the working range, and the clock starts when you publish the date, not when you announce it internally.

Phase 2: Migration and exit tools. Provide maintained migration paths, data export in a documented format, compatibility shims, and a deletion verification tool. For customers who cannot move, give a risk statement: which CVEs will remain unpatched, what compensating controls they can apply (network isolation, allowlisting), and what you will and won't do.

Phase 3: Final fixes and preservation. Ship committed final fixes. Preserve advisories, version documentation, and CVE records. CVE IDs are never reused; NVD and OSV keep the record. Withdrawing a product does not withdraw the CVE: you update it to "won't fix" or "end of life."

Phase 4: Trust teardown. This is where teams get it wrong. You have signing keys, repository credentials, build service accounts, and support portal access. Revoke them under a documented trust plan. The plan must answer: how will a customer verify a historical artifact after the key is revoked? If you use a timestamping authority (RFC 3161) or a transparency log (Rekor in Sigstore), verification can outlive the key. If you just delete the key, you break verification of every artifact ever signed. NIST SP 800-193 covers platform firmware resiliency, including recovery and key revocation.

Phase 5: Data deletion and proof. Delete or return data and backups per contract and regulation: GDPR Article 17, HIPAA retention. Prove shutdown with a signed attestation, a final audit log, or a certificate of destruction.

Phase 6: Residual monitoring. Monitor for residual use and exploitation. Detection comes from update-server telemetry (if still running), customer reports, CVE feeds, and researcher disclosures. If you see exploitation of an EOL product, you decide: emergency patch, public advisory, or legal escalation. One unpatched RCE in a deployed medical device can trigger a recall.

Tradeoffs: When is a longer support tail the wrong call? When the cost of maintaining the old branch exceeds the risk reduction, or when the old architecture cannot be made secure without a rewrite. Deciding criteria: number of active devices, safety impact, regulatory exposure, and whether a compensating control exists. If 95% of devices have migrated and the remaining 5% are air-gapped, a hard cutoff with a documented risk statement is defensible. If 40% are in hospitals, you extend.

Failure modes with detection:

  • Revoking signing keys before customers have the new trust root. Detection: customer support tickets about failed updates. Cost: bricked devices, emergency re-signing.
  • Announcing EOL only via a blog post. Detection: low migration rates, customer surprise at shutdown. Cost: forced extensions, reputational damage.
  • Deleting data before contractual retention expires. Detection: legal hold, audit finding. Cost: fines, litigation.
  • Leaving update servers running without patches. Detection: exploitation of the update server itself. Cost: supply-chain compromise.

Worked example (hypothetical): A firmware product with 50,000 deployed units. Support ends 2027-06-30. Plan: 2025-01-01 publish lifecycle page; 2025-06-30 last feature release; 2026-06-30 last security patch; 2026-12-31 update server read-only; 2027-06-30 signing key revoked after timestamping authority migration; 2027-12-31 data deletion attestation. If you skip the timestamping migration, every device that tries to verify a 2026 patch after 2027-06-30 fails.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-25

Lead an end-to-end secure-SDLC architecture and process review.

Answer

Assumptions I'd state up front. I have read access to repos, CI config, registries, cloud control planes and the ticketing system; six to eight weeks; and no authority to fix anything. My output is a ranked gap list with owners, not a remediation project. Without that access this is a document audit, and I'd say so before starting.

The review has three moves. Pick three to five products carrying the most customer consequence (payments, auth, anything touching regulated data) and walk one real change through the whole lifecycle. Then attack the controls instead of reading them. Then rank findings by consequence times systemic reach, because a gap in one team's pipeline is a finding and a gap in the shared build platform is a program-level risk.

I don't start from a framework. NIST SSDF SP 800-218 and OWASP SAMM are useful as a coverage checklist at the end, to catch a practice I forgot to look for. Starting from them produces a maturity score, not a risk picture.

The walk. Take a one-line dependency bump in the payments service and follow it:

  1. Dependabot opens the PR. Is there a CODEOWNERS entry that actually gates merge, or is it advisory?
  2. CI runs Semgrep for SAST and Trivy against the lockfile. I check coverage, not results: how many repos have the scanner wired in? In a 400-repo org I'd expect well under half, and the missing ones are usually the oldest and the most privileged.
  3. The build runs in GitHub Actions with OIDC to the cloud, so no long-lived keys. I verify by hunting static cloud keys: IAM Access Analyzer plus a secret scan finds them.
  4. The image is signed with cosign and the attestation lands in Rekor. Then I check the admission controller: is the signature policy in enforce or audit mode? Audit mode is the finding I'd expect most often: the control exists, the dashboard is green, nothing is blocked.
  5. Deployment via Argo CD. Does the manifest pin the base image by digest or by tag? Tag means the artifact that ran is not the artifact that was signed.

The same walk down the emergency path is where the real gap usually sits: the break-glass release that skips signing, and the exception ticket that expired two years ago and nobody closed.

Trade-off. Depth versus breadth. A full trace of one product takes about a week, so four or five fit in six weeks. The alternative, a questionnaire across all forty products, gives coverage but self-reported answers, and self-reported answers are what an attacker disproves. I'd use the questionnaire only for the low-consequence tier.

TierExampleDepthEvidence I'd accept
Customer-facing, regulated datapayments APIfull trace + adversarial testsSLSA Build L3 provenance, signature verified in enforce mode, SBOM per release
Customer-facing, no regulated datamarketing sitetrace one changeSBOM, OpenSSF Scorecard ≥ 7
Internal, network-reachableadmin consolecontrol spot-checkSSO, no static keys
Internal, isolatedbuild cachequestionnaireScorecard run

Two failure modes to name. Evidence theater: dashboards showing full scan coverage while the scanner runs on the default branch only, leaving the release branch unscanned. And self-attested provenance: SLSA Build Level 1 provenance is generated by the build itself and can be forged; Level 3 requires a hosted, isolated builder with non-falsifiable provenance, and that's the line worth drawing.

What I hand back: gaps ranked by consequence and systemic reach, each with an owner and a retest date, plus an explicit statement of what I did not cover. If I traced four products out of forty, the assurance is bounded to those four: the residual risk is the untraced thirty-six, and that's the number the sponsor needs to see.

Curated: · Written: · Reviewed:

Difficulty: Hard