summaryrefslogtreecommitdiff
path: root/odoo
diff options
context:
space:
mode:
authorSamuel Degueldre <sad@odoo.com>2019-09-30 06:34:25 +0000
committerSamuel Degueldre <sad@odoo.com>2019-10-01 08:24:59 +0000
commit74e23b2e2b36fb8b1d12cb2ca6b83f91e37417ba (patch)
tree5580d4339dd79850c22e30334653ea52164f77f6 /odoo
parente121bacbd00e92bfce1f05eeeb0c35a82b516c60 (diff)
[IMP] Prevent reverse tabnabbing in plaintext2html, linkify, _makeLink
These functions convert plain text links into clickable hyperlinks. These open in new tabs but did not have the "noreferrer noopener" rel attributes, which made them susceptible to reverse tabnabbing. A lot of attack vectors were available to unregistered, uninvited anonymous users and presented a significant phishing threat (such as posting links in the instant-chat, through a mail-alias, in a forum post or in a twitter post) and leading the operator to believe he had been disconnected from odoo in the original tab, prompting them to enter their credentials. while these three places will add the noreferrer and noopener attributes on the anchor tags generated by them, there are still many places that create hyperlinks without the use of these functions, although most of them are static links, they still represent a transitive security vulnerability to the linked sites. There are also a few modules and widgets that roll out their own links or open new tabs unsafely using window.open(), these will need to be patched separately. closes odoo/odoo#37591 Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Diffstat (limited to 'odoo')
-rw-r--r--odoo/tools/mail.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py
index f9a5cfa67cf..aa2552f8356 100644
--- a/odoo/tools/mail.py
+++ b/odoo/tools/mail.py
@@ -261,7 +261,7 @@ def html_keep_url(text):
link_tags = re.compile(r"""(?<!["'])((ftp|http|https):\/\/(\w+:{0,1}\w*@)?([^\s<"']+)(:[0-9]+)?(\/|\/([^\s<"']))?)(?![^\s<"']*["']|[^\s<"']*</a>)""")
for item in re.finditer(link_tags, text):
final += text[idx:item.start()]
- final += '<a href="%s" target="_blank">%s</a>' % (item.group(0), item.group(0))
+ final += '<a href="%s" target="_blank" rel="noreferrer noopener">%s</a>' % (item.group(0), item.group(0))
idx = item.end()
final += text[idx:]
return final