-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (85 loc) · 2.49 KB
/
Copy pathsecurity-scanner.yml
File metadata and controls
89 lines (85 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
on:
workflow_dispatch:
inputs:
product-name:
description: 'Product name'
required: true
type: string
product-type:
description: 'Product type'
required: true
type: string
secrets:
base-url:
description: 'Base URL'
required: true
api-key:
description: 'API Key'
required: true
workflow_call:
inputs:
product-name:
description: 'Product name'
required: true
type: string
product-type:
description: 'Product type'
required: true
type: string
secrets:
base-url:
description: 'DefectDojo base URL'
required: true
api-key:
description: 'DefectDojo API key'
required: true
jobs:
security-scanner:
name: Security Scanner
runs-on: ubuntu-latest
strategy:
matrix:
scanner:
- trufflehog
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Scanner
id: ${{ matrix.scanner }}
uses: ./scanners/${{ matrix.scanner }}
security-reporter:
name: Security Reporter
runs-on: ubuntu-latest
needs: security-scanner
steps:
- name: Download scan report
uses: dawidd6/action-download-artifact@v2
with:
name: ${{ needs.security-scanner.outputs.scan-name }}
run_id: ${{ needs.security-scanner.outputs.scan-run-id }}
workflow_conclusion: success
- name: Report to DefectDojo
env:
BASE_URL: ${{ secrets.base-url }}
API_KEY: ${{ secrets.api-key }}
PRODUCT_NAME: ${{ inputs.product-name }}
PRODUCT_TYPE: ${{ inputs.product-type }}
SCAN_TYPE: ${{ inputs.scan-type }}
SCAN_PATH: ${{ inputs.scan-path }}
run: |
curl -X POST ${BASE_URL}/api/v2/import-scan/ \
-H "Authorization: Token ${API_KEY}" \
-H "Content-Type: multipart/form " \
-F "minimum_severity=Info" \
-F "scan_date=$(date -I)" \
-F "verified=True" \
-F "active=False" \
-F "scan_type=${SCAN_TYPE}" \
-F "file=@${SCAN_PATH}" \
-F "close_old_findings=True" \
-F "product_name=${PRODUCT_NAME}" \
-F "product_type=${PRODUCT_TYPE}"
-F "engagement_name=${GITHUB_REF_NAME}" \
-F "engagement_type=CI/CD" \
-F "lead=GitHub Actions" \
-F "commit_hash=${GITHUB_SHA}"