Skip to content

Commit 1bf9b59

Browse files
committed
chore: disable workflows and update CodeQL and Trivy configurations
1 parent fd23630 commit 1bf9b59

File tree

2 files changed

+55
-54
lines changed

2 files changed

+55
-54
lines changed
Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,56 @@
1-
name: "Code scanning - action"
1+
name: "CodeQL Code Scanning"
22

33
on:
44
push:
5+
branches:
6+
- next
7+
- main
58
pull_request:
9+
branches:
10+
- next
11+
- main
612
schedule:
7-
- cron: '0 16 * * 6'
13+
- cron: '0 2 * * 1-5' # run at 2 AM UTC Monday through Friday
814

915
jobs:
10-
CodeQL-Build:
11-
16+
analyze:
17+
name: Analyze (${{ matrix.language }})
1218
runs-on: ubuntu-latest
19+
permissions:
20+
security-events: write # Required for uploading SARIF results
21+
contents: read # Required for private repos
22+
actions: read # Required for analyzing workflow files
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
# Analyze Go and JavaScript/TypeScript separately for better performance
28+
language: ['go', 'javascript-typescript']
1329

1430
steps:
1531
- name: Checkout repository
1632
uses: actions/checkout@v5
17-
with:
18-
# We must fetch at least the immediate parents so that if this is
19-
# a pull request then we can checkout the head.
20-
fetch-depth: 2
2133

22-
# If this run was triggered by a pull request event, then checkout
23-
# the head of the pull request instead of the merge commit.
24-
- run: git checkout HEAD^2
25-
if: ${{ github.event_name == 'pull_request' }}
26-
27-
# Initializes the CodeQL tools for scanning.
2834
- name: Initialize CodeQL
29-
uses: github/codeql-action/init@v3
30-
# Override language selection by uncommenting this and choosing your languages
31-
# with:
32-
# languages: go, javascript, csharp, python, cpp, java
33-
34-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
35-
# If this step fails, then you should remove it and run the build manually (see below)
36-
#- name: Autobuild
37-
# uses: github/codeql-action/autobuild@v1
38-
39-
# ℹ️ Command-line programs to run using the OS shell.
40-
# 📚 https://git.io/JvXDl
41-
42-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
43-
# and modify them (or add more) to build your code if your project
44-
# uses a compiled language
45-
46-
#- run: |
47-
# make bootstrap
48-
# make release
49-
50-
# to make sure autobuild success, specifify golang version in go.mod
51-
# https://github.com/github/codeql/issues/15647#issuecomment-2003768106
35+
uses: github/codeql-action/init@v4
36+
with:
37+
languages: ${{ matrix.language }}
38+
# Use security-extended query suite for maximum security coverage
39+
queries: +security-extended
40+
# Optionally add custom config file:
41+
# config-file: .github/codeql/codeql-config.yml
42+
43+
# For Go: Build the code so CodeQL can analyze data flow
44+
- name: Build Go code
45+
if: matrix.language == 'go'
46+
run: |
47+
cd src
48+
go build -v ./...
49+
50+
# JavaScript/TypeScript doesn't need building
51+
# CodeQL will analyze it directly
5252

5353
- name: Perform CodeQL Analysis
54-
uses: github/codeql-action/analyze@v3
54+
uses: github/codeql-action/analyze@v4
55+
with:
56+
category: "/language:${{ matrix.language }}"
Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,40 @@
11
name: Trivy Nightly Scan
22
on:
33
schedule:
4-
- cron: '0 2 * * *' # run at 2 AM UTC
4+
- cron: '0 2 * * 1-5' # run at 2 AM UTC Monday through Friday
5+
push:
6+
branches:
7+
- next
8+
workflow_dispatch: # Allow manual triggers
59

610

711
jobs:
812
nightly-scan:
9-
name: Trivy Scan nightly
10-
strategy:
11-
fail-fast: false
12-
matrix:
13-
# maintain the versions of harbor that need to be actively
14-
# security scanned
15-
versions: [dev, v2.12.0-dev]
16-
# list of images that need to be scanned
17-
images: [harbor-core, harbor-db, harbor-exporter, harbor-jobservice, harbor-log, harbor-portal, harbor-registryctl, prepare]
13+
name: Trivy Repository Scan
1814
permissions:
1915
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
16+
contents: read
2017

2118
runs-on: ubuntu-latest
2219
steps:
2320
- name: Checkout code
2421
uses: actions/checkout@v5
25-
- name: Run Trivy vulnerability scanner
22+
- name: Run Trivy scanner on repository
2623
uses: aquasecurity/trivy-action@master
2724
with:
28-
image-ref: 'docker.io/goharbor/${{ matrix.images }}:${{ matrix.versions }}'
29-
severity: 'CRITICAL,HIGH'
30-
format: 'template'
31-
template: '@/contrib/sarif.tpl'
25+
scan-type: 'fs'
26+
scan-ref: '.'
27+
scanners: 'vuln,secret,misconfig'
28+
severity: 'CRITICAL,HIGH,MEDIUM'
29+
format: 'sarif'
3230
output: 'trivy-results.sarif'
31+
skip-dirs: 'node_modules,vendor'
3332
env:
3433
# Use AWS' ECR mirror for the trivy-db image, as GitHub's Container
3534
# Registry is returning a TOOMANYREQUESTS error.
3635
# Ref: https://github.com/aquasecurity/trivy-action/issues/389
3736
TRIVY_DB_REPOSITORY: 'public.ecr.aws/aquasecurity/trivy-db:2'
3837
- name: Upload Trivy scan results to GitHub Security tab
39-
uses: github/codeql-action/upload-sarif@v3
38+
uses: github/codeql-action/upload-sarif@v4
4039
with:
4140
sarif_file: 'trivy-results.sarif'

0 commit comments

Comments
 (0)