Repository navigation
Commit 1146734
security: Bound the size and the types of an ingested report
/incidents/create takes a body from anybody and sends a notification email for
every stored report. The reading of the payload was hardened twice for the
types, by 10a7e83 and f002513, without bounding its size: a body of any
length was decoded, a report whose errors was not a list stopped on a count()
TypeError, a stack that was not a list stopped on a foreach, a mistyped scalar
stopped on a TypeError, and a string longer than its column stopped on an SQL
error once the row was built.
Refuse a body over 1 MiB with a 413 before decoding it, keep the first 40 errors
and the first 40 stack frames, cut the strings to the length of their column,
read the scalars defensively, and refuse a report whose full report or
stacktrace would not fit in a TEXT column.
Signed-off-by: William Desportes <williamdes@wdes.fr>
Co-Authored-By: DeepSeek <noreply@deepseek.com>1 parent 7eacb2c commit 1146734
4 files changed
Lines changed: 388 additions & 49 deletions
File tree
- src
- Controller
- Model/Table
- tests/TestCase
- Controller
- Model/Table
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
| |||
74 | 86 | | |
75 | 87 | | |
76 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
77 | 99 | | |
78 | 100 | | |
79 | | - | |
| 101 | + | |
80 | 102 | | |
81 | 103 | | |
82 | 104 | | |
| |||
115 | 137 | | |
116 | 138 | | |
117 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
118 | 153 | | |
119 | 154 | | |
120 | 155 | | |
| |||
0 commit comments