News for hackers. Stuff that matters.
Re:Element: SetHTML() Method on MDN by immibis on Wednesday October 22, 2025 @05:55PM (#45675650)
By "sanitise" what's really meant is usually "escape". User typed their display name as <script>. You want the screen to say their display name, which is <script>. Therefore you send &lt;script&gt;. That's not their display name - that's just what you write in HTML to get their display name to appear on the screen. You shouldn't store it in the database in the display_name column.
Re:Element: SetHTML() Method on MDN by strbean on Wednesday October 22, 2025 @06:23PM (#45675922)
Agreed. The codebase I'm thinking of was html encoding stuff before storing it, then when they needed to e.g. send an SMS, trying to remember to decode. Terrible.