Knowledgebase

Preventing Scripting Attacks in the Browser Print

  • webdevelopment, database, security, guide, howto, solution, zillionkinghost, hosting
  • 0

Content executed in the browser.

WHAT IT IS

Submitted content rendered into a page and executed by the browser.

WHAT IT ALLOWS

Stealing sessions Acting as the visitor Altering what people see Capturing what they type

WHAT CAUSES IT

Output not escaped for its context.

WHAT CONTEXTS REQUIRE DIFFERENT TREATMENT

Content in markup Content in an attribute Content in an address Content inside a script

WHY THAT MATTERS

Escaping correct for one context is insufficient for another.

WHAT FRAMEWORKS DO

Escape by default in templates.

WHAT TO CHECK

Where that has been deliberately disabled, and why.

WHAT ELSE TO CHECK

Content inserted by scripts, which bypasses template escaping.

WHAT TO USE FOR USER-SUBMITTED FORMATTED CONTENT

An established sanitising library, permitting only safe elements.

WHAT TO NEVER DO

Write your own filter.

WHAT TO NEVER TRUST

Data from your own database, which was once input.

WHAT ADDS DEFENCE

A content security policy, restricting what may execute.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot