News for hackers. Stuff that matters.
Re:Element: SetHTML() Method on MDN by dylan604 on Wednesday October 22, 2025 @07:36PM (#45676516)
You're making a bad assumption that client side code was the last place the submitted string was altered in the path to the server. The man in the middle might have a different idea and should always be protected against on the server where it is the last place to sanitize it.
Re:Element: SetHTML() Method on MDN by strbean on Saturday October 25, 2025 @01:42AM (#45701586)
Well, you have to sanitize for the transport medium, otherwise you can't sanitize at all afterwards. But if I'm sending user content in JSON and I didn't sanitize it for insertion into HTML, what man in the middle is going to be compromised? Furthermore, how can I possibly protect an unknown intermediary without knowing what it is going to do with it?

Maybe it is going to try to copy a value into a 20 char buffer, I don't know!