素敵な人、私はoDataを使用して、ユーザーが入力した情報の一部を検証しています。大きな問題は、たとえば、Chromeデバッガで簡単に実行できるクロスサイトスクリプティングを避けることです。これを避ける方法は?JavaScript SAPUI5を使用してクロスサイトスクリプティングを防止するにはどうすればよいですか?
マイコード:
onPress: function(oEvent) {
var event = this.getView().getModel("loggin").getProperty("/TypeCon");
var TestMode = this.getView().getModel("loggin").getProperty("/TestMode");
if (event == ""){
event = "SAP";
}
if (event != 'SAP'){
MessageToast.show("Esta conexão ainda não está disponível");
}else{
if(TestMode == 'X'){
this.getRouter().navTo("CockpitGo");
}else{
var oEntry = {};
oEntry.User= this.getView().getModel("loggin").getProperty("/User");
oEntry.Password= this.getView().getModel("loggin").getProperty("/Password");
var sServiceUrl = "http://abapfox.ddns.net:8000/sap/opu/odata/SAP/YLOGGIN_DATA_SRV/";
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true);
//Vamos montar antes o URI pra ver se fica tudo certinho:
var Uri = "/sap/opu/odata/SAP/YLOGGIN_DATA_SRV/LoginDataSet(User='" + oEntry.User + "',Password='" + oEntry.Password + "')";
OData.request({
requestUri: Uri,
method: "GET",
headers: {
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/atom+xml",
"DataServiceVersion": "2.0",
"X-CSRF-Token": "Fetch"
}
},
function(data, response) {
if (data.Success === true) {
// show message
MessageToast.show(data.Message);
this.getRouter().navTo("CockpitGo");
} else {
// show message
MessageToast.show(data.Message);
}
},