note: both pages do not set a language in the html tag
get an en-US default hash/strings [1]
[1] for reference, this is en-US
DOCUMENT: validation_messages: ca1379a9{ "BadInputNumber": "Please enter a number.", "CheckboxMissing": "Please check this box if you want to proceed.", "DateTimeRangeOverflow": "Please select a value that is no later than 2023-12-31.", "DateTimeRangeUnderflow": "Please select a value that is no earlier than 2023-12-31.", "FileMissing": "Please select a file.", "InvalidEmail": "Please enter an email address.", "InvalidURL": "Please enter a URL.", "NumberRangeOverflow": "Please select a value that is no more than 2.", "NumberRangeUnderflow": "Please select a value that is no less than 2.", "PatternMismatch": "Please match the requested format.", "RadioMissing": "Please select one of these options.", "SelectMissing": "Please select an item in the list.", "StepMismatch": "Please select a valid value. The two nearest valid values are 2 and 4.", "ValueMissing": "Please fill out this field."}
STR
change app language to ar, fa, or my and restart to apply
change to spoof english
test
ER
you get the en-US hash
AR
you don't get the expected en_US hash (pic is ar)
ANALYSIS
dates: this seems to always be 2023-12-31 format regardless of locale, this is the valid set in the element's min or max value. It can change order on RTL (when not spoofing as english) e.g. 31-12-2023 but that is because of RTL not formatting, so I think dates are not affected
numbers - not all validation messages with numbers were affected, so this is definitely fixable
the only line that failed to get spoofed (in my tests which may/maynot be exhaustive) is the one in the pic
here's the hashes when spoofing as en-US (yes, the arabext 4 is different from the arab 4) and en-US for comparison
numberingSystemapp: | hash: string: ar: arab: a74be209: "Please select a valid value. The two nearest valid values are ٢ and ٤.", fa: arabext: a4227729: "Please select a valid value. The two nearest valid values are ۲ and ۴.", my: mymr: 36e68dc9: "Please select a valid value. The two nearest valid values are ၂ and ၄." en: latn: ca1379a9: "Please select a valid value. The two nearest valid values are 2 and 4."
numbers - not all validation messages with numbers were affected, so this is definitely fixable
Yes, sometimes the English dom.properties is used, check GetMaybeSpoofedPropertiesFile (called by nsContentUtils::GetMaybeLocalizedString) in dom/base/nsContentUtils.cpp.
If we're lucky enough, GetLocalizedString is called instead of GetMaybeLocalizedString where these strings are returned, and we can just replace the function...
However, I've found that ConvertNumberToString eventually calls Decimal::toString...
I need to dig it more (even though I can try to make the underflow/overflow call it, to see if it's magically converted to the localized number as well).
but, I can also make the argument that it should always reflect web-content language/locale (in which case we wouldn't have any issues - e.g. localization of the date picker etc) - I mean the user wants to use web pages in that requested language
edit: checking ar it seemed to come up okay with (PNG Image, 800 × 1 pixels) — Scaled (12%) but IDK if that's because it's not localized or because we're lucky
{"BadInputNumber":"Please enter a number.","CheckboxMissing":"Please check this box if you want to proceed.","DateTimeRangeOverflow":"Please select a value that is no later than 2023-12-31.","DateTimeRangeUnderflow":"Please select a value that is no earlier than 2023-12-31.","FileMissing":"Please select a file.","InvalidEmail":"Please enter an email address.","InvalidURL":"Please enter a URL.","NumberRangeOverflow":"Please select a value that is no more than ٢.","NumberRangeUnderflow":"Please select a value that is no less than ٢.","PatternMismatch":"Please match the requested format.","RadioMissing":"Please select one of these options.","SelectMissing":"Please select an item in the list.","StepMismatch":"Please select a valid value. The two nearest valid values are ٢ and ٤.","ValueMissing":"Please fill out this field."}
Now, let's understand how Decimal::toString uses formatted numbers.
edit: checking ar it seemed to come up okay with (PNG Image, 800 × 1 pixels) — Scaled (12%) but IDK if that's because it's not localized or because we're lucky
I think we should look for LocalizeNumber instead, but:
now it's patched
it was used only for this functionality
As for LanguageTagIterForContent, it's used also in ConvertStringToNumber, but nothing else.
I wonder if we've now broken inputs for users with other numerals.
AFAICT we can set any value (even a string like banana [1]!!) for the number input: non numeric need to be strings, but we can also set them as strings i.e 4 vs "4". I have included both. I have also included v and x (see test code comments)
And this doesn't seem to leak anything whatsoever - it's the same regardless of (web content) locale, so I doubt app lang being different could even affect it
everyone everywhere all at once should be 2123ce85
<!DOCTYPE html><html><head><metahttp-equiv="Content-Type"content="text/html; charset=utf-8"><title>inputtest</title><style>body{background-color:white;color:black;}.mono{font-family:monospace,"Courier New";font-size:11px;}.spaces{white-space:pre-wrap;}</style></head><body><tablewidth="600"><colwidth="40%"><colwidth="60%"><tr><td>StepMismatch (min 6)</td><td><inputid="inputtest"type="number"min="6"step="2"/></td></tr><tr><tdcolspan="2"><spanid="inputresult"class="mono spaces"></span></td></tr></table><script>'use strict';functionmini(str){constjson=`${JSON.stringify(str)}`leti,len,hash=0x811c9dc5for(i=0,len=json.length;i<len;i++){hash=Math.imul(31,hash)+json.charCodeAt(i)|0}return ('0000000'+(hash>>>0).toString(16)).slice(-8)}lettarget=document.getElementById("inputtest")letoTests={// 1st value expected valid then v// 3rd value expected invalid then x// v + x so we can check we're not falling back to the previous statear:['٤','v','٦','x'],en:['4',4,'v','6',6,'x'],fa:['۴','v','۶','x'],my:['၄','v','၆','x'],}letoData={},aDisplay=[]for (constkofObject.keys(oTests)){oData[k]={}aDisplay.push("\""+k+"\": {")oTests[k].forEach(function(n){target.value=nletvalue=target.valueletcharName,charValue,jif ("string"===typeofn){charName="charCode";charValue=n.charCodeAt(0);j=n}else{charName="number";charValue=n;j=n+"_number"}letvalidity=target.checkValidity()oData[k][j]={}oData[k][j][charName]=charValueoData[k][j]["value"]=valueoData[k][j]["validity"]=validityif ("string"===typeofvalue){value="\""+value+"\""}aDisplay.push("\""+j+"\": {\""+charName+"\": "+charValue+", \"value\": "+value+", \"validity\": "+validity+"}")})aDisplay.push(" }")}document.getElementById("inputresult").innerHTML=mini(oData)+":<br>{"+aDisplay.join("<br>")+"<br>}"</script></body></html>
Could you please check commit hash of the build you checked in about:buildconfig? I think the nightly you checked didn't have the changes yet, the one that has them will arrive in 2-4 hours (it will be 2024-01-19).
Oh, I see what happened. The Windows binaries are already available for download/update, even though the nightly task hasn't finished yet (we get an email when all builds - TBB + MB - are done).
Thorinchanged title from spoof english with non-latn numberingSystem languages, leaks numberingSystem to spoof english leaks via numberingSystem: numbers (non-latn) or decimal separator (latn)
changed title from spoof english with non-latn numberingSystem languages, leaks numberingSystem to spoof english leaks via numberingSystem: numbers (non-latn) or decimal separator (latn)