XSS Protection

Last updated 8 months ago

FoalTS provides some utils to protect you against XSS attacks.

escape(str: string): string

Escapes HTML and returns a new string.

escapeProp(object: object, propName: string): void

Escapes HTML in the given property.

escapeProp(myObject, 'foobar')

is equivalent to

myObject.foobar = escape(myObject.foobar)