SOQL 查询:存储的 XSS 错误



我已经为安全代码扫描程序提供了我的代码,但由于以下原因,它给出了以下错误

查询:存储的 XSS

我的查询是这样的。

loan=Database.query('SELECT Name,fintechLLC__Application__c ,fintechLLC__Legal_Corporate_Name__c,fintechLLC__Last_Month_Trans__c,   fintechLLC__X2_Month_ago_Trans_del__c,fintechLLC__X3_Month_ago_Trans__c,CreatedDate,fintechLLC__Monthly_Ending_Bal__c,Max_Rate__c,fintechLLC__Term__c,fintechLLC__Funding_Amount__c,fintechLLC__Business_DBA_Name__c,fintechLLC__Credit_Score__c, fintechLLC__Business_DBA_Years_in_Business__c,fintechLLC__Avg_Daily_Bank_Bal__c FROM fintechLLC__Loan__c where id=''+loanId+''');

请帮我解决这个问题

在动态查询中,应使用 String.escapeSingleQuotes 来防止 SOQL 注入。

沿着变量 loadId 的路径向上走,并确保在你的 visualforce 页面中,它被 JSENCODE 或 HTMLENCODE 正确包装——这取决于你如何使用它。

  loan=Database.query('SELECT Name,fintechLLC__Application__c ,fintechLLC__Legal_Corporate_Name__c,fintechLLC__Last_Month_Trans__c,   fintechLLC__X2_Month_ago_Trans_del__c,fintechLLC__X3_Month_ago_Trans__c,CreatedDate,fintechLLC__Monthly_Ending_Bal__c,Max_Rate__c,fintechLLC__Term__c,fintechLLC__Funding_Amount__c,fintechLLC__Business_DBA_Name__c,fintechLLC__Credit_Score__c, fintechLLC__Business_DBA_Years_in_Business__c,fintechLLC__Avg_Daily_Bank_Bal__c FROM fintechLLC__Loan__c where id=''+String.escapeSingleQuotes(loanId)+''');

最新更新