Commit 664f7cc
committed
fix(server): validate order_by on the sidebar-index route; tighten doc guard
The session-filter input struct is shared by the list and sidebar-index routes.
Dropping the order_by enum left the sidebar route accepting malformed specs like
?order_by=bogus (200, silently ignored) where the enum used to reject them.
Validate order_by in dbFilter() too so both routes return 400 on bad input.
Replace the substring-based doc guards with one test that parses the "Valid
keys:" clause into exact tokens and compares to db.SortKeys() in order, so a key
omitted from the clause can no longer be masked by the example text.1 parent 2f87182 commit 664f7cc
3 files changed
Lines changed: 34 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
140 | 146 | | |
141 | 147 | | |
142 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | 24 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
41 | 28 | | |
42 | | - | |
43 | | - | |
44 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
45 | 32 | | |
0 commit comments