总结

在本章中,你学会了如何保护你的代码并管理你的依赖项:

  • 你了解了软件组成分析(SCA),并知道如何使用依赖图、Dependabot 警报和 Dependabot 安全更新来管理你的软件依赖。

  • 你学会了如何进行密钥扫描,以防止密钥泄露到源代码中。

  • 你了解了静态应用安全测试(SAST),并知道如何使用 CodeQL 或其他支持 SARIF 的工具进行代码扫描,在开发过程中发现问题。你现在能够编写自己的查询,以强制执行质量和编码标准。

在下一章,我们将讨论如何保护我们的发布流水线和部署。

进一步阅读

以下是本章中提到的参考资料,你可以用来获取更多关于这些主题的信息:

  • 如何通过删除一小段代码让一个程序员破坏互联网,Keith Collins(2016):https://qz.com/646467/how-one-programmer-broke-the-internet-by-deleting-a-tiny-piece-of-code/

  • Kik、Left-Pad 和 NPM——天哪!,Tyler Eon(2016):https://medium.com/@kolorahl/kik-left-pad-and-npm-oh-my-e6f216a22766

  • 每一步都要安全:什么是软件供应链安全,为什么它很重要?,Maya Kaczorowski(2020):https://github.blog/2020-09-02-secure-your-software-supply-chain-and-protect-against-supplychain-threats-github-blog/

  • 关于依赖图:https://docs.github.com/en/codesecurity/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph

  • 关于 Dependabot 版本更新:https://docs.github.com/en/codesecurity/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates

  • 关于密钥扫描:https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning

  • 关于 GitHub 高级安全:https://docs.github.com/en/get-started/learning-about-github/about-github-advanced-security

  • 关于代码扫描:https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning

  • CodeQL 代码扫描:安全警报的新严重性级别,GitHub 博客(2021):https://github.blog/changelog/2021-07-19-codeql-code-scanning-new-severity-levels-for-security-alerts/

  • 常见漏洞评分系统(CVSS):https://www.first.org/cvss/v3.1/specification-document

  • CodeQL 文档:https://codeql.github.com/docs/

  • QL 语言参考:https://codeql.github.com/docs/ql-language-reference