You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- name: Upload Trivy scan results to GitHub Security tab
449
-
uses: github/codeql-action/upload-sarif@v3
455
+
uses: github/codeql-action/upload-sarif@v4
450
456
if: always()
451
457
with:
452
458
sarif_file: 'trivy-results.sarif'
@@ -455,7 +461,7 @@ jobs:
455
461
See this for more details: https://docs.github.com/en/actions/learn-github-actions/expressions#always
456
462
457
463
### Using Trivy to scan your Git repo
458
-
It's also possible to scan your git repos with Trivy's built-in repo scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerablites that might get introduced with each PR.
464
+
It's also possible to scan your git repos with Trivy's built-in repo scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerabilities that might get introduced with each PR.
459
465
460
466
If you have [GitHub code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning) available you can use Trivy as a scanning tool as follows:
461
467
```yaml
@@ -469,12 +475,15 @@ jobs:
469
475
build:
470
476
name: Build
471
477
runs-on: ubuntu-24.04
478
+
permissions:
479
+
contents: read # Required to checkout and read repo files
480
+
security-events: write # Required to upload SARIF files to Security tab
472
481
steps:
473
482
- name: Checkout code
474
483
uses: actions/checkout@v4
475
484
476
485
- name: Run Trivy vulnerability scanner in repo mode
477
-
uses: aquasecurity/trivy-action@0.28.0
486
+
uses: aquasecurity/trivy-action@0.33.1
478
487
with:
479
488
scan-type: 'fs'
480
489
ignore-unfixed: true
@@ -483,13 +492,13 @@ jobs:
483
492
severity: 'CRITICAL'
484
493
485
494
- name: Upload Trivy scan results to GitHub Security tab
486
-
uses: github/codeql-action/upload-sarif@v3
495
+
uses: github/codeql-action/upload-sarif@v4
487
496
with:
488
497
sarif_file: 'trivy-results.sarif'
489
498
```
490
499
491
500
### Using Trivy to scan your rootfs directories
492
-
It's also possible to scan your rootfs directories with Trivy's built-in rootfs scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerablites that might get introduced with each PR.
501
+
It's also possible to scan your rootfs directories with Trivy's built-in rootfs scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerabilities that might get introduced with each PR.
493
502
494
503
If you have [GitHub code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning) available you can use Trivy as a scanning tool as follows:
495
504
```yaml
@@ -503,12 +512,15 @@ jobs:
503
512
build:
504
513
name: Build
505
514
runs-on: ubuntu-24.04
515
+
permissions:
516
+
contents: read # Required to checkout and read repo files
517
+
security-events: write # Required to upload SARIF files to Security tab
506
518
steps:
507
519
- name: Checkout code
508
520
uses: actions/checkout@v4
509
521
510
522
- name: Run Trivy vulnerability scanner with rootfs command
511
-
uses: aquasecurity/trivy-action@0.28.0
523
+
uses: aquasecurity/trivy-action@0.33.1
512
524
with:
513
525
scan-type: 'rootfs'
514
526
scan-ref: 'rootfs-example-binary'
@@ -518,13 +530,15 @@ jobs:
518
530
severity: 'CRITICAL'
519
531
520
532
- name: Upload Trivy scan results to GitHub Security tab
521
-
uses: github/codeql-action/upload-sarif@v3
533
+
uses: github/codeql-action/upload-sarif@v4
522
534
with:
523
535
sarif_file: 'trivy-results.sarif'
524
536
```
525
537
526
538
### Using Trivy to scan Infrastructure as Code
527
-
It's also possible to scan your IaC repos with Trivy's built-in repo scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerablites that might get introduced with each PR.
539
+
It's also possible to scan your IaC repos with Trivy's built-in repo scan.
540
+
This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo.
541
+
This helps you identify potential vulnerabilities that might get introduced with each PR.
528
542
529
543
If you have [GitHub code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning) available you can use Trivy as a scanning tool as follows:
530
544
```yaml
@@ -538,12 +552,15 @@ jobs:
538
552
build:
539
553
name: Build
540
554
runs-on: ubuntu-24.04
555
+
permissions:
556
+
contents: read # Required to checkout and read repo files
557
+
security-events: write # Required to upload SARIF files to Security tab
541
558
steps:
542
559
- name: Checkout code
543
560
uses: actions/checkout@v4
544
561
545
562
- name: Run Trivy vulnerability scanner in IaC mode
546
-
uses: aquasecurity/trivy-action@0.28.0
563
+
uses: aquasecurity/trivy-action@0.33.1
547
564
with:
548
565
scan-type: 'config'
549
566
hide-progress: true
@@ -553,11 +570,26 @@ jobs:
553
570
severity: 'CRITICAL,HIGH'
554
571
555
572
- name: Upload Trivy scan results to GitHub Security tab
556
-
uses: github/codeql-action/upload-sarif@v3
573
+
if: always()
574
+
uses: github/codeql-action/upload-sarif@v4
557
575
with:
558
576
sarif_file: 'trivy-results.sarif'
559
577
```
560
578
579
+
**Note**: If your Terraform configuration contains private modules, configure Git to authenticate with the repository hosting them.
580
+
This can be done by adding a step in your CI workflow that sets up access, for example using a Personal Access Token (PAT) or SSH keys:
It's possible for Trivy to generate an [SBOM](https://www.aquasec.com/cloud-native-academy/supply-chain-security/sbom/) of your dependencies and submit them to a consumer like [GitHub Dependency Graph](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph).
563
595
@@ -585,7 +617,7 @@ jobs:
585
617
uses: actions/checkout@v4
586
618
587
619
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
0 commit comments