DevOps 安全實踐 DevSecOps

DevOps 2025-01-02T10:00:00.000Z

DevOps 安全實踐 DevSecOps

DevSecOps 將安全融入 DevOps 流程,讓安全不再是部署前的最後一道關卡。

安全左移(Shift Left Security)

  1. Commit 前:pre-commit hooks 檢查 Secret
  2. CI 階段:靜態分析(SAST)、依賴掃描
  3. Build 階段:容器映像檔漏洞掃描
  4. Deploy 階段:動態掃描(DAST)

容器漏洞掃描

trivy image myapp:latest
grype myapp:latest
docker scout cves myapp:latest

Secret 管理

gitleaks detect --source .
sops -e -i secret.yaml

最佳實踐

  • 定期輪替密鑰與 Token
  • 使用最小權限原則
  • 啟用稽核日誌
  • 定期進行滲透測試