mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-10 02:53:36 -05:00
4471e9f322
- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much. Signed-off-by: nathannaveen <42319948+nathannaveen@users.noreply.github.com>
53 lines
1.5 KiB
YAML
53 lines
1.5 KiB
YAML
# Disabling trivy scans while they get troubleshooting for failures
|
|
---
|
|
name: Trivy Container Scan
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
scan-container:
|
|
permissions:
|
|
contents: read # for actions/checkout to fetch code
|
|
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
|
name: Build
|
|
runs-on: ubuntu-18.04
|
|
timeout-minutes: 60
|
|
steps:
|
|
######################
|
|
# Checkout code base #
|
|
######################
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
# ##########################
|
|
# # Build the docker image #
|
|
# ##########################
|
|
- name: Build an image from Dockerfile
|
|
run: |
|
|
docker build -t "docker.io/github/super-linter:${{ github.sha }}" .
|
|
|
|
#################################
|
|
# Run Trivy Scan of source code #
|
|
#################################
|
|
- name: Trivy Scan
|
|
uses: aquasecurity/trivy-action@master
|
|
with:
|
|
scan-type: 'fs'
|
|
format: 'template'
|
|
template: '@/contrib/sarif.tpl'
|
|
output: 'report.sarif'
|
|
severity: 'HIGH,CRITICAL'
|
|
|
|
#################################
|
|
# Upload report to security tab #
|
|
#################################
|
|
- name: Upload Trivy scan results to GitHub Security tab
|
|
uses: github/codeql-action/upload-sarif@v1
|
|
if: always()
|
|
with:
|
|
sarif_file: 'report.sarif'
|