Repository navigation
Expand file tree
/
Copy pathattack-strings.json
More file actions
357 lines (357 loc) · 11.8 KB
/
Copy pathattack-strings.json
File metadata and controls
357 lines (357 loc) · 11.8 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
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
{
"type": "bonjson-test",
"version": "1.0.0",
"//": "Attack string tests: bytes 0xFC-0xFF in string data. These bytes are invalid UTF-8 and must be rejected by decoders.",
"tests": [
{
"//": "=== Structural bytes in short strings (invalid UTF-8) ==="
},
{
"//": "0xFC (invalid UTF-8) as sole byte in short string",
"name": "short_string_fc_only",
"type": "decode_error",
"input_bytes": "66fc",
"expected_error": "invalid_utf8"
},
{
"//": "0xFD (invalid UTF-8) as sole byte in short string",
"name": "short_string_fd_only",
"type": "decode_error",
"input_bytes": "66fd",
"expected_error": "invalid_utf8"
},
{
"//": "0xFE (invalid UTF-8) as sole byte in short string",
"name": "short_string_fe_only",
"type": "decode_error",
"input_bytes": "66fe",
"expected_error": "invalid_utf8"
},
{
"//": "0xFF (invalid UTF-8) as sole byte in short string",
"name": "short_string_ff_only",
"type": "decode_error",
"input_bytes": "66ff",
"expected_error": "invalid_utf8"
},
{
"//": "0xFC (invalid UTF-8) between valid ASCII in short string",
"name": "short_string_fc_middle",
"type": "decode_error",
"input_bytes": "6861fc62",
"expected_error": "invalid_utf8"
},
{
"//": "0xFD (invalid UTF-8) between valid ASCII in short string",
"name": "short_string_fd_middle",
"type": "decode_error",
"input_bytes": "6861fd62",
"expected_error": "invalid_utf8"
},
{
"//": "0xFE (invalid UTF-8) between valid ASCII in short string",
"name": "short_string_fe_middle",
"type": "decode_error",
"input_bytes": "6861fe62",
"expected_error": "invalid_utf8"
},
{
"//": "0xFF between valid ASCII in short string",
"name": "short_string_ff_middle",
"type": "decode_error",
"input_bytes": "6861ff62",
"expected_error": "invalid_utf8"
},
{
"//": "All four structural bytes in one short string",
"name": "short_string_all_structural_bytes",
"type": "decode_error",
"input_bytes": "69fcfdfeff",
"expected_error": "invalid_utf8"
},
{
"//": "0xFC (invalid UTF-8) at start of multi-byte short string",
"name": "short_string_fc_start",
"type": "decode_error",
"input_bytes": "68fc6162",
"expected_error": "invalid_utf8"
},
{
"//": "0xFE (invalid UTF-8) at end of multi-byte short string",
"name": "short_string_fe_end",
"type": "decode_error",
"input_bytes": "686162fe",
"expected_error": "invalid_utf8"
},
{
"//": "=== Structural bytes in long strings (invalid UTF-8) ===",
"//note": "Long strings are FF-terminated. Bytes FC/FD/FE are valid data bytes within a long string (only FF terminates), but they are invalid UTF-8."
},
{
"//": "0xFC (invalid UTF-8) as sole data byte in long string",
"name": "long_string_fc_only",
"type": "decode_error",
"input_bytes": "fffcff",
"expected_error": "invalid_utf8"
},
{
"//": "0xFD (invalid UTF-8) as sole data byte in long string",
"name": "long_string_fd_only",
"type": "decode_error",
"input_bytes": "fffdff",
"expected_error": "invalid_utf8"
},
{
"//": "0xFE (invalid UTF-8) as sole data byte in long string",
"name": "long_string_fe_only",
"type": "decode_error",
"input_bytes": "fffeff",
"expected_error": "invalid_utf8"
},
{
"//": "0xFC (invalid UTF-8) between ASCII in long string",
"name": "long_string_fc_middle",
"type": "decode_error",
"input_bytes": "ff61fc62ff",
"expected_error": "invalid_utf8"
},
{
"//": "0xFD (invalid UTF-8) between ASCII in long string",
"name": "long_string_fd_middle",
"type": "decode_error",
"input_bytes": "ff61fd62ff",
"expected_error": "invalid_utf8"
},
{
"//": "0xFE (invalid UTF-8) between ASCII in long string",
"name": "long_string_fe_middle",
"type": "decode_error",
"input_bytes": "ff61fe62ff",
"expected_error": "invalid_utf8"
},
{
"//": "All four structural bytes as long string data (only FC/FD/FE survive; FF terminates early)",
"//note": "FF 61 FC FD FE 62 FF = long string 'a\\xFC\\xFD\\xFE b'",
"name": "long_string_three_structural_bytes",
"type": "decode_error",
"input_bytes": "ff61fcfdfe62ff",
"expected_error": "invalid_utf8"
},
{
"//": "0xFC (invalid UTF-8) at start of long string data",
"name": "long_string_fc_start",
"type": "decode_error",
"input_bytes": "fffc6162ff",
"expected_error": "invalid_utf8"
},
{
"//": "0xFE (invalid UTF-8) at end of long string data (just before FF terminator)",
"name": "long_string_fe_before_terminator",
"type": "decode_error",
"input_bytes": "ff6162feff",
"expected_error": "invalid_utf8"
},
{
"//": "=== Structural bytes in strings inside containers ===",
"//note": "These test that the decoder correctly rejects invalid UTF-8 bytes (0xFC-0xFF) inside string data."
},
{
"//": "Array containing long string with 0xFE data byte (invalid UTF-8)",
"//note": "b7 FF FE FF b6 = array( long_string('\\xFE') ) — structurally valid, but string is invalid UTF-8",
"name": "array_long_string_with_fe_byte",
"type": "decode_error",
"input_bytes": "b7fffeffb6",
"expected_error": "invalid_utf8"
},
{
"//": "Array containing short string with 0xFE data byte (invalid UTF-8)",
"//note": "b7 66 FE b6 = array( short_string('\\xFE') )",
"name": "array_short_string_with_fe_byte",
"type": "decode_error",
"input_bytes": "b766feb6",
"expected_error": "invalid_utf8"
},
{
"//": "Array containing long string with 0xFC data byte (invalid UTF-8)",
"//note": "b7 FF FC FF b6 = array( long_string('\\xFC') )",
"name": "array_long_string_with_fc_byte",
"type": "decode_error",
"input_bytes": "b7fffcffb6",
"expected_error": "invalid_utf8"
},
{
"//": "Array containing long string with 0xFD data byte (invalid UTF-8)",
"//note": "b7 FF FD FF b6 = array( long_string('\\xFD') )",
"name": "array_long_string_with_fd_byte",
"type": "decode_error",
"input_bytes": "b7fffdffb6",
"expected_error": "invalid_utf8"
},
{
"//": "Object key containing 0xFC (invalid UTF-8, short string)",
"//note": "b8 66 FC 00 b6 = object( key='\\xFC', value=0 )",
"name": "object_key_short_string_with_fc",
"type": "decode_error",
"input_bytes": "b866fc00b6",
"expected_error": "invalid_utf8"
},
{
"//": "Object key containing 0xFE (invalid UTF-8, long string)",
"//note": "b8 FF FE FF 00 b6 = object( key='\\xFE', value=0 )",
"name": "object_key_long_string_with_fe",
"type": "decode_error",
"input_bytes": "b8fffeff00b6",
"expected_error": "invalid_utf8"
},
{
"//": "Object value containing 0xFD (invalid UTF-8, long string)",
"//note": "b8 66 61 FF FD FF b6 = object( key='a', value='\\xFD' )",
"name": "object_value_long_string_with_fd",
"type": "decode_error",
"input_bytes": "b86661fffdffb6",
"expected_error": "invalid_utf8"
},
{
"//": "Nested: array in object value, inner string has FE",
"//note": "b8 66 61 b7 66 FE b6 b6 = object( key='a', value=array( short_string('\\xFE') ) )",
"name": "nested_object_array_string_with_fe",
"type": "decode_error",
"input_bytes": "b86661b766feb6b6",
"expected_error": "invalid_utf8"
},
{
"//": "=== Structural confusion: premature FF termination ===",
"//note": "When a long string's data is truncated (no FF terminator found), the decoder must report truncation, not silently misparse."
},
{
"//": "Long string data contains only FE, no FF terminator — FE is data, not terminator",
"//note": "FF 61 62 FE (no terminating FF) → truncated",
"name": "long_string_unterminated_with_fe",
"type": "decode_error",
"input_bytes": "ff6162fe",
"expected_error": "truncated"
},
{
"//": "Long string in array, data contains FE (invalid UTF-8) but no FF terminator",
"//note": "b7 FF 61 62 FE (no terminating FF) → truncated",
"name": "long_string_in_array_unterminated_fe",
"type": "decode_error",
"input_bytes": "b7ff6162fe",
"expected_error": "truncated"
},
{
"//": "Long string in array, data contains FC (invalid UTF-8) but no FF terminator",
"name": "long_string_in_array_unterminated_fc",
"type": "decode_error",
"input_bytes": "b7ff6162fc",
"expected_error": "truncated"
},
{
"//": "Long string in array, data contains FD (invalid UTF-8) but no FF terminator",
"name": "long_string_in_array_unterminated_fd",
"type": "decode_error",
"input_bytes": "b7ff6162fd",
"expected_error": "truncated"
},
{
"//": "=== Valid structural parsing near string boundaries ===",
"//note": "These are NOT error tests. They verify correct parsing when structural bytes (used properly) surround strings."
},
{
"//": "Empty long string in array: b7 FF FF b6",
"name": "valid_empty_long_string_in_array",
"type": "decode",
"input_bytes": "b7ffffb6",
"expected_value": [
""
]
},
{
"//": "Two consecutive long strings in array: b7 FF 61 FF FF 62 FF b6",
"name": "valid_two_long_strings_in_array",
"type": "decode",
"input_bytes": "b7ff61ffff62ffb6",
"expected_value": [
"a",
"b"
]
},
{
"//": "Long string value in object: b8 66 61 FF 62 FF b6",
"name": "valid_long_string_value_in_object",
"type": "decode",
"input_bytes": "b86661ff62ffb6",
"expected_value": {
"a": "b"
}
},
{
"//": "Long string key and value in object: b8 FF 61 FF FF 62 FF b6",
"name": "valid_long_string_key_and_value",
"type": "decode",
"input_bytes": "b8ff61ffff62ffb6",
"expected_value": {
"a": "b"
}
},
{
"//": "Empty long string as object key: b8 FF FF 00 b6",
"name": "valid_empty_long_string_key",
"type": "decode",
"input_bytes": "b8ffff00b6",
"expected_value": {
"": 0
}
},
{
"//": "Array with mix of short and long strings: b7 66 61 FF 62 FF 66 63 b6",
"name": "valid_mixed_short_long_strings",
"type": "decode",
"input_bytes": "b76661ff62ff6663b6",
"expected_value": [
"a",
"b",
"c"
]
},
{
"//": "Nested arrays with long strings: b7 b7 FF 61 FF b6 b7 FF 62 FF b6 b6",
"name": "valid_nested_arrays_with_long_strings",
"type": "decode",
"input_bytes": "b7b7ff61ffb6b7ff62ffb6b6",
"expected_value": [
[
"a"
],
[
"b"
]
]
},
{
"//": "Deeply nested container with long string leaf: b7 b7 b7 FF 78 FF b6 b6 b6",
"name": "valid_deeply_nested_long_string",
"type": "decode",
"input_bytes": "b7b7b7ff78ffb6b6b6",
"expected_value": [
[
[
"x"
]
]
]
},
{
"//": "Object containing array containing long string with FE-adjacent bytes (0xFB is valid)",
"//note": "0xFB is typed array uint64. It's invalid UTF-8, so we use 0x7B ('{') which is the last valid ASCII byte before the 0xFC-0xFF range",
"name": "valid_string_with_high_ascii_in_nested",
"type": "decode",
"input_bytes": "b86661b7ff7b7dffb6b6",
"expected_value": {
"a": [
"{}"
]
}
}
]
}