Closed emma-miler closed 2 years ago
Bad idea this is ngl. Would stop many non-latin alphabetical characters being used
Hmmm, given that the set of all Titanfall maps and gamemodes is known, we could actually even go more restrictive for those and limit those to pre-defined values. (Will require master server update though if we add new maps or modes)
For server names I agree that we should allow valid UTF-8 text. Issue is homoglyph attacks to get around word filter etc. Maybe there's a library that handles that?
Modded gamemodes exist though
Modded gamemodes exist though
True. So I guess keep ASCII requirement for modded gamemodes? Doubt they'll ever include UTF-8.
Potential candidate for UTF-8 filter: https://www.npmjs.com/package/utf-8-validate
That doesn't actually do what we want it to do. Running that with the data from before, it returns valid. It is checking for a valid utf-8 string from a bytearray.
After some more digging, i found the following regex:
/[\p{Cc}\p{Cn}\p{Cs}]+/gu
from this stackoverflow thread.
I ran it against a capture of earlier data and it seems to perfectly match all bad servers, while not including any legit servers. Also tried this with some chinese and japanese glyphs, and those seems to work fine too.
Not necessary at the moment, will revisit if an issue arises again.
@barnabwhy wanna give it a look? <3
Seems to be working fine so far in prod.