πŸ”’ Security

Supply Chain Security

Software Supply Chain Security

πŸ“– Detailed Explanation

Software supply chain security (Supply Chain Security) is a security domain that prevents malicious code injection, dependency threats, and build system compromise across the entire process from software development to deployment. The SolarWinds (2020), Log4j (2021), and XZ Utils (2024) incidents highlighted its importance.

Supply chain attack vectors are diverse. They include dependency confusion, typosquatting, malicious maintainers, build server compromise, and theft of code signing keys. The compromise of a single library affects thousands of projects.

The defense strategy is multi-layered. It combines SBOM for component visibility, SLSA for build provenance verification, Sigstore for signature verification, Dependabot for managing vulnerable dependencies, and private registries for controlling dependencies.

On the regulatory side, the U.S. Executive Order 14028 and the EU Cyber Resilience Act mandate SBOM submission and supply chain security. Companies must respond to compliance requirements.

πŸ’» Code Example

# μ†Œν”„νŠΈμ›¨μ–΄ 곡급망 λ³΄μ•ˆ 체크리슀트 κ΅¬ν˜„

# 1. SBOM 생성 (Syft)
syft packages ghcr.io/myorg/myapp:latest -o spdx-json > sbom.json

# 2. 취약점 μŠ€μΊ” (Grype)
grype sbom:sbom.json --output json > vulnerabilities.json

# 3. μ˜μ‘΄μ„± 잠금 (package-lock.json, go.sum λ“±)
npm ci --ignore-scripts  # 슀크립트 μ‹€ν–‰ 없이 μ •ν™•ν•œ 버전 μ„€μΉ˜

# 4. λΉ„κ³΅κ°œ λ ˆμ§€μŠ€νŠΈλ¦¬ μ„€μ • (.npmrc)
registry=https://registry.myorg.com/
@myorg:registry=https://registry.myorg.com/

# 5. μ»¨ν…Œμ΄λ„ˆ 이미지 μ„œλͺ… (Cosign)
cosign sign --yes ghcr.io/myorg/myapp:latest

# 6. SLSA Provenance 검증
slsa-verifier verify-artifact myapp.tar.gz \
  --provenance-path myapp.tar.gz.intoto.jsonl \
  --source-uri github.com/myorg/myapp

# 7. Kubernetes μ •μ±… (Kyverno - μ„œλͺ…λœ μ΄λ―Έμ§€λ§Œ ν—ˆμš©)
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: require-signed-images
spec:
  validationFailureAction: Enforce
  rules:
    - name: verify-signature
      match:
        resources:
          kinds:
            - Pod
      verifyImages:
        - imageReferences:
            - "ghcr.io/myorg/*"
          attestors:
            - entries:
                - keyless:
                    issuer: "https://token.actions.githubusercontent.com"

# 8. CI νŒŒμ΄ν”„λΌμΈ λ³΄μ•ˆ (GitHub Actions)
# - μ΅œμ†Œ κΆŒν•œ 원칙 (permissions)
# - OIDC 토큰 μ‚¬μš© (id-token: write)
# - Dependabot ν™œμ„±ν™”
# - branch protection μ„€μ •

πŸ—£οΈ How It's Said in Practice

CISO: "During Log4j, it took us several days to figure out which of our services were affected. Without an SBOM, there is no supply chain visibility."

DevOps: "What should we do to automatically generate SBOMs and receive vulnerability alerts?"

CISO: "Generate the SBOM with Syft in CI, scan it with Grype, and manage it centrally with Dependency Track."

Interviewer: "Please explain your software supply chain security strategy."

Candidate: "I track all dependencies with an SBOM and verify build provenance with SLSA L3. I sign images with Sigstore and enforce signature verification with Kyverno. I control dependencies with a private registry and automatically patch vulnerabilities with Dependabot."

Take a mock interview on this topic β†’ WIA SOOM AI Interview Β· Start for free

Reviewer: "The version in package.json is specified with ^. That is vulnerable to supply chain attacks. Pin it to an exact version."

Author: "I'll apply npm shrinkwrap and commit package-lock.json."

⚠️ Cautions

πŸ“š Learn More