我正在构建一个为第三方服务提供 API 的开源库。在此期间,我正在学习测试、git-flow 和持续部署,并遇到了一个与保护开源项目的环境变量相关的问题。
我目前已经通过 travis cli 生成了 secret 环境变量:travis encrypt key=value
,用于自动化系统测试。
在将更新推送到功能分支或拉取请求时,注意到测试由 travis ci 自动运行,这非常棒。但我开始想知道是什么保护我免受恶意收集 process.env
对象并将其推送到外部对象的拉取请求,从而泄露我宝贵的环境变量。
如何真正确保环境凭据(例如 API 凭据)在 travis ci 中受到保护以进行系统测试?
我应该创建系统测试吗?还是应该伪造对外部服务的请求?
最佳答案
Travis CI 文档说:
For the protection of secure data, Travis CI makes it available only on pull requests coming from the same repository. These are considered trustworthy, as only members with write access to the repository can send them.
Pull requests sent from forked repositories don’t have this data available in their builds. All data that’s considered confidential will not be added to the build’s environment.
https://docs.travis-ci.com/user/pull-requests#Security-Restrictions-when-testing-Pull-Requests
关于node.js - 在用于系统测试的开源项目中保护 travis ci 环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37731595/