Since the console route is unauthenticated, I had a filter that censors numbers to hide things like IPs. However, a person should at least be able to see what players there are, using the /list command. So, the filter used to check if a line contains a specific string that /list outputs, but this could allow players to type that string to bypass the filter. I first fixed this with a regex, ^.+]: There are, but my benchmarks showed that it took 100x longer than the original. I finally fixed it by splitting the line by ] and checking if specific indexes (depending on the server type) start with the string. This solution takes around the same time as the original (avg ~1μs).
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.