Title: Trivy ScanType breaks when scanning anything other than images · Issue #796 · secureCodeBox/secureCodeBox · GitHub
Open Graph Title: Trivy ScanType breaks when scanning anything other than images · Issue #796 · secureCodeBox/secureCodeBox
X Title: Trivy ScanType breaks when scanning anything other than images · Issue #796 · secureCodeBox/secureCodeBox
Description: 🐞 Bug report In addition to scanning docker images, trivy can also can software repos, filesystems, etc. However, this does not work with the SCB integration due to the way that SCB handles parameters. Describe the bug SecureCodeBox para...
Open Graph Description: 🐞 Bug report In addition to scanning docker images, trivy can also can software repos, filesystems, etc. However, this does not work with the SCB integration due to the way that SCB handles paramet...
X Description: 🐞 Bug report In addition to scanning docker images, trivy can also can software repos, filesystems, etc. However, this does not work with the SCB integration due to the way that SCB handles paramet...
Opengraph URL: https://github.com/secureCodeBox/secureCodeBox/issues/796
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Trivy ScanType breaks when scanning anything other than images","articleBody":"## 🐞 Bug report\r\nIn addition to scanning docker images, trivy can also can software repos, filesystems, etc. However, this does not work with the SCB integration due to the way that SCB handles parameters.\r\n\r\n### Describe the bug\r\nSecureCodeBox parameterizes the docker container of trivy as follows:\r\nhttps://github.com/secureCodeBox/secureCodeBox/blob/cdc97324c75ae4c7e646730344420edfebe50b01/scanners/trivy/templates/trivy-scan-type.yaml#L29-L36\r\n\r\nWhen replicated locally, this results in:\r\n```bash\r\ntrivy --no-progress --format json --output /home/securecodebox/trivy-results.json $PARAMS\r\n```\r\n(where `$PARAMS` is any additional parameters as specified in the Scan definition).\r\n\r\nThis works fine for scanning a docker image from the repositories (the default behavior). However, when trying to scan a VCS repo, you need to use `trivy repo $PARAMS...`, when scanning a file system `trivy fs $PARAMS`. Any parameters given before the `repo`, `fs` etc. are silently ignored by trivy. Thus, any ScanSpec that utilizes these modes will effectively strip the `--no-progress --format json --output /home/securecodebox/trivy-results.json` from the command, leading to the parser failing to run properly.\r\n\r\nExample Scan to reproduce:\r\n```yaml\r\napiVersion: \"execution.securecodebox.io/v1\"\r\nkind: Scan\r\nmetadata:\r\n name: \"trivy-breakage\"\r\nspec:\r\n scanType: \"trivy\"\r\n parameters:\r\n - \"repo\"\r\n - \"https://github.com/secureCodeBox/secureCodeBox\"\r\n```\r\n\r\nThis will result in the parser failing to find a result, and the pod logs showing the ASCII output of trivy.\r\n\r\n### Workaround\r\nYou can work around this issue by specifying the missing parameters again in the Scan definition, **after the `fs`/ `repo` but before the target** (specifying them after the target will _also_ break the trivy parameter parser, it seems).\r\n\r\n```yaml\r\napiVersion: \"execution.securecodebox.io/v1\"\r\nkind: Scan\r\nmetadata:\r\n name: \"trivy-breakage\"\r\nspec:\r\n scanType: \"trivy\"\r\n parameters:\r\n - \"repo\"\r\n - \"--no-progress\"\r\n - \"--format\"\r\n - \"json\"\r\n - \"--output\"\r\n - \"/home/securecodebox/trivy-results.json\"\r\n - \"https://github.com/secureCodeBox/secureCodeBox\"\r\n```\r\n\r\nI am not sure if there is anything we can do about this aside from putting a warning into the docs, so I have labelled this as both a bug and a documentation issue. If anyone has an idea, let me know, otherwise I'll update the docs as part of the change introduced in #777.","author":{"url":"https://github.com/malexmave","@type":"Person","name":"malexmave"},"datePublished":"2021-11-06T12:35:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/796/secureCodeBox/issues/796"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4032f1a1-603b-fc76-25c2-8c0ed036d6a5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E9D8:176BA4:A9CA32:DE6892:6991F58C |
| html-safe-nonce | 665418c690e3bf07c5a352cb6064a7adad1a7ccf7aad84416cfc1fe3f5d90ebf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOUQ4OjE3NkJBNDpBOUNBMzI6REU2ODkyOjY5OTFGNThDIiwidmlzaXRvcl9pZCI6IjY2Mzc4MTg0NjM5MjE1MDE1ODAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b0a464feb0bf1d5bdac0c392293da3b7122bdc11fa08b677db3bda077d79eeba |
| hovercard-subject-tag | issue:1046500357 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/secureCodeBox/secureCodeBox/796/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d4663b7675bec7cb38e4be97da3896635102c79d89d7f673f18f141e577c9d11/secureCodeBox/secureCodeBox/issues/796 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d4663b7675bec7cb38e4be97da3896635102c79d89d7f673f18f141e577c9d11/secureCodeBox/secureCodeBox/issues/796 |
| og:image:alt | 🐞 Bug report In addition to scanning docker images, trivy can also can software repos, filesystems, etc. However, this does not work with the SCB integration due to the way that SCB handles paramet... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | malexmave |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/secureCodeBox/secureCodeBox git https://github.com/secureCodeBox/secureCodeBox.git |
| octolytics-dimension-user_id | 34573705 |
| octolytics-dimension-user_login | secureCodeBox |
| octolytics-dimension-repository_id | 80711933 |
| octolytics-dimension-repository_nwo | secureCodeBox/secureCodeBox |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 80711933 |
| octolytics-dimension-repository_network_root_nwo | secureCodeBox/secureCodeBox |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width