Skip to content
Opsfolk

Secure coding, topic 19 of 70

Cross-site scripting

Cross-site scripting puts an attacker's script into a page another user views, where it can act as them. It comes from text written into HTML without encoding.

Modern frameworks encode by default; the danger is the escape hatches, such as setting raw HTML. Sanitise any HTML you must accept, and add a Content Security Policy, which stops injected scripts from running even when a mistake slips through.

On Opsfolk

Nothing of ours for this topic yet: an article is on its way.

Elsewhere

Your progress