-
Notifications
You must be signed in to change notification settings - Fork 111
196 lines (182 loc) · 7.35 KB
/
Copy pathnightly-fuzz.yml
File metadata and controls
196 lines (182 loc) · 7.35 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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: Nightly Fuzz
on:
schedule:
- cron: '17 2 * * *'
workflow_dispatch:
inputs:
fuzztime:
default: '4h'
required: true
description: 'Duration passed to go test -fuzztime for each target'
permissions:
contents: read
env:
GOFLAGS: -mod=mod
jobs:
fuzz:
runs-on: ubuntu-latest
timeout-minutes: 300
permissions:
contents: read
issues: write
strategy:
fail-fast: false
matrix:
include:
- name: common-verify-token-request
pkg: ./token/core/common
func: FuzzVerifyTokenRequestFromRawNoPanic
- name: common-signature-envelope
pkg: ./token/core/common
func: FuzzStructuredTokenRequestSignatureEnvelope
- name: fabtoken-action-deserializer
pkg: ./token/core/fabtoken/v1/validator
func: FuzzActionDeserializerNoPanic
- name: zkatdlog-action-deserializer
pkg: ./token/core/zkatdlog/nogh/v1/validator
func: FuzzActionDeserializerNoPanic
- name: common-asn1-unmarshaller
pkg: ./token/core/common/encoding/asn1
func: FuzzUnmarshallerNoPanic
- name: zkatdlog-multi-action-deserializer
pkg: ./token/core/zkatdlog/nogh/v1/validator
func: FuzzActionDeserializerMultiActionNoPanic
- name: identity-marshal-decode-identity
pkg: ./token/services/identity/marshal
func: FuzzDecodeIdentityNoPanic
- name: identity-multisig-deserializer
pkg: ./token/services/identity/multisig
func: FuzzMultiIdentityDeserializeNoPanic
- name: identity-multisig-signature-from-bytes
pkg: ./token/services/identity/multisig
func: FuzzMultiSignatureFromBytesNoPanic
- name: identity-idemix-audit-info-deserializer
pkg: ./token/services/identity/idemix/crypto
func: FuzzDeserializeAuditInfoNoPanic
- name: identity-idemixnym-audit-info-deserializer
pkg: ./token/services/identity/idemixnym/nym
func: FuzzDeserializeAuditInfoNoPanic
- name: identity-boolpolicy-audit-info-deserializer
pkg: ./token/services/identity/boolpolicy
func: FuzzDeserializeAuditInfoNoPanic
- name: common-request-limits
pkg: ./token/core/common
func: FuzzRequestResourceLimits
- name: zkatdlog-action-limits
pkg: ./token/core/zkatdlog/nogh/v1/validator
func: FuzzActionResourceLimits
- name: fabtoken-action-limits
pkg: ./token/core/fabtoken/v1/validator
func: FuzzActionResourceLimits
- name: zkatdlog-issue-bulletproof-verifier
pkg: ./token/core/zkatdlog/nogh/v1/issue
func: FuzzBulletProofVerifierNoPanic
- name: zkatdlog-issue-csp-verifier
pkg: ./token/core/zkatdlog/nogh/v1/issue
func: FuzzCSPVerifierNoPanic
- name: zkatdlog-transfer-bulletproof-verifier
pkg: ./token/core/zkatdlog/nogh/v1/transfer
func: FuzzBulletProofVerifierNoPanic
- name: zkatdlog-transfer-csp-verifier
pkg: ./token/core/zkatdlog/nogh/v1/transfer
func: FuzzCSPVerifierNoPanic
- name: zkatdlog-token-deserialize
pkg: ./token/core/zkatdlog/nogh/v1/token
func: FuzzTokenDeserializeNoPanic
- name: zkatdlog-metadata-deserialize
pkg: ./token/core/zkatdlog/nogh/v1/token
func: FuzzMetadataDeserializeNoPanic
- name: zkatdlog-public-params-deserialize
pkg: ./token/core/zkatdlog/nogh/v1/setup
func: FuzzPublicParamsDeserializeNoPanic
- name: zkatdlog-upgrade-proof-deserialize
pkg: ./token/core/zkatdlog/nogh/v1/crypto/upgrade
func: FuzzProofDeserializeNoPanic
- name: fabricx-endorser-for-threshold-rule
pkg: ./token/services/network/fabricx/endorsement
func: FuzzEndorserForThresholdRuleNoPanic
- name: fabtoken-owner-verifier
pkg: ./token/core/fabtoken/v1/driver
func: FuzzOwnerVerifierNoPanic
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache-dependency-path: "**/*.sum"
- name: Restore fuzz corpus cache
uses: actions/cache@v4
with:
path: ~/.cache/go-build/fuzz
key: fuzz-${{ matrix.name }}-${{ github.run_id }}
restore-keys: |
fuzz-${{ matrix.name }}-
- name: Run fuzz campaign
run: |
set -o pipefail
go test ${{ matrix.pkg }} \
-run='^$' \
-fuzz='^${{ matrix.func }}$' \
-fuzztime="${{ github.event.inputs.fuzztime || '4h' }}" \
2>&1 | tee fuzz-output.log
- name: Collect crash artifacts
if: failure()
run: |
mkdir -p fuzz-failure
cp fuzz-output.log fuzz-failure/ || true
find "${{ matrix.pkg }}" -type d -path "*/testdata/fuzz/${{ matrix.func }}*" \
-exec cp -r {} fuzz-failure/ \; || true
- name: Upload crash artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: fuzz-failure-${{ matrix.name }}
path: fuzz-failure/
retention-days: 30
- name: File or update GitHub issue
if: failure()
uses: actions/github-script@v7
with:
script: |
const name = '${{ matrix.name }}'
const pkg = '${{ matrix.pkg }}'
const func = '${{ matrix.func }}'
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
const title = `Nightly fuzz failure: ${name}`
const body = [
`The nightly fuzz workflow found a failing input for \`${func}\` in \`${pkg}\`.`,
'',
`**Latest failing run:** ${runUrl}`,
'',
'Download the `fuzz-failure-' + name + '` artifact from that run for the',
'failing seed and full log, then reproduce locally with:',
'',
'```bash',
`go test ${pkg} -run='${func}/<hash>'`,
'```',
'',
'If confirmed, commit the failing seed file into the target\'s',
'`testdata/fuzz/' + func + '/` directory to add it to the permanent regression corpus.',
].join('\n')
const existing = await github.rest.search.issuesAndPullRequests({
q: `repo:${context.repo.owner}/${context.repo.repo} is:issue is:open in:title "${title}"`,
})
if (existing.data.items.length > 0) {
const issue = existing.data.items[0]
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: `New failing run: ${runUrl}`,
})
} else {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
body,
labels: ['testing', 'bug'],
})
}