Browsed by
Tag: web development

Storing valid, sanitised HTML in database to mitigate malicious code injection

Storing valid, sanitised HTML in database to mitigate malicious code injection

In a typical cross-site scripting (XSS) attack, the hacker submit a HTML form which include malicious code. When another user visit the page in which this data is rendered, the malicious code is executed. There are at least a couple of ways to mitigate this risk: When the hacker submit the HTML form, any malicious code is removed before storing the data in the database When retrieving data from the database, removing any malicious code before rendering it on the…

Read More Read More

React: Auto scroll when overflow

React: Auto scroll when overflow

I recently had an issue with an React app, in which contents was added to the bottom of an area – a <div> element with the CSS property overflow: scroll; set – on the screen. I wanted the app to automatically scroll to the latest element. I found this post on StackOverflow which seemed to be what I needed, and while the auto scroll feature did work it was kind of our of sync with the content. I figured the…

Read More Read More