Commit b5aa8ad
committed
fix: constrain the chapter catch-all route to the slug alphabet
Chapter slugs come from name.parameterize, which produces lowercase
letters, digits, hyphens, and underscores (parameterize preserves
underscores via its gsub). Constraining the catch-all (:id =>
'chapter#show') to that alphabet makes paths with dots, uppercase, or
other characters 404 at the router instead of reaching
ChapterController and the database. format: false stops Rails from
consuming a trailing .pem as an optional format segment.
Most of this traffic is scanner junk: on 2026-09-16, 91% of the 4,218
ChapterController requests were 404s, mostly sensitive-file probes.
Underscore paths still route and 404 in-app with the branded page.
Production slug audit (2026-09-19): 54 chapters, 0 slugs outside
[a-z0-9_-]+.
Closes #28911 parent 11bc410 commit b5aa8ad
2 files changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
0 commit comments