GitHub 和 npm 近期推出了一系列安全防护措施,针对开源项目的供应链攻击[1]。这些措施覆盖账户保护、工作流安全、凭证管理等多个环节,旨在切断攻击链条,防止恶意软件传播和凭证泄露[1]。
在账户层面,npm 高影响力账户在更改电子邮件或使用双因素认证恢复代码时将被锁定为只读模式,持续 72 小时[1]。npm 受信任发布功能进一步扩展,已支持 CircleCI 平台[1]。此外,npm v12 版本将默认禁用安装时脚本执行[1]。
GitHub Actions 的防护同步推进。checkout 操作已改变默认行为,防止从分支中签出不受信任的代码[1]。npm 分阶段发布机制要求在发布包至注册表前获得额外批准并完成双因素认证[1]。Dependabot 版本更新功能对新发布的包引入了默认三天冷却期[1]。凭证层面,GitHub 提供了自助凭证撤销功能供事件响应使用[1],凭证撤销 API 支持已扩展至 GitHub OAuth 和应用令牌[1]。
GitHub and npm have introduced a comprehensive suite of security measures over recent months to counter supply chain attacks targeting open-source projects [1]. These initiatives aim to disrupt multiple points in the attack chain, reducing both malware propagation and credential compromise risks [1].
The protective measures span account security, workflow defaults, and release controls. High-impact npm accounts now enter a 72-hour read-only mode when changing email addresses or using two-factor authentication recovery codes [1]. GitHub Actions checkout functionality has shifted its default behavior to prevent untrusted code from being executed when pulled from repository forks [1]. npm has expanded trusted publishing support to include CircleCI [1], while staged releases now require additional approvals and two-factor authentication before packages reach the registry [1]. Additionally, npm version 12 will disable installation-time scripts by default [1], and Dependabot version updates now apply a three-day hold period before automatically updating newly released packages [1].
Credential management capabilities have also expanded. GitHub now offers self-service credential revocation for incident response purposes [1], with the revocation API extended to support GitHub OAuth and application tokens [1]. Together, these changes create layered friction against attackers attempting to compromise the open-source software supply chain.