Skip to content

feat: enable crs_validate_utf8_encoding by default#4647

Merged
fzipi merged 2 commits into
coreruleset:mainfrom
fzipi:worktree-enable-utf8-validation-default
Jun 2, 2026
Merged

feat: enable crs_validate_utf8_encoding by default#4647
fzipi merged 2 commits into
coreruleset:mainfrom
fzipi:worktree-enable-utf8-validation-default

Conversation

@fzipi

@fzipi fzipi commented Jun 2, 2026

Copy link
Copy Markdown
Member

what

enables UTF-8 encoding validation (rule 920250) by default on main.

  • rules/REQUEST-901-INITIALIZATION.conf (901169): default tx.crs_validate_utf8_encoding to 1 instead of 0
  • crs-setup.conf.example: documents the check as enabled by default; the SecAction (900950) now serves as the opt-out (sets the variable to 0) for sites that send request parameters in a non-UTF-8 encoding. wording also clarifies that only UTF-8 is validated (UTF-16 and other encodings are not checked by @validateUtf8Encoding)
  • tests/docker-compose.yml: removes the VALIDATE_UTF8_ENCODING: 1 override so the regression suite exercises the new default rather than forcing it on
  • tests/.../920250.yaml: updates the now-outdated comment

why

per the decision recorded in the monthly chat (#4646): we don't have data either way on the false-positive impact, so we enable it by default on main, gather feedback from users, and decide on an LTS backport later.

@validateUtf8Encoding runs against REQUEST_FILENAME|ARGS|ARGS_NAMES. per the WHATWG URL standard and RFC 3986 convention, URLs and query strings are UTF-8 (non-ASCII is percent-encoded as UTF-8 bytes), so raw non-UTF-8 parameters are non-standard and the false-positive surface for legitimate traffic is small. sites that genuinely use a non-UTF-8 parameter encoding can opt out via 900950.

verification: full regression suite run with the new default. all 920250 tests pass driven solely by the default (env override removed). the only two failing tests (920360-1, 920380-1) fail identically on the unmodified baseline and are unrelated to this change (they depend on arg-length/arg-count limits not applied by the test entrypoint).

refs

ai disclosure

  • tools used: Claude (Opus 4.8)
  • assisted with: locating the config/init/test mechanism for the feature, drafting the crs-setup.conf.example comment rewording, PR description drafting
  • review performed: ran the full go-ftw regression suite and confirmed 920250 passes on the new default with the VALIDATE_UTF8_ENCODING override removed; established a baseline by stashing the change and confirming the two unrelated failures (920360-1, 920380-1) pre-exist; verified the operator only validates UTF-8 and confirmed the @validateUtf8Encoding target variables against the RFC 3986 / WHATWG URL conventions; checked there are no other references to the setting in docs/INSTALL/README

UTF-8 encoding validation (rule 920250) was opt-in. Per the monthly chat
decision in coreruleset#4646, enable it by default on main to gather user feedback,
with possible backport to LTS later.

- rule 901169: default tx.crs_validate_utf8_encoding to 1 instead of 0
- crs-setup.conf.example: document the check as enabled by default; the
  SecAction (900950) now disables it for sites using non-UTF-8 parameters
- tests: drop VALIDATE_UTF8_ENCODING override so the regression suite
  exercises the new default

Refs: coreruleset#4646
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

📊 Quantitative test results for language: eng, year: 2023, size: 10K, paranoia level: 1:
🚀 Quantitative testing did not detect new false positives

@fzipi
fzipi requested a review from a team June 2, 2026 10:16
@fzipi fzipi added 🚀 enhancement New feature or request release:new-feature This PR introduces a new feature labels Jun 2, 2026
Comment thread crs-setup.conf.example Outdated
Co-authored-by: Esad Cetiner <104706115+EsadCetiner@users.noreply.github.com>
@fzipi
fzipi added this pull request to the merge queue Jun 2, 2026
Merged via the queue into coreruleset:main with commit b9f5c36 Jun 2, 2026
8 checks passed
@fzipi
fzipi deleted the worktree-enable-utf8-validation-default branch June 2, 2026 10:50
@HackingRepo

Copy link
Copy Markdown
Contributor

i agree with fzipi that needs be backported, why a request needs to be no UTF8 encoding, there a no legitimate reason to be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:new-feature This PR introduces a new feature 🚀 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants