@@ -838,28 +838,29 @@ class UI5Control extends TUI5Control {
838838 string getControlTypeName ( ) { result = this .getQualifiedType ( ) .replaceAll ( "." , "/" ) }
839839
840840 /**
841- * Holds if the attribute `sanitizeContent`
842- * in controls ` sap.ui. core. HTML` and `sap.ui.richttexteditor.RichTextEditor`
843- * is set to true and never set to false anywhere
841+ * Holds if the control content is sanitized for HTML
842+ * ' sap/ui/ core/ HTML' sanitized using the property 'sanitizeContent'
843+ * 'sap/ui/richttexteditor/RichTextEditor' sanitized using the property 'sanitizeValue'
844844 */
845- predicate isSanitizedControl ( ) {
846- not this = this . sanitizeContentSetTo ( false ) and
847- (
848- this .getControlTypeName ( ) = "sap/ui/richttexteditor/RichTextEditor"
849- or
850- this .getControlTypeName ( ) = "sap/ui/core/HTML" and
851- this = this . sanitizeContentSetTo ( true )
852- )
845+ predicate isHTMLSanitized ( ) {
846+ this . getControlTypeName ( ) = "sap/ui/richttexteditor/RichTextEditor" and
847+ this . isSanitizePropertySetTo ( "sanitizeValue" , true ) and
848+ not this .isSanitizePropertySetTo ( "sanitizeValue" , false )
849+ or
850+ this .getControlTypeName ( ) = "sap/ui/core/HTML" and
851+ this . isSanitizePropertySetTo ( "sanitizeContent" , true ) and
852+ not this . isSanitizePropertySetTo ( "sanitizeContent" , false )
853853 }
854854
855- private predicate sanitizeContentSetTo ( boolean val ) {
856- this .getAReference ( ) .getAPropertyWrite ( "sanitizeContent" ) .getRhs ( ) .mayHaveBooleanValue ( val )
855+ bindingset [ propName, val]
856+ private predicate isSanitizePropertySetTo ( string propName , boolean val ) {
857+ /* 1. `sanitizeContent` attribute is set declaratively. */
858+ this .getProperty ( propName ) .toString ( ) = val .toString ( )
857859 or
858- exists ( CallNode setPropertyCall |
859- setPropertyCall = this .getAReference ( ) .getAMemberCall ( "setProperty" )
860- |
861- setPropertyCall .getArgument ( 0 ) .getStringValue ( ) = "sanitizeContent" and
862- setPropertyCall .getArgument ( 1 ) .mayHaveBooleanValue ( val )
860+ /* 2. `sanitizeContent` attribute is set programmatically using setProperty(). */
861+ exists ( CallNode node | node = this .getAReference ( ) .getAMemberCall ( "setProperty" ) |
862+ node .getArgument ( 0 ) .getStringValue ( ) = propName and
863+ not node .getArgument ( 1 ) .mayHaveBooleanValue ( val .booleanNot ( ) )
863864 )
864865 }
865866}
0 commit comments