You can add a filter in jServer to protect from XSS. To close the gate even more, you need the 'Content-Security-Policy' header. But in that case, be prepared to do
A LOT of work (hashing all your inline scripts, not use eval anywhere, ...) and avoid using big frameworks like jQuery, Bootstrap, etc... because they do contain unsafe code and will not work if the CSP header is set.
Public Sub Filter(req As ServletRequest, resp As ServletResponse) As Boolean
resp.SetHeader("server", "Yeah, right!") ' hide the Jetty fingerprint
' adding this one (without 'unsafe-inline' 'unsafe-eval') is a real nightmare to get it right.
' resp.SetHeader("Content-Security-Policy","script-src 'self' cdn.jsdelivr.net;")
resp.SetHeader("X-Frame-Options", "SAMEORIGIN")
resp.SetHeader("Strict-Transport-Security", "max-age=31536000;includeSubDomains")
resp.SetHeader("Referrer-Policy", "strict-origin-when-cross-origin")
resp.SetHeader("X-Content-Type-Options", "nosniff")
resp.SetHeader("X-XSS-Protection", "1; mode=block")
Return True
End Sub
Instead of 'Content-Security-Policy', we check anything incoming into the server if it is valid. For example all our url parameters need to be encoded.
https://xxx-yyy.com/MyApp/MyPage/?id=2uvIH3z%2BH24HOB8uJb%2Bxqo8IkeCnyF2Eia2rnu9O48ITpbxIRZAjsQ%3D%3D
You have to live with the fact that, not matter what you do to protect your work, someone will be able to do bad stuff to it
IF they really want to. Doesn't mean we have to make is easy for them
Alwaysbusy