Skip to content

Commit ec218f8

Browse files
Merge branch 'dev' into merge_mobsf
2 parents 822bf48 + f61e3aa commit ec218f8

257 files changed

Lines changed: 23413 additions & 3119 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/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This checklist is for your information.
2626
- [ ] Bugfixes should be submitted against the `bugfix` branch.
2727
- [ ] Give a meaningful name to your PR, as it may end up being used in the release notes.
2828
- [ ] Your code is flake8 compliant.
29-
- [ ] Your code is python 3.12 compliant.
29+
- [ ] Your code is python 3.13 compliant.
3030
- [ ] If this is a new feature and not a bug fix, you've included the proper documentation in the docs at https://github.com/DefectDojo/django-DefectDojo/tree/dev/docs as part of this PR.
3131
- [ ] Model changes must include the necessary migrations in the dojo/db_migrations folder.
3232
- [ ] Add applicable tests to the unit tests.

.github/workflows/close-stale.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,24 @@ jobs:
1515
close-stale:
1616
runs-on: ubuntu-latest
1717
steps:
18+
- name: Close issues and PRs that are pending closure
19+
uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
20+
with:
21+
# Disable automatic stale marking - only close manually labeled items
22+
days-before-stale: -1
23+
days-before-close: 7
24+
stale-issue-label: 'pending-closure'
25+
stale-pr-label: 'pending-closure'
26+
close-issue-message: 'This issue has been automatically closed because it was manually labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'
27+
close-pr-message: 'This PR has been automatically closed because it was manually labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'
28+
1829
- name: Close stale issues and PRs
19-
uses: actions/stale@3a9db7e6a41a89f618792c92c0e97cc736e1b13f # v10.0.0
30+
uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
2031
with:
2132
# Disable automatic stale marking - only close manually labeled items
2233
days-before-stale: -1
2334
days-before-close: 7
2435
stale-issue-label: 'stale'
2536
stale-pr-label: 'stale'
26-
close-issue-message: 'This issue has been automatically closed because it was manually labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'
27-
close-pr-message: 'This PR has been automatically closed because it was manually labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'
37+
close-issue-message: 'This issue has been automatically closed because it was labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'
38+
close-pr-message: 'This PR has been automatically closed because it was labeled as stale. If you believe this was closed in error, please reopen it and remove the stale label.'

.github/workflows/gh-pages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
- name: Setup Node
2222
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
2323
with:
24-
node-version: '22.19.0'
24+
node-version: '22.20.0'
2525

2626
- name: Cache dependencies
27-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
27+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
2828
with:
2929
path: ~/.npm
3030
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

.github/workflows/integration-tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@ name: Integration tests
22

33
on:
44
workflow_call:
5+
inputs:
6+
auditlog_type:
7+
type: string
8+
default: "django-auditlog"
59

610
jobs:
711
integration_tests:
812
# run tests with docker compose
913
name: User Interface Tests
1014
runs-on: ubuntu-latest
15+
env:
16+
AUDITLOG_TYPE: ${{ inputs.auditlog_type }}
1117
strategy:
1218
matrix:
1319
test-case: [

.github/workflows/k8s-tests.yml

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ on:
55

66
env:
77
DD_HOSTNAME: defectdojo.default.minikube.local
8-
HELM_REDIS_BROKER_SETTINGS: " \
9-
--set redis.enabled=true \
10-
--set celery.broker=redis \
11-
--set createRedisSecret=true \
12-
"
13-
HELM_PG_DATABASE_SETTINGS: " \
14-
--set postgresql.enabled=true \
15-
--set createPostgresqlSecret=true \
16-
"
178
jobs:
189
setting_minikube_cluster:
1910
name: Kubernetes Deployment
@@ -25,9 +16,7 @@ jobs:
2516
# databases, broker and k8s are independent, so we don't need to test each combination
2617
# lastest k8s version (https://kubernetes.io/releases/) and oldest supported version from aws
2718
# are tested (https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html#available-versions)
28-
- databases: pgsql
29-
brokers: redis
30-
k8s: 'v1.33.4'
19+
- k8s: 'v1.34.0'
3120
os: debian
3221
steps:
3322
- name: Checkout
@@ -36,7 +25,7 @@ jobs:
3625
- name: Setup Minikube
3726
uses: manusa/actions-setup-minikube@b589f2d61bf96695c546929c72b38563e856059d # v2.14.0
3827
with:
39-
minikube version: 'v1.33.1'
28+
minikube version: 'v1.37.0'
4029
kubernetes version: ${{ matrix.k8s }}
4130
driver: docker
4231
start args: '--addons=ingress --cni calico'
@@ -68,12 +57,6 @@ jobs:
6857
helm dependency list ./helm/defectdojo
6958
helm dependency update ./helm/defectdojo
7059
71-
- name: Set confings into Outputs
72-
id: set
73-
run: |-
74-
echo "pgsql=${{ env.HELM_PG_DATABASE_SETTINGS }}" >> $GITHUB_ENV
75-
echo "redis=${{ env.HELM_REDIS_BROKER_SETTINGS }}" >> $GITHUB_ENV
76-
7760
- name: Deploying Django application with ${{ matrix.databases }} ${{ matrix.brokers }}
7861
timeout-minutes: 15
7962
run: |-
@@ -86,8 +69,10 @@ jobs:
8669
--set django.ingress.enabled=true \
8770
--set imagePullPolicy=Never \
8871
--set initializer.keepSeconds="-1" \
89-
${{ env[matrix.databases] }} \
90-
${{ env[matrix.brokers] }} \
72+
--set redis.enabled=true \
73+
--set createRedisSecret=true \
74+
--set postgresql.enabled=true \
75+
--set createPostgresqlSecret=true \
9176
--set createSecret=true
9277
9378
- name: Check deployment status
@@ -121,12 +106,15 @@ jobs:
121106
to_complete "condition=ready" pod "defectdojo.org/component=django"
122107
echo "Pods up and ready to rumbole"
123108
kubectl get pods
109+
110+
- name: Test login page
111+
timeout-minutes: 10
112+
run: |-
124113
RETRY=0
125114
while :
126115
do
127116
DJANGO_IP=$(kubectl get svc defectdojo-django -o jsonpath='{.spec.clusterIP}')
128117
OUT=$(kubectl run curl --quiet=true --image=curlimages/curl:8.15.0 \
129-
--overrides='{ "apiVersion": "v1" }' \
130118
--restart=Never -i --rm -- \
131119
--silent \
132120
--max-time 20 \
@@ -144,7 +132,7 @@ jobs:
144132
echo "ERROR: cannot display login screen; got HTTP code $CR"
145133
exit 1
146134
else
147-
((RETRY++))
135+
RETRY=$((RETRY+1))
148136
echo "Attempt $RETRY to get login page"
149137
sleep 5
150138
fi
@@ -153,26 +141,48 @@ jobs:
153141
break
154142
fi
155143
done
144+
145+
- name: Test API auth call
146+
timeout-minutes: 10
147+
run: |-
156148
ADMIN_PASS=$(kubectl get secret/defectdojo -o jsonpath='{.data.DD_ADMIN_PASSWORD}' | base64 -d)
157149
echo "Simple API check"
158150
DJANGO_IP=$(kubectl get svc defectdojo-django -o jsonpath='{.spec.clusterIP}')
159-
CR=$(kubectl run curl --quiet=true --image=curlimages/curl:8.15.0 \
160-
--overrides='{ "apiVersion": "v1" }' \
161-
--restart=Never -i --rm -- \
162-
--silent \
163-
--max-time 20 \
164-
--header "Host: $DD_HOSTNAME" \
165-
--data-raw "username=admin&password=$ADMIN_PASS" \
166-
--output /dev/null \
167-
--write-out "%{http_code}\n" \
168-
"http://${DJANGO_IP}/api/v2/api-token-auth/")
169-
echo $CR
170-
if [[ $CR -ne 200 ]]; then
171-
echo "ERROR: login is not possible; got HTTP code $CR"
172-
exit 1
173-
else
174-
echo "Result received"
175-
fi
151+
RETRY=0
152+
while :
153+
do
154+
OUT=$(kubectl run curl --quiet=true --image=curlimages/curl:8.15.0 \
155+
--restart=Never -i --rm -- \
156+
--dump-header - \
157+
--no-progress-meter \
158+
--max-time 20 \
159+
--header "Host: $DD_HOSTNAME" \
160+
--data-raw "username=admin&password=$ADMIN_PASS" \
161+
"http://${DJANGO_IP}/api/v2/api-token-auth/")
162+
CR=$(echo $OUT | egrep "^HTTP" | cut -d' ' -f2)
163+
echo "Return code $CR"
164+
if [[ $CR -ne 200 ]]; then
165+
echo "Retry: $RETRY"
166+
if [[ $RETRY -gt 2 ]]; then
167+
kubectl get pods
168+
echo $(kubectl logs --tail=30 -l defectdojo.org/component=django -c uwsgi)
169+
echo "ERROR: cannot perform API login; got HTTP code $CR; Full response:"
170+
echo $OUT
171+
exit 1
172+
else
173+
RETRY=$((RETRY+1))
174+
echo "Attempt $RETRY to perform API login"
175+
sleep 5
176+
fi
177+
else
178+
echo "Result received"
179+
break
180+
fi
181+
done
182+
183+
- name: Check of logs
184+
timeout-minutes: 10
185+
run: |-
176186
echo "Final Check of components"
177187
errors=$(kubectl get pods | grep Error | awk '{print $1}')
178188
if [[ ! -z $errors ]]; then
@@ -185,3 +195,11 @@ jobs:
185195
else
186196
echo "DD K8S successfully deployed"
187197
fi
198+
199+
- name: Failed Logs
200+
if: failure()
201+
run: |-
202+
echo "ERROR: Here are logs from deployment/defectdojo-django containers:"
203+
kubectl logs deployment/defectdojo-django --all-pods=true --all-containers=true --tail=100
204+
echo "And all pod status one more time"
205+
kubectl get pods

.github/workflows/release-1-create-pr.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,23 @@ jobs:
8080
sed -ri "0,/version/s/version: \S+/$NEW_CHART_VERSION/" helm/defectdojo/Chart.yaml
8181
fi
8282
83+
- name: Update values in HELM chart
84+
run: |
85+
yq -i '.annotations."artifacthub.io/prerelease" = "false"' helm/defectdojo/Chart.yaml
86+
yq -i '.annotations."artifacthub.io/changes" += "- kind: changed\n description: Bump DefectDojo to ${{ inputs.release_number }}\n"' helm/defectdojo/Chart.yaml
87+
8388
- name: Check version numbers
8489
run: |
8590
grep -H version dojo/__init__.py
8691
grep -H version components/package.json
8792
grep -H appVersion helm/defectdojo/Chart.yaml
8893
grep -H version helm/defectdojo/Chart.yaml
8994
95+
- name: Run helm-docs
96+
uses: losisin/helm-docs-github-action@a57fae5676e4c55a228ea654a1bcaec8dd3cf5b5 # v1.6.2
97+
with:
98+
chart-search-root: "helm/defectdojo"
99+
90100
- name: Push version changes
91101
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
92102
with:

.github/workflows/release-3-master-into-dev.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ jobs:
7474
git add docs/content/en/open_source/upgrading/$minorv.md
7575
if: endsWith(inputs.release_number_new, '.0') && endsWith(inputs.release_number_dev, '.0-dev')
7676

77+
- name: Update values in HELM chart
78+
run: |
79+
yq -i '.annotations = {}' helm/defectdojo/Chart.yaml
80+
yq -i '.annotations."artifacthub.io/prerelease" = "true"' helm/defectdojo/Chart.yaml
81+
yq -i '.annotations."artifacthub.io/changes" = ""' helm/defectdojo/Chart.yaml
82+
83+
- name: Run helm-docs
84+
uses: losisin/helm-docs-github-action@a57fae5676e4c55a228ea654a1bcaec8dd3cf5b5 # v1.6.2
85+
with:
86+
chart-search-root: "helm/defectdojo"
87+
7788
- name: Push version changes
7889
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
7990
with:
@@ -139,6 +150,17 @@ jobs:
139150
grep appVersion helm/defectdojo/Chart.yaml
140151
grep version components/package.json
141152
153+
- name: Update values in HELM chart
154+
run: |
155+
yq -i '.annotations = {}' helm/defectdojo/Chart.yaml
156+
yq -i '.annotations."artifacthub.io/prerelease" = "true"' helm/defectdojo/Chart.yaml
157+
yq -i '.annotations."artifacthub.io/changes" = ""' helm/defectdojo/Chart.yaml
158+
159+
- name: Run helm-docs
160+
uses: losisin/helm-docs-github-action@a57fae5676e4c55a228ea654a1bcaec8dd3cf5b5 # v1.6.2
161+
with:
162+
chart-search-root: "helm/defectdojo"
163+
142164
- name: Push version changes
143165
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
144166
with:

.github/workflows/release-x-manual-docker-containers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
run: echo "DOCKER_ORG=$(echo ${GITHUB_REPOSITORY%%/*} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
5353

5454
- name: Login to DockerHub
55-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
55+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
5656
with:
5757
username: ${{ secrets.DOCKERHUB_USERNAME }}
5858
password: ${{ secrets.DOCKERHUB_TOKEN }}

.github/workflows/release-x-manual-helm-chart.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
echo "chart_version=$(ls build | cut -d '-' -f 2,3 | sed 's|\.tgz||')" >> $GITHUB_ENV
8888
8989
- name: Create release ${{ inputs.release_number }}
90-
uses: softprops/action-gh-release@6cbd405e2c4e67a21c47fa9e383d020e4e28b836 # v2.3.3
90+
uses: softprops/action-gh-release@aec2ec56f94eb8180ceec724245f64ef008b89f5 # v2.4.0
9191
with:
9292
name: '${{ inputs.release_number }} 🌈'
9393
tag_name: ${{ inputs.release_number }}

.github/workflows/release-x-manual-merge-container-digests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
merge-multiple: true
4949

5050
- name: Login to DockerHub
51-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
51+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
5252
with:
5353
username: ${{ secrets.DOCKERHUB_USERNAME }}
5454
password: ${{ secrets.DOCKERHUB_TOKEN }}

0 commit comments

Comments
 (0)