You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Unicode-minus default tax input is converted into a positive rate #4842
I'm doing some research for Tessl Code Review and we ran it against your repo. It flagged a potential issue, and I figured it made sense to share it with you:
Config::postSaveTax sanitizes the submitted rate before checking whether it is negative. An input such as −5 (U+2212 minus) loses its sign during FILTER_SANITIZE_NUMBER_FLOAT, leaving 5 for parse_tax and the non-negative check. The save path can therefore replace a default tax rate with a positive value instead of rejecting the negative input.
Steps to reproduce
In a disposable installation, submit the Tax configuration request as an authorized administrator with default_tax_1_rate=−5 (Unicode U+2212), a valid second rate, and the other required form values.
Compare with the ASCII input -5.
Inspect the saved rate and response. The Unicode sign is removed before parsing; the ASCII minus survives and reaches the rejection check.
Expected behavior
Reject a negative rate without changing the saved setting. Unsupported number formats should be rejected rather than converted into a different positive value.
Source and validation
Checked current master at 57db3a0a8a900945c430c2b00c167aaea803c7b2.
Source inspection only; no live installation or database write was performed. The sign-loss conclusion follows the current sanitizer call and PHP's documented character allowlist. The locale parser receives the already-altered string.
PHP documents the sanitizer and fraction flag here: sanitization constants. This concerns the default-tax configuration path, separate from the item-tax validation reports.
Full transparency: I work at Tessl, and we've spotted that using Tessl Code Review - using repository-level context and specific review lenses that improve over time through feedback. That’s how this finding surfaced.
We’re just getting started and want to offer the tool free to open-source projects. If this is useful, happy to give you access.
Activity