Repository navigation
fix(l10n): evaluate the plural header without the Function constructor - #9983
Merged
Merged
Conversation
The runtime check compiled the bundle's plural= expression with new Function. A small parser for the C subset that plural headers use now evaluates it, and rejects anything else. Assisted-by: ClaudeCode:claude-opus-5-5
Contributor
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ❌ | ||||
| psalm | ❌ | ||||
| phpstan | ❌ | ||||
| phpmetrics | ✅ | ||||
| eslint | ❌ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| check-specs | ✅ | ||||
| test-l10n | ❌ | ||||
| test-l10n-parity | ❌ | ||||
| format | ❌ | ||||
| check-schema-l10n | ✅ | ||||
| test-newman-route-ratchet | ✅ | ||||
| composer | ✅ | ✅ 169/169 | |||
| npm | ✅ | ✅ 639/639 | |||
| app:check-code | ⏭️ | ||||
| info.xml | ✅ | ||||
| REUSE | ✅ | ||||
| lockfile sync | ✅ | ||||
| PHPUnit | ❌ 56561/56769 · 27 skipped (worst of 6 legs: PHP 8.3, NC stable32, pgsql; counts from 6 of 8 legs) | ||||
| Newman | ❌ | ||||
| Playwright | ❌ 237/324 · 5 skipped · 164 did not run | ||||
| Hydra gates | ❌ |
Quality workflow — 2026-11-14 09:00 UTC
Download the full PDF report from the workflow artifacts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
scripts/l10n/runtime-check.mjscompiled theplural=expression from a locale bundle's header withnew Function, which is dynamic code execution. It now goes throughscripts/l10n/pluralExpression.js, a small parser for the C subset that gettext plural headers use: integers,n, parentheses,! * / % + -, comparisons,&& ||and? :. Anything else throws aSyntaxError, and the check reports that as a failed assertion, the same way a parse error was reported before.Criterion result (fork checker,
owaspsecurecoding)Run with the fork's own
checkOwaspSecureCodingagainst main and against this branch.This was the one real hit of the 13. The other 12 are false positives in the checker's heuristic, not in this code:
eval()named in a comment (MetricExpressionEvaluator,UnaryTestEvaluator, both of which exist so that nothing calls eval), and PyTorch'smodel.eval()method indocker/dolphin/api_server.py.portal_assertion_secret,openregister_case_token), a hash prefix, redaction placeholders ([redacted],[erased]), two regular expressions, a format to input-type map (password: 'password') and a bound Vue attribute (:token="createdToken").The checker already leaves tests out of this scan, so these sit in production code. Renaming constants or rewording comments to dodge a regex would make the code worse. The fix belongs in the checker, and the fork PR above does that.
Verified locally
node scripts/l10n/runtime-check.mjs <loc>for nl, de, is, mk, pl and ar gives the same output as before (nl and ar were already failing on main, for reasons unrelated to plurals).new Functionon everyplural=expression inl10n/*.json(16 distinct), for n from 0 to 1000.npx jest scripts/l10n/pluralExpression.spec.js: 13 passed.runtime-check.mjskeeps 14 inherited jsdoc warnings on lines this PR does not touch.AI assistance: prepared with Claude Code (Opus 5.5) and reviewed before submission.