Skip to content

Commit 2f27d0a

Browse files
ci(security): Update security.yml
1 parent b52fa7e commit 2f27d0a

File tree

1 file changed

+55
-42
lines changed

1 file changed

+55
-42
lines changed

.github/workflows/security.yml

Lines changed: 55 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,64 @@ name: Security Scan
33
on:
44
schedule:
55
- cron: '0 0 * * 1' # Roda toda segunda-feira à meia-noite
6-
workflow_dispatch:
6+
workflow_dispatch: # Permite rodar manualmente
77

88
jobs:
9-
dependency-check:
10-
name: Check Vulnerabilities
9+
security-scan:
1110
runs-on: ubuntu-latest
1211

1312
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v4
16-
17-
- name: Set up JDK 17
18-
uses: actions/setup-java@v3
19-
with:
20-
distribution: 'temurin'
21-
java-version: '17'
22-
23-
- name: Run OWASP Dependency Check
24-
uses: dependency-check/Dependency-Check_Action@main
25-
with:
26-
project: "MyJavaProject"
27-
path: "pom.xml"
28-
format: "HTML, JSON"
29-
out: "reports"
30-
31-
- name: Upload dependency check report
32-
uses: actions/upload-artifact@v3
33-
with:
34-
name: dependency-check-report
35-
path: reports
36-
37-
trivy-scan:
38-
name: Scan with Trivy
39-
runs-on: ubuntu-latest
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '17'
20+
distribution: 'temurin'
4021

41-
steps:
42-
- name: Checkout code
43-
uses: actions/checkout@v4
44-
45-
- name: Install Trivy
46-
run: |
47-
sudo apt-get install wget -y
48-
wget https://github.com/aquasecurity/trivy/releases/download/v0.46.0/trivy_0.46.0_Linux-64bit.tar.gz # Link atualizado para a versão correta
49-
tar -xzf trivy_0.46.0_Linux-64bit.tar.gz
50-
sudo mv trivy /usr/local/bin/
51-
52-
- name: Run Trivy on project
53-
run: trivy fs --exit-code 1 --severity HIGH,CRITICAL .
22+
- name: Build with Maven
23+
run: mvn clean install -DskipTests
24+
25+
- name: Run the application
26+
run: |
27+
nohup mvn spring-boot:run & # Rodando a aplicação em segundo plano
28+
sleep 30 # Dá tempo para o servidor inicializar
29+
30+
- name: Run OWASP Dependency Check
31+
uses: dependency-check/Dependency-Check_Action@main
32+
with:
33+
project: "MyJavaProject"
34+
path: "pom.xml"
35+
format: "HTML, JSON"
36+
out: "reports"
37+
38+
- name: Upload dependency check report
39+
uses: actions/upload-artifact@v3
40+
with:
41+
name: dependency-check-report
42+
path: reports
43+
44+
- name: Install Trivy
45+
run: |
46+
sudo apt-get install wget -y
47+
wget https://github.com/aquasecurity/trivy/releases/download/v0.46.0/trivy_0.46.0_Linux-64bit.tar.gz
48+
tar -xzf trivy_0.46.0_Linux-64bit.tar.gz
49+
sudo mv trivy /usr/local/bin/
50+
51+
- name: Run Trivy on project
52+
run: trivy fs --exit-code 1 --severity HIGH,CRITICAL .
53+
54+
- name: Install OWASP ZAP
55+
run: |
56+
sudo apt-get install zaproxy
57+
58+
- name: Run OWASP ZAP Scan
59+
run: |
60+
zap-baseline.py -t http://localhost:8081
61+
62+
- name: Upload ZAP Report
63+
uses: actions/upload-artifact@v3
64+
with:
65+
name: zap-report
66+
path: zap_report.html

0 commit comments

Comments
 (0)