internal: centralize size/length constants; better DoS protection

...also adds a bounded custom event registry for cardinality control but
I ran out of space in the commit message. Praise be to the long
descriptions...

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ic205f69804c7fb24c39fa84abdd9546b6a6a6964
This commit is contained in:
raf 2026-03-01 05:22:57 +03:00
commit c3b77696aa
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 118 additions and 0 deletions

View file

@ -0,0 +1,9 @@
package limits
// Size limits for request processing
const (
MaxEventSize = 4 * 1024 // 4KB max event payload
MaxPathLen = 2048 // max path length
MaxRefLen = 2048 // max referrer length
MaxWidth = 10000 // max reasonable screen width
)