config: refuse a negative max_snippets_per_user at load #214

closed cmc opened this on 2026-09-12 02:18 UTC

Discussion

cmc 2026-09-12 02:18 UTC

max_repos_per_user and max_bytes_per_user are rejected at config load when negative (internal/config/config.go:280). The max_snippets_per_user limit added in v1.20.0 (#195) has no such check: a negative value passes validation and snippet create treats it as unlimited, since the cap is enforced only when the limit is above 0 (internal/control/snippet.go, runSnippetCreate).

Add MaxSnippetsPerUser to the same load-time check so a misconfigured cap fails the daemon start instead of silently turning the limit off, and cover it in the config package test beside the existing negative-limit case.

Ref #195

closed by commit 92e025a4f6 by cmc: config: refuse a negative max_snippets_per_user

2026-09-12 02:31 UTC