Commit 2f74ba2a authored by JC Brand's avatar JC Brand

Prevent forging of messages via carbons.

parent fccd0860
# Changelog
## 1.0.7 (Unreleased)
- Security fix: Prevent message forging via carbons. (Thanks to ge0rg) [jcbrand]
## 1.0.6 (2016-08-12)
- #632 Offline and Logout states do not properly update once users start
chatting. [chrisuehlinger, jcband]
......
......@@ -694,7 +694,7 @@
var msgtext = 'This is a carbon message';
var sender_jid = mock.cur_names[1].replace(/ /g,'.').toLowerCase() + '@localhost';
var msg = $msg({
'from': converse.bare_jid,
'from': sender_jid,
'id': (new Date()).getTime(),
'to': converse.connection.jid,
'type': 'chat',
......
......@@ -1350,7 +1350,14 @@
}
$forwarded = $message.find('forwarded');
if ($forwarded.length) {
$message = $forwarded.children('message');
var $forwarded_message = $forwarded.children('message');
if (Strophe.getBareJidFromJid($forwarded_message.attr('from')) !== from_jid) {
// Prevent message forging via carbons
//
// https://xmpp.org/extensions/xep-0280.html#security
return true;
}
$message = $forwarded_message;
$delay = $forwarded.children('delay');
from_jid = $message.attr('from');
to_jid = $message.attr('to');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment