Skip to content

Commit e4d19ee

Browse files
author
Jop Zitman
committed
Merge remote-tracking branch 'upstream/main' into hook-priorities
2 parents 73efd7d + 6e008e1 commit e4d19ee

127 files changed

Lines changed: 1603 additions & 494 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ jobs:
281281
- amass
282282
- angularjs-csti-scanner
283283
- cmseek
284+
- git-repo-scanner
284285
- gitleaks
285286
- kubeaudit
286287
- kube-hunter

.github/workflows/helm-charts-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
RELEASE_VERSION="${RELEASE_VERSION//v}"
2727
# Publish all helm charts in all folders containing a `Chart.yaml` file
2828
# https://github.com/koalaman/shellcheck/wiki/SC2044
29-
find . -type f -name Chart.yaml -print0 | while IFS= read -r -d '' chart; do
29+
find . -type f -name Chart.yaml -not -path "./.templates/*" -print0 | while IFS= read -r -d '' chart; do
3030
(
3131
dir="$(dirname "${chart}")"
3232
cd "${dir}" || exit

.github/workflows/release-build.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ jobs:
269269
parser:
270270
- amass
271271
- angularjs-csti-scanner
272+
- cmseek
272273
- git-repo-scanner
273274
- gitleaks
274275
- kube-hunter
@@ -282,8 +283,8 @@ jobs:
282283
- sslyze
283284
- test-scan
284285
- trivy
285-
- whatweb
286286
- typo3scan
287+
- whatweb
287288
- wpscan
288289
- zap
289290

.github/workflows/scb-bot.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Check outdated scanners
2+
on:
3+
push:
4+
schedule:
5+
- cron: "15 9 * * *" # Daily at 9:15 (avoids the beginning of the hour congestion)
6+
jobs:
7+
version-compare:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
scanner:
12+
- amass # Scanner that needs to be updated
13+
- angularjs-csti-scanner # Scanner that does not need to be updated
14+
# - gitleaks
15+
# - kube-hunter
16+
# - kubeaudit
17+
# - ncrack
18+
# - nuclei
19+
# - ssh-scan
20+
# - sslyze
21+
# - trivy
22+
# - whatweb
23+
# - wpscan
24+
# - zap
25+
# - zap-advanced
26+
# These are commented out for the moment to avoid accidental multiple erroneous PRs
27+
# missing scanners are : nmap, nikto, typo3scan
28+
steps:
29+
- uses: actions/checkout@v2
30+
31+
- name: Import GPG key
32+
uses: crazy-max/ghaction-import-gpg@v3
33+
with:
34+
gpg-private-key: ${{ secrets.GPG_COMMITS_PRIVATE_KEY }}
35+
passphrase: ${{ secrets.GPG_COMMITS_PASSPHRASE }}
36+
git-user-signingkey: true
37+
git-commit-gpgsign: true
38+
39+
- name: Fetch scanner's version API
40+
uses: mikefarah/yq@v4.4.1
41+
with:
42+
cmd: echo versionApi=$(yq e .versionApi scanners/${{ matrix.scanner }}/Chart.yaml) >> $GITHUB_ENV
43+
44+
- name: Fetch latest release scanner version
45+
run: echo release=$((curl -sL ${{env.versionApi}} ) | jq -r ".tag_name") | tr -d "v" >> $GITHUB_ENV
46+
47+
- name: Fetch local scanner version
48+
uses: mikefarah/yq@v4.4.1
49+
with:
50+
cmd: echo local=$(yq e .appVersion scanners/${{ matrix.scanner }}/Chart.yaml) | tr -d "v" >> $GITHUB_ENV
51+
52+
- name: Check if scanner is outdated and if PR already exists
53+
if: ${{ env.release != env.local }}
54+
run: |
55+
echo 'The ${{ matrix.scanner }} scanner is outdated. Current SCB version is ${{env.local}} and remote version is ${{env.release}}'
56+
57+
pullRequestTitle="[SCB-Bot] Upgraded ${{ matrix.scanner }} from ${{env.local}} to ${{env.release}}"
58+
echo pullRequest=$pullRequestTitle >> $GITHUB_ENV
59+
60+
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
61+
echo prExists=$(gh pr list --state open --limit 100 | grep -F "$pullRequestTitle" -c) >> $GITHUB_ENV
62+
63+
- name : Upgrade Scanner
64+
if: ${{ env.release != env.local && env.prExists == 0 }}
65+
uses: mikefarah/yq@v4.4.1
66+
with:
67+
# appVersion value in chart is replaced with release value. Empty lines are deleted in the process
68+
cmd: yq e --inplace '.appVersion = "v${{env.release}}"' ./scanners/${{ matrix.scanner }}/Chart.yaml
69+
70+
- name : Create Pull Request
71+
if: ${{ env.release != env.local && env.prExists == 0 }}
72+
uses: peter-evans/create-pull-request@v3
73+
with:
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
committer: secureCodeBoxBot <securecodebox@iteratec.com>
76+
author: secureCodeBoxBot <securecodebox@iteratec.com>
77+
title: ${{ env.pullRequest }}
78+
body: "This is an automated Pull Request by the SCB-Bot. It upgrades ${{ matrix.scanner }} from ${{env.local}} to ${{env.release}}"
79+
branch: "dependencies/upgrading-${{ matrix.scanner }}-to-${{env.release}}"
80+
labels: dependencies,scanner
81+
commit-message: "Upgrading ${{ matrix.scanner }} from ${{env.local}} to ${{env.release}}"
82+
signoff: true
83+
base: main

Makefile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,14 @@ docs: readme hook-docs scanner-docs operator-docs auto-discovery-docs demo-apps-
150150
.PHONY: create-new-scanner
151151
create-new-scanner: ## Creates templates for a new scanner, pass NAME=NEW-SCANNER
152152
ifdef NAME
153-
@mkdir scanners/$(NAME) ; \
154-
rsync -a ./.templates/new-scanner/ ./scanners/$(NAME) ; \
155-
echo "Copied template files to new directory ./scanners/$(NAME)"; \
156-
cd scanners/$(NAME) ; \
157-
find . -type f -exec sed -i 's/new-scanner/$(NAME)/g' {} + ; \
158-
mv "./templates/new-scanner-parse-definition.yaml" "templates/$(NAME)-parse-definition.yaml" ; \
159-
mv "./templates/new-scanner-scan-type.yaml" "templates/$(NAME)-scan-type.yaml" ;
153+
cp -r ./.templates/new-scanner ./scanners/$(NAME)
154+
find ./scanners/$(NAME) -type f ! -name 'tmp' \
155+
-exec sed -n 's/new-scanner/$(NAME)/g;w ./scanners/$(NAME)/tmp' {} \; \
156+
-exec mv ./scanners/$(NAME)/tmp {} \;
157+
mv ./scanners/$(NAME)/templates/new-scanner-parse-definition.yaml ./scanners/$(NAME)/templates/$(NAME)-parse-definition.yaml
158+
mv ./scanners/$(NAME)/templates/new-scanner-scan-type.yaml ./scanners/$(NAME)/templates/$(NAME)-scan-type.yaml
160159
else
161-
@echo "Scanner name not defined, please provide via make create-new-scanner NAME=NEW-SCANNER";
160+
@echo "Scanner name not defined, please provide via make create-new-scanner NAME=NEW-SCANNER"
162161
endif
163162

164163
.PHONY:

auto-discovery/kubernetes/controllers/service_scan_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ func generateScanSpec(autoDiscoveryConfig configv1.AutoDiscoveryConfig, scanConf
421421
ScanType: scanConfig.ScanType,
422422
Parameters: params,
423423
},
424+
RetriggerOnScanTypeChange: true,
424425
}
425426

426427
return scheduledScanSpec

auto-discovery/kubernetes/demo/juice-shop.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ spec:
6161
apiVersion: helm.fluxcd.io/v1
6262
kind: HelmRelease
6363
metadata:
64-
name: zap-advanced-scan
64+
name: zap-advanced
6565
namespace: juice-shop
6666
spec:
6767
chart:
6868
repository: https://charts.securecodebox.io
69-
version: 2.7.2
70-
name: zap-advanced-scan
69+
version: 3.2.0
70+
name: zap-advanced

auto-discovery/kubernetes/go.mod

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@ require (
1010
github.com/Masterminds/goutils v1.1.1 // indirect
1111
github.com/Masterminds/semver v1.5.0 // indirect
1212
github.com/Masterminds/sprig v2.22.0+incompatible
13-
github.com/go-logr/logr v0.3.0
13+
github.com/go-logr/logr v0.4.0
1414
github.com/huandu/xstrings v1.3.2 // indirect
1515
github.com/mitchellh/copystructure v1.2.0 // indirect
16-
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
1716
github.com/onsi/ginkgo v1.14.1
1817
github.com/onsi/gomega v1.10.2
19-
github.com/secureCodeBox/secureCodeBox/operator v0.0.0-20210512114551-f7af2ead2c3d
20-
github.com/stretchr/testify v1.5.1
21-
k8s.io/api v0.19.2
22-
k8s.io/apimachinery v0.19.2
23-
k8s.io/client-go v0.19.2
24-
sigs.k8s.io/controller-runtime v0.7.2
18+
github.com/secureCodeBox/secureCodeBox/operator v0.0.0-20211020071729-60497d02f10d
19+
github.com/stretchr/testify v1.6.1
20+
k8s.io/api v0.20.2
21+
k8s.io/apimachinery v0.20.2
22+
k8s.io/client-go v0.20.2
23+
sigs.k8s.io/controller-runtime v0.8.3
2524
)

0 commit comments

Comments
 (0)