Deprecated: This extension is no longer maintained and will not receive further updates.
A client-side script can be injected into the message which can lead to an attack. The XSS Filter Extension helps you to sanitize the messages.This is applicable only for the Web SDK.
At the recipients’ end, from the message object, you can fetch the metadata by calling the getMetadata() method. Using this metadata, you can fetch the sanitized message.
Copy
Ask AI
var metadata = message.getMetadata();if (metadata != null) { var injectedObject = metadata["@injected"]; if (injectedObject != null && injectedObject.hasOwnProperty("extensions")) { var extensionsObject = injectedObject["extensions"]; if (extensionsObject != null && extensionsObject.hasOwnProperty("xss-filter")){ var xssFilterObject = extensionsObject["xss-filter"]; var hasXSS = xssFilterObject["hasXSS"]; var sanitized_message = xssFilterObject["sanitized_message"]; } }}
As mentioned earlier, the XSS is only possible for the web. So, the mobile platforms do not require you to fetch the sanitized message.