Skip to content

Commit

Permalink
Merge pull request #2047 from nodiscc/trivy-schedule-release
Browse files Browse the repository at this point in the history
github actions: run daily trivy security scans on release docker image, composer/yarn dependencies
  • Loading branch information
nodiscc committed Dec 3, 2023
2 parents e7492c6 + eda9e2e commit 709aba2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/trivy-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: trivy security scans (release)
on:
schedule:
- cron: '0 17 * * *'
workflow_dispatch:

jobs:
trivy-repo:
runs-on: ubuntu-latest
name: trivy scan (release composer/yarn dependencies)
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run trivy scanner on repository
run: make test_trivy_repo TRIVY_TARGET_BRANCH=origin/release TRIVY_EXIT_CODE=1
trivy-docker:
runs-on: ubuntu-latest
name: trivy scan (release docker image)
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run trivy scanner on release docker image
run: make test_trivy_docker TRIVY_TARGET_DOCKER_IMAGE=ghcr.io/shaarli/shaarli:release
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ TRIVY_VERSION=0.44.0
TRIVY_EXIT_CODE=1
# default docker image to scan with trivy
TRIVY_TARGET_DOCKER_IMAGE=ghcr.io/shaarli/shaarli:latest
# branch on which test_trivy_repo should be run. leave undefined for the current branch
#TRIVY_TARGET_BRANCH=origin/release

### download trivy vulneravbility scanner
download_trivy:
Expand All @@ -211,5 +213,9 @@ test_trivy_docker: download_trivy

### run trivy vulnerability scanner on composer/yarn dependency trees
test_trivy_repo: download_trivy
ifdef TRIVY_TARGET_BRANCH
git checkout $(TRIVY_TARGET_BRANCH) composer.lock
git checkout $(TRIVY_TARGET_BRANCH) yarn.lock
endif
./trivy --exit-code $(TRIVY_EXIT_CODE) fs composer.lock
./trivy --exit-code $(TRIVY_EXIT_CODE) fs yarn.lock
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ _It is designed to be personal (single-user), fast and handy._
[![](https://img.shields.io/badge/release-v0.13.0-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.13.0)
[![](https://img.shields.io/badge/master-v0.13.x-blue.svg)](https://github.com/shaarli/Shaarli)
[![](https://github.com/shaarli/Shaarli/actions/workflows/ci.yml/badge.svg)](https://github.com/shaarli/Shaarli/actions)
[![](https://github.com/shaarli/Shaarli/actions/workflows/trivy-release.yml/badge.svg)](https://github.com/shaarli/Shaarli/actions)
[![Join the chat at https://gitter.im/shaarli/Shaarli](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/shaarli/Shaarli)
[![Docker repository](https://img.shields.io/docker/pulls/shaarli/shaarli.svg)](https://github.com/shaarli/Shaarli/pkgs/container/shaarli)

Expand Down

0 comments on commit 709aba2

Please sign in to comment.