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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
use crate::{corpus_from_strategy, fuzz_data_to_value, FuzzTargetImpl};
use diem_proptest_helpers::ValueGenerator;
use diem_vault_client::{
fuzzing::{
arb_generic_response, arb_policy_list_response, arb_secret_list_response,
arb_secret_read_response, arb_token_create_response, arb_token_renew_response,
arb_transit_create_response, arb_transit_export_response, arb_transit_list_response,
arb_transit_read_response, arb_transit_sign_response, arb_unsealed_response,
},
process_generic_response, process_policy_list_response, process_policy_read_response,
process_secret_list_response, process_secret_read_response, process_token_create_response,
process_token_renew_response, process_transit_create_response, process_transit_export_response,
process_transit_list_response, process_transit_read_response, process_transit_restore_response,
process_transit_sign_response, process_unsealed_response,
};
#[derive(Clone, Debug, Default)]
pub struct VaultGenericResponse;
impl FuzzTargetImpl for VaultGenericResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_generic_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_generic_response()))
}
fn fuzz(&self, data: &[u8]) {
let input = fuzz_data_to_value(data, arb_generic_response());
let _ = process_generic_response(input);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultPolicyReadResponse;
impl FuzzTargetImpl for VaultPolicyReadResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_policy_read_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_generic_response()))
}
fn fuzz(&self, data: &[u8]) {
let input = fuzz_data_to_value(data, arb_generic_response());
let _ = process_policy_read_response(input);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultPolicyListResponse;
impl FuzzTargetImpl for VaultPolicyListResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_policy_list_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_policy_list_response()))
}
fn fuzz(&self, data: &[u8]) {
let input = fuzz_data_to_value(data, arb_policy_list_response());
let _ = process_policy_list_response(input);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultSecretListResponse;
impl FuzzTargetImpl for VaultSecretListResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_secret_list_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_secret_list_response()))
}
fn fuzz(&self, data: &[u8]) {
let response = fuzz_data_to_value(data, arb_secret_list_response());
let _ = process_secret_list_response(response);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultSecretReadResponse;
impl FuzzTargetImpl for VaultSecretReadResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_secret_read_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_secret_read_response()))
}
fn fuzz(&self, data: &[u8]) {
let (response, key, secret) = fuzz_data_to_value(data, arb_secret_read_response());
let _ = process_secret_read_response(&secret, &key, response);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultTokenCreateResponse;
impl FuzzTargetImpl for VaultTokenCreateResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_token_create_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_token_create_response()))
}
fn fuzz(&self, data: &[u8]) {
let response = fuzz_data_to_value(data, arb_token_create_response());
let _ = process_token_create_response(response);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultTokenRenewResponse;
impl FuzzTargetImpl for VaultTokenRenewResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_token_renew_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_token_renew_response()))
}
fn fuzz(&self, data: &[u8]) {
let response = fuzz_data_to_value(data, arb_token_renew_response());
let _ = process_token_renew_response(response);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultTransitCreateResponse;
impl FuzzTargetImpl for VaultTransitCreateResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_transit_create_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_transit_create_response()))
}
fn fuzz(&self, data: &[u8]) {
let (response, name) = fuzz_data_to_value(data, arb_transit_create_response());
let _ = process_transit_create_response(&name, response);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultTransitExportResponse;
impl FuzzTargetImpl for VaultTransitExportResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_transit_export_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_transit_export_response()))
}
fn fuzz(&self, data: &[u8]) {
let (response, name, version) = fuzz_data_to_value(data, arb_transit_export_response());
let _ = process_transit_export_response(&name, version, response);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultTransitListResponse;
impl FuzzTargetImpl for VaultTransitListResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_transit_list_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_transit_list_response()))
}
fn fuzz(&self, data: &[u8]) {
let input = fuzz_data_to_value(data, arb_transit_list_response());
let _ = process_transit_list_response(input);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultTransitReadResponse;
impl FuzzTargetImpl for VaultTransitReadResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_transit_read_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_transit_read_response()))
}
fn fuzz(&self, data: &[u8]) {
let (response, name) = fuzz_data_to_value(data, arb_transit_read_response());
let _ = process_transit_read_response(&name, response);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultTransitRestoreResponse;
impl FuzzTargetImpl for VaultTransitRestoreResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_transit_restore_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_generic_response()))
}
fn fuzz(&self, data: &[u8]) {
let input = fuzz_data_to_value(data, arb_generic_response());
let _ = process_transit_restore_response(input);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultTransitSignResponse;
impl FuzzTargetImpl for VaultTransitSignResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_transit_sign_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_transit_sign_response()))
}
fn fuzz(&self, data: &[u8]) {
let input = fuzz_data_to_value(data, arb_transit_sign_response());
let _ = process_transit_sign_response(input);
}
}
#[derive(Clone, Debug, Default)]
pub struct VaultUnsealedResponse;
impl FuzzTargetImpl for VaultUnsealedResponse {
fn description(&self) -> &'static str {
"Secure storage vault: process_unsealed_response()"
}
fn generate(&self, _idx: usize, _gen: &mut ValueGenerator) -> Option<Vec<u8>> {
Some(corpus_from_strategy(arb_unsealed_response()))
}
fn fuzz(&self, data: &[u8]) {
let input = fuzz_data_to_value(data, arb_unsealed_response());
let _ = process_unsealed_response(input);
}
}