-
Notifications
You must be signed in to change notification settings - Fork 61
110 lines (93 loc) · 2.85 KB
/
security.yml
File metadata and controls
110 lines (93 loc) · 2.85 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Security
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 0 * * 1' # Weekly on Mondays
jobs:
security-scan:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install checkov
run: pip install checkov
- name: Install tfsec
run: |
curl -L https://github.com/aquasecurity/tfsec/releases/latest/download/tfsec-linux-amd64 -o tfsec
chmod +x tfsec
sudo mv tfsec /usr/local/bin/
- name: Run checkov
run: |
checkov --config-file .checkov.yml --output cli --output sarif --output-file-path console,checkov-results.sarif
continue-on-error: true
- name: Run tfsec
run: |
tfsec . --format sarif --out tfsec-results.sarif
continue-on-error: true
- name: Upload checkov results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: checkov-results.sarif
category: checkov
- name: Upload tfsec results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: tfsec-results.sarif
category: tfsec
security-scan-examples:
name: Security Scan Examples
runs-on: ubuntu-latest
strategy:
matrix:
example: [
'simple_plan',
'complete_plan',
'selection_by_tags',
'selection_by_conditions',
'simple_plan_with_report',
'simple_plan_using_variables',
'simple_plan_using_lock_configuration',
'simple_plan_windows_vss_backup',
'organization_backup_policy',
'multiple_plans',
'aws_recommended_audit_framework',
'complete_audit_framework',
'simple_audit_framework',
'secure_backup_configuration'
]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install checkov
run: pip install checkov
- name: Install tfsec
run: |
curl -L https://github.com/aquasecurity/tfsec/releases/latest/download/tfsec-linux-amd64 -o tfsec
chmod +x tfsec
sudo mv tfsec /usr/local/bin/
- name: Run checkov on example
run: |
if [ -d "examples/${{ matrix.example }}" ]; then
checkov -d examples/${{ matrix.example }} --framework terraform --output cli
fi
continue-on-error: true
- name: Run tfsec on example
run: |
if [ -d "examples/${{ matrix.example }}" ]; then
tfsec examples/${{ matrix.example }} --format default
fi
continue-on-error: true