38
38
run : jq --version
39
39
40
40
41
-
41
+
42
42
43
43
with :
44
44
go-version : 1.23
76
76
77
77
- run : yarn generate-api-server-config
78
78
79
- - run : jq '.authorizationProtocol = "NONE"' .config.json > .config2.json && mv .config2.json .config.json
80
-
81
79
# Delete the first and the second items in the array (remove keychain and manual consortium plugins)
82
80
- run : jq 'del(.plugins[0,1])' .config.json > .config2.json && mv .config2.json .config.json
83
81
@@ -104,27 +102,53 @@ jobs:
104
102
- name : Print Nuclei URL List File - ./urls.txt
105
103
run : cat urls.txt
106
104
105
+ - name : Generate Audience and Issuer
106
+ id : generate_ids
107
+ run : |
108
+ echo "audience=$(uuidgen)" >> "$GITHUB_ENV"
109
+ echo "issuer=$(uuidgen)" >> "$GITHUB_ENV"
110
+
111
+ - name : Generate RSA Keys
112
+ run : |
113
+ openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048
114
+ openssl rsa -in private_key.pem -pubout -out public_key.pem
115
+
116
+ - run : jq '.expressJwtOptions.secret = "$(cat public_key.pem)" |
117
+ .expressJwtOptions.algorithms = ["RS256"] |
118
+ .expressJwtOptions.issuer = "${{ env.issuer }}" |
119
+ .expressJwtOptions.audience = "${{ env.audience }}"' .config.json > .config2.json && mv .config2.json .config.json
120
+
121
+ - name : Generate Auth Bearer Token
122
+ run : |
123
+ HEADER_B64=$(echo '{"alg":"RS256"}' | openssl base64 -e -A | tr -d '=' | tr '/+' '_-')
124
+ PAYLOAD_B64=$(echo '{"scope":"read:health","iss":"${{ env.issuer }}","aud":"${{ env.audience }}"}' | openssl base64 -e -A | tr -d '=' | tr '/+' '_-')
125
+
126
+ SIGNATURE=$(echo -n "$HEADER_B64.$PAYLOAD_B64" | openssl dgst -sha256 -sign private_key.pem | openssl base64 -e -A | tr -d '=' | tr '/+' '_-')
127
+ JWT="$HEADER_B64.$PAYLOAD_B64.$SIGNATURE"
128
+ echo "dast_jwt=$JWT" >> "$GITHUB_ENV"
129
+
107
130
- name : Start API Server & Run DAST
108
131
uses :
BerniWittmann/[email protected]
109
132
env :
110
- # Needed because the wait-on syntax otherwise keeps thinking that
111
- # there is a problem due to our self signed certificates on the
112
- # test instance of the API server
113
- NODE_TLS_REJECT_UNAUTHORIZED : 0
133
+ # Needed because the wait-on syntax otherwise keeps thinking that
134
+ # there is a problem due to our self signed certificates on the
135
+ # test instance of the API server
136
+ NODE_TLS_REJECT_UNAUTHORIZED : 0
114
137
with :
115
138
build : yarn --version
116
139
start : yarn start:api-server
117
140
command : " nuclei -version"
118
141
command-windows : echo "The project build is not supported on the Windows operating system. Please use Linux or macOS"
119
- wait-on : " https://localhost:4000/api/v1/api-server/healthcheck"
120
142
# wait for 10 minutes for the server to respond
121
143
wait-on-timeout : 120
122
-
144
+ wait-on-command : |
145
+ curl -X GET https://localhost:4000/api/v1/api-server/healthcheck -k -H "Authorization: Bearer ${{ env.dast_jwt }}"
146
+
123
147
- name : Run the dast nuclei scan
124
148
run : " nuclei -list=urls.txt -dast -severity=high,critical -sarif-export ~/nuclei.sarif -output=nuclei.log"
125
149
126
150
- name : GitHub Workflow artifacts
127
151
128
152
with :
129
153
name : nuclei.log
130
- path : nuclei.log
154
+ path : nuclei.log
0 commit comments