-
-
Notifications
You must be signed in to change notification settings - Fork 12
136 lines (111 loc) · 4.07 KB
/
scans.yml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Scans
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
GO_VERSION: "1.23"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: read
jobs:
run-jwt-scans:
name: JWT Scans
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
challenge:
[
"jwt-alg-none-bypass",
"jwt-blank-secret",
"jwt-not-verified",
"jwt-null-signature",
"jwt-weak-hmac-secret",
]
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run Server
run: docker run -d -p 8080:8080 ghcr.io/cerberauth/api-vulns-challenges/${{ matrix.challenge }}:latest
- name: Get JWT
id: get-jwt
run: echo "jwt=$(docker run --rm ghcr.io/cerberauth/api-vulns-challenges/jwt-strong-eddsa-key:latest jwt)" >> $GITHUB_OUTPUT
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
run: go build -v ./...
- name: VulnAPI
id: vulnapi
continue-on-error: true
run: |
go run main.go scan curl http://localhost:8080 -H "Authorization: Bearer ${{ steps.get-jwt.outputs.jwt }}"
- name: Check for vulnerabilities
if: ${{ steps.vulnapi.outputs.conclusion == 'failure' }}
run: echo "Vulnerabilities found in ${{ matrix.challenge }}"
- name: Stop Server
if: ${{ always() }}
run: docker stop $(docker ps -q --filter ancestor=ghcr.io/cerberauth/api-vulns-challenges/${{ matrix.challenge }}:latest)
run-http-misconfigurations-scans:
name: HTTP Misconfigurations Scans
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- challenge: "misconfiguration.http_headers"
url: "http://localhost:8080"
- challenge: "misconfiguration.http_headers"
url: "http://localhost:8080/headers/cors-wildcard"
- challenge: "misconfiguration.http_headers"
url: "http://localhost:8080/headers/csp-frame-ancestors"
- challenge: "misconfiguration.http_cookies"
url: "http://localhost:8080/cookies/unsecure"
- challenge: "misconfiguration.http_cookies"
url: "http://localhost:8080/cookies/not-httponly"
- challenge: "misconfiguration.http_cookies"
url: "http://localhost:8080/cookies/samesite-none"
- challenge: "misconfiguration.http_cookies"
url: "http://localhost:8080/cookies/no-expiration"
- challenge: "misconfiguration.http_method_override"
url: "http://localhost:8080/cookies/http-method-override"
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run Server
run: docker run -d -p 8080:8080 ghcr.io/cerberauth/api-vulns-challenges/http-misconfigurations:latest
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
run: go build -v ./...
- name: VulnAPI
id: vulnapi
continue-on-error: true
run: |
go run main.go scan curl ${{ matrix.url }} --scans "${{ matrix.challenge }}"
- name: Check for vulnerabilities
if: ${{ steps.vulnapi.outputs.conclusion == 'failure' }}
run: echo "Vulnerabilities found in ${{ matrix.challenge }}"
- name: Stop Server
if: ${{ always() }}
run: docker stop $(docker ps -q --filter ancestor=ghcr.io/cerberauth/api-vulns-challenges/http-misconfigurations:latest)