Security
A message is whatever its sender put in it, so the library treats every field as untrusted:
- Links open only with a safe scheme. Text links, markdown links and link previews open with
http,https,mailto,telorsms; a message's media and files withhttp,https,fileorcontent. Anything else (javascript:,intent:,data:, an app's custom scheme) does nothing and logs the scheme alone. When you handle a press yourself (messageTextProps.onPress,onPressLinkPreview, a matcher'sonPress), check the URL with the exportedisSafeLinkUrl/isSafeMediaUrlbefore opening it. - A malformed message cannot take the chat down.
ChatandChatListcheck each message and chat as it arrives: a field of the wrong type is dropped, and a message without a string or number_id, or with an_idalready used, is left out. Well-formed messages pass through untouched, as the same objects. A row that still throws while rendering, for example in a render prop of yours, hides itself and the rest of the chat stays. - Long messages cannot freeze it. Link detection scans a long text in bounded pieces and skips any run of more than 4096 characters with no whitespace, so its cost grows in step with the text.
- Nothing a sender wrote reaches the device log. The library's warnings name ids, field names and URL schemes, never message text or URLs.
- File names cannot disguise their type. Characters that reorder text (right-to-left overrides) are removed from a file's displayed name, and its icon shows the real extension.
What stays with your app: limit message size and validate messages on your server, and fetch link previews there too. A fetchLinkPreview that loads the page on the device tells every linked site the reader's IP address.