Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload GitHub Dependency Snapshot been skipped when passing exit-code parameter #232

Closed
abriko opened this issue May 10, 2023 · 7 comments
Closed

Comments

@abriko
Copy link
Contributor

abriko commented May 10, 2023

Workflow settings:

---
name: Pull Request
on:
  push:
    branches:
    - master

## GITHUB_TOKEN authentication, add only if you're not going to use a PAT
permissions:
  contents: write

jobs:
  build:
    name: Checks
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
        uses: aquasecurity/trivy-action@master
        with:
          format: 'github'
          output: 'dependency-results.sbom.json'
          exit-code: '1'
          severity: 'CRITICAL,HIGH'
          image-ref: ${{ env.IMAGE_NAME }}
          github-pat: ${{ secrets.GITHUB_TOKEN }}
SCR-20230510-mrug

If remove exit-code: '1' we can see upload successfully.
SCR-20230510-mtgw

@abriko
Copy link
Contributor Author

abriko commented May 10, 2023

Try enhanced #233

@simar7
Copy link
Member

simar7 commented May 31, 2023

Sorry but I don't understand what's the motivation and the desired goal here. Could you help me to better understand what you are looking to achieve?

@abriko
Copy link
Contributor Author

abriko commented Jun 2, 2023

Hey @simar7

Problem is when pass exit-code and turn on upload result to Dependency Graph, if exit-code is non-zero the entrypoint.sh will fail, and will never upload result. because the script turn on exit when fail in beginning.

My idea is to temporarily turn off script fail when executing scan, to ensure upload successfully.

@simar7
Copy link
Member

simar7 commented Jun 2, 2023

Got it. Thanks for explaining. But will this change now result in a workflow that will pass rather than fail (as non zero exit code)?

Trivy action should fail if there's a problem, either vulnerability, misconfig, etc. But what you have said is also a legitimate request that I think we should handle differently, rather than passing the workflow.

Thoughts?

@abriko
Copy link
Contributor Author

abriko commented Jun 3, 2023

Hey @simar7

My enhancement just temporarily disable script fail, in final of script will exit with trivy return code. this part is already covered in original design.
You can see here and here.

So the workflow will still fail if you have some findings.

@simar7
Copy link
Member

simar7 commented Jun 5, 2023

I see, I understand now. Thanks for explaining.

@simar7
Copy link
Member

simar7 commented Jun 5, 2023

Closed with #233

@simar7 simar7 closed this as completed Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants