security.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. .. raw:: html
  2. <div id="banner"><a href="https://github.com/jcbrand/converse.js/blob/master/docs/source/theming.rst">Edit me on GitHub</a></div>
  3. =======================
  4. Security considerations
  5. =======================
  6. .. note::
  7. Converse comes with no warranty of any kind and the authors are not liable for any damages.
  8. The data-structures of Converse encapsulate sensitive user data such as
  9. XMPP account details (in case of manual login) and personal conversations.
  10. In an environment where, besides Converse, other untrusted 3rd party scripts
  11. might also be running, it's important to guard against malicious or invasive
  12. access to user data and/or the API.
  13. The threat model
  14. ================
  15. The following threat model is considered:
  16. Malicious 3rd party scripts served through compromised side-channels, such as ad-networks,
  17. which attempt to access Converse's API and/or data-structures in order to personify users
  18. or to pilfer their data.
  19. Mitigating measures
  20. ===================
  21. As of version 3.0.0, the following actions were taken to harden Converse against attacks:
  22. Separate code/data into public and private parts
  23. ------------------------------------------------
  24. 1. Encapsulate Converse's data structures into a private closured object (named ``_converse``).
  25. 2. Split the API into public and private parts.
  26. Restrict access to private code/data
  27. ------------------------------------
  28. 3. Only plugins are allowed to access the private API and the closured ``_converse`` object.
  29. 4. TODO: Whitelist plugins that have access to the private API and closured ``_converse`` object.
  30. 5. Prevent the removal of registered plugins (otherwise the whitelist could be circumvented).
  31. 6. Throw an error when multiple plugins try to register under the same name
  32. (otherwise the whitelist could be circumvented).
  33. .. note::
  34. Care should be taken when using a custom build of Converse where some
  35. of the core plugins contained in the default build are omitted. In this case
  36. the omitted plugins should also be removed from the whitelist, otherwise
  37. malicious plugins could be registered under their names.
  38. Addititional measures
  39. =====================
  40. Besides the measures mentioned above, integrators and hosts can also take
  41. further security precautions.
  42. The most effective is to avoid serving untrusted 3rd party JavaScript (e.g.
  43. advertisements and analytics).
  44. Another option is to forego the use of a global ``converse`` object (which
  45. exposes the public API) and instead to encapsulate it inside a private closure,
  46. in order to keep it inaccessible to other scripts.
  47. Other considerations
  48. ====================
  49. Locally cached data
  50. -------------------
  51. Besides the "hot" data stored in models and collections, which are all
  52. encapsulated in the private ``_converse`` object, there is also the cached data
  53. stored in the browser's ``sessionStorage`` and ``localStorage`` stores.
  54. Examples of sensitive cached data are chat messages and the contacts roster,
  55. both which are in session storage, which means that the cache is cleared as
  56. soon as the last tab or window is closed. User credentials are not cached at
  57. all.
  58. Perhaps the ability to encrypt this cached data could be added in future
  59. versions of Converse, if there is sufficient demand for it.
  60. However to date no significant mitigation or hardening measures have been taken to
  61. secure this cached data.
  62. Therefore, the best defence as website host is to avoid serving Converse with
  63. untrusted 3rd party code, and the best defence as an end-user is to avoid chatting
  64. on websites that host untrusted 3rd party code. The most common examples of such
  65. being advertising and analytics scripts.