Trivy image scan on private ACR
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- azure, docker
- 领域
- cloud, documentation, security
调研方向
检查链接的 Trivy 环境变量文档以及 issue 中展示的 MicrosoftSecurityDevOps@1 配置,然后将其与可正常工作的 Bash@3 示例和报告的扫描器错误进行比较。完成的标准是:私有 ACR 场景、所需的环境变量以及任何任务支持限制都已得到清晰记录。
由索引模型根据 Issue 内容生成。
描述
Description
The current documentation for the MicrosoftSecurityDevOps@1 task does not include instructions on how to perform Trivy image scans on private Azure Container Registries (ACR). This functionality is crucial, as not all users build their images on VMs with Docker; many utilize containerized agents alongside the ACR build task for image creation. Despite Trivy's documented ability to scan remote/private container registries, the MicrosoftSecurityDevOps@1 task appears to only support scanning local image locations. This discrepancy has left me unable to configure the task to target a remote repository, even though I have successfully set up remote registry scanning using Trivy in a standalone configuration.
Problem Statement
Lack of documentation and apparent functionality for scanning images in private ACRs using the MicrosoftSecurityDevOps@1 task.
The task defaults to scanning local image locations, ignoring the capability of Trivy to scan remote/private container registries.
Importance
This issue is significant for workflows that rely on containerized agents and ACR build tasks for image creation, as it limits the usability of the MicrosoftSecurityDevOps@1 task for security scanning in such environments. Enabling this functionality would greatly enhance security measures for Azure DevOps pipelines that utilize private ACRs.
Expected Behavior:
Environement variable documentation should be more descriptive and informational on how to use it, because it is not clear what Envs to use to target a remote ACR.
- task: MicrosoftSecurityDevOps@1
displayName: 'Microsoft Security DevOps'
inputs:
command: 'run'
policy: 'microsoft'
tools: 'trivy'
env:
TRIVY_ACTION: 'image'
TRIVY_TARGET: 'image
TRIVY_AUTH_URL:
TRIVY_USERNAME:
TRIVY_PASSWORD:
TRIVY_IMAGE_SRC:
TRIVY_REGISTRY_TOKEN:
TRIVY_INPUT:
TRIVY_IMAGEPATH:
I've tried just about every mix of environment variables, even switching between uppercase and lowercase, to get remote scanning to work, but the documentation doesn't really help make sense of how to use Trivy's environment variables with this task. It looks like the task actually does support Trivy's own environment variables, which was a surprise since it's not mentioned anywhere in the docs. This makes setting everything up for remote scanning a bit of a guessing game.
The error encountered suggests a failure to recognize the remote image location, indicating an issue with how the task is configured to interact with private container registries. The task fails to initialize a scanner for the remote image, suggesting a possible misconfiguration or lack of support for scanning images located in private ACRs.
General Error Message:
Microsoft.Guardian.TrivyRedist_linux_amd64.0.45.0/tools/trivy image --exit-code 100 --format sarif --input <registryURL>/my-image:tag --output /agent/_work/1/s/.gdn/.r/trivy/001/trivy.sarif <registryURL>/my-image:tag
FATAL image scan error: scan error: unable to initialize a scanner: unable to initialize the archive scanner: 2 errors occurred:
* unable to open <remote image> as a Docker image: unable to open the file: open <remote image>: no such file or directory
* unable to open <remote image> as an OCI Image: stat <remote image>/index.json: no such file or directory
Working Behavior for standalone task
- task: Bash@3
displayName: 'Trivy scan - Generate report'
inputs:
targetType: 'inline'
script: |
trivy image --skip-db-update --exit-code 0 --severity LOW,MEDIUM,HIGH,CRITICAL registryURL/my-image:tag
env:
TRIVY_AUTH_URL: "https://registryURL"
TRIVY_USERNAME: "00000000-0000-0000-0000-000000000000" # Dummy username for ACR token authentication
TRIVY_PASSWORD: $(ACR_TOKEN)
I am getting the acr_token with acr login task like this:
az acr login --name ContainerRegistryName --expose-token --output tsv --query accessToken
Question is why this similiar setup does not work using the MicrosoftSecurityDevOps@1 task?
Could the documentation be updated to include this scenario, or could the task be enhanced to support this use case?
Has anybody else gotten this to work, in that case how?
- 主要语言
- TypeScript
- 星标
- 85
- 派生
- 22
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/security-devops-azdevops 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 68/100
-
Checkov's SoftFail not documented, working, and ignored by MSDO可能重新可做 @DimaBir 于 125 天前认领,目前没有进行中的 PR。 未关闭area:task area:tools status:waiting-on-author type:docs type:question
microsoft/security-devops-azdevops#169 · 1 条评论 · 已指派 1 人 ·
-
Which Defender CLI binary should be used in CI/CD pipelines — `aka.ms` or the DevOps CDN endpoint?未关闭
难度 5/5 一周以上 新手友好度 35/100
microsoft/security-devops-azdevops#166 · 2 条评论 · 1 个 reaction ·
-
Spec: Promote CKV_AZUREPIPELINES_* severity from note to warning可能已有人在做 @DimaBir 于 142 天前认领。 未关闭area:task area:tools status:team-review type:feature
microsoft/security-devops-azdevops#164 · 2 个 reaction · 已指派 2 人 ·
-
Checkov tool omits Azure Pipelines results可能重新可做 @DimaBir 于 145 天前认领,目前没有进行中的 PR。 未关闭area:task area:tools status:team-review type:docs type:feature
microsoft/security-devops-azdevops#163 · 17 条评论 · 已指派 1 人 ·
查看 microsoft/security-devops-azdevops 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug:new
难度 2/5 1-3 小时 新手友好度 76/100
callstackincubator/simlock#350 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
openwatersio/maritime-zones#33 ·
维护者通常 1 天内回复
-
Booking email verification fails for plus aliases with impersonation protection enabled可能已有人在做 @kankadev 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
calcom/cal.diy#30293 · 1 条评论 ·
维护者通常 5 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
AOSSIE-Org/DebateAI#611 ·
维护者通常 3 天内回复