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

Sarif output has root:root permissions #283

Open
mikejgray opened this issue Nov 15, 2023 · 2 comments
Open

Sarif output has root:root permissions #283

mikejgray opened this issue Nov 15, 2023 · 2 comments

Comments

@mikejgray
Copy link

When outputting a trivy-results.sarif file, it has root:root permissions, which is likely because the Docker container that executes Trivy is running as root.

Steps:

      - name: Run Trivy vulnerability scanner
        uses: aquasecurity/trivy-action@master
        with:
          image-ref: ************.dkr.ecr.us-east-1.amazonaws.com/service:${{ github.sha }}
          format: sarif
          exit-code: "0"
          ignore-unfixed: true
          vuln-type: os,library
          severity: CRITICAL,HIGH
          scan-type: image
          output: trivy-results.sarif
          scan-ref: ""
      - name: Troubleshooting
        run: ls -lah
      - name: Upload Trivy scan results to GitHub Security tab
        if: always()
        uses: github/codeql-action/upload-sarif@v2
        with:
          sarif_file: trivy-results.sarif
      - name: Push Docker Image to ECR
        run: |-
          docker push ************.dkr.ecr.us-east-1.amazonaws.com/service:${{ github.sha }}
          docker push ************.dkr.ecr.us-east-1.amazonaws.com/service:latest

Output snippets:

Building SARIF report with options:  --exit-code  0 --ignore-unfixed --vuln-type  os,library  ***.dkr.ecr.us-east-1.amazonaws.com/merida:87e4cb552e20775a5f556b83de1bfdfad0e67641

Run ls -lah
total 296K
...snip...
-rw-r--r--  1 root   root   150K Nov 15 19:18 trivy-results.sarif

Error: codeql/upload-sarif action failed: Resource not accessible by integration

If the Docker container cannot be run as non-root, would it be possible to add a step to change the permissions to the output file as part of the action? Thank you.

@kderck
Copy link
Contributor

kderck commented Nov 23, 2023

Hi @mikejgray are you running this on your own runner, or a GitHub's public runners?

@mikejgray
Copy link
Author

@kderck This is using GitHub's provided runners

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