feat(kb): validate slug/tags and cap text fields on article form #224
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/mapps-218-kb-article-form-validation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The New KB Article form stored a user-supplied slug verbatim (spaces,
<>, punctuation), accepted unbounded tags including markup like<script>, and set nomaxlengthon the text fields. This normalizes the slug, sanitizes tags, and caps field lengths so invalid data never reaches the API (MAPPS-218).Slug: at submit the author-entered value (or the title-derived fallback) now always passes through
slugify, which is idempotent on an already-valid slug, so the stored value is always lowercase, hyphen-separated, and free of spaces/<>/punctuation.Tags: a new
sanitize_tagshelper strips markup (</>) and control characters, trims, caps each tag atTAG_MAX(50) characters, and drops empties, replacing the previous trim-and-split that stored garbage tags verbatim.maxlength: Title, Slug, and Summary inputs and the Body textarea now carry client
maxlengthcaps mirroring the server's KB article column limits, so over-long input is blocked at the field rather than failing as an opaque 422.Adds unit tests for the slug normalization and tag sanitization paths.
#MAPPS-218
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com