Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

XSS Prevention in UI5

$
0
0

Hi,

 

this is my first blog post in the SCN - and I hope it will be helpful.

 

At first I have to say that XSS prevention is part of the UI5 framework. If you bind a model to a view and malicious code is inserted into an UI5 control, the JS-code will be escaped and not executed in the browser.

ui5.png

 

So far so good... But is it possible to write malicious code to your database by an OData-Model? Yes it is!!!

If you don't escape the user-inputs the code will be written into the database:

 

DB.png

You should prevent this server side (never trust a client), because if a non UI5 client will use your OData Service he will receive the infected JS-Code. You can do this by the following Code:

 

escaping_data.png

The result is a clean database:

DB_escaped.png

 

Greetings,

 

Stefan


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>