forked from awslabs/stickler
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (64 loc) · 2.09 KB
/
security.yaml
File metadata and controls
70 lines (64 loc) · 2.09 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
name: Security Scan
on: [push, pull_request]
permissions:
contents: read
actions: read
jobs:
security:
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
pull-requests: write
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run Bandit Security Scan
run: |
pip install bandit[toml]
bandit -r src/ -f json -o bandit-report.json || true
bandit -r src/ -f txt
- name: Install ASH
run: |
pip install git+https://github.com/awslabs/automated-security-helper.git@v3.1.2
- name: Run ASH Security Scan
continue-on-error: true
run: |
ash --mode local
- name: Upload Security Reports
uses: actions/upload-artifact@v4
if: always()
with:
name: security-reports
path: |
bandit-report.json
.ash/ash_output/
- name: Add Security Report to PR
uses: actions/github-script@v7
if: always() && github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const reportPath = '.ash/ash_output/reports/ash.summary.md';
if (fs.existsSync(reportPath)) {
const reportContent = fs.readFileSync(reportPath, 'utf8');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: '## 🔒 Security Scan Results\n\n' + reportContent
});
} else {
console.log('ASH summary report not found');
}