如何解决Azure DevOps 存储库中的秘密扫描器
您能否推荐一种高效的扫描器,用于查找 Azure DevOps 存储库和管道中的代码秘密?希望能够在提交时或在接受推送之前进行本地扫描,并定期扫描存储库和管道。但是,对于如何以其他方式扫描机密的建议持开放态度。
解决方法
您可以查看this blog中提到的秘密扫描仪。
例如 AWS 实验室发布的 Git Secrets。您可以将它安装在本地机器上以扫描本地提交和非快进合并。见--install command
在 azure 管道中使用 'wah'
扫描 azure devops 存储库。您可以查看以下步骤:
2、如果您想在微软云代理上使用扫描仪。您需要在管道中的云代理机器中安装这些扫描器工具。请参见以下示例:在云代理上使用 Git Secrets
。
在您的管道中添加脚本任务以在云代理上安装 Git Secrets
:
Git Secrets
您也可以在安装了steps:
- powershell: |
#clone git-secrets repo in $(Agent.TempDirectory) folder
cd $(Agent.TempDirectory)
git clone "https://github.com/awslabs/git-secrets.git"
cd git-secrets
#install git-secrets
./install.ps1
cd $(System.DefaultWorkingDirectory)
# Installs git hooks for source repository
git secrets --install
#Adds a prohibited pattern
git secrets --add --literal 'iamthesecrecttoscan'
#Scans for secrets
git secrets --scan
displayName: 'PowerShell Script'
(或安装了其他扫描仪工具)的机器上创建self-hosted agent。然后,当您在此自托管代理上运行管道时,您可以直接在管道中使用扫描器,而无需在管道中安装它。
3、定期扫描仓库和管道
您可以在管道中使用 scheduled triggers 定期扫描您的存储库。
Git Secrets
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。