Skip to content

Commit 62e90ce

Browse files
committed
Sanity check URLs with isUrlPermitted
Thanks to walle303 for letting us know these weren't being checked.
1 parent 5635614 commit 62e90ce

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/views/context_menus/MessageContextMenu.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
Copyright 2015, 2016 OpenMarket Ltd
3+
Copyright 2018 New Vector Ltd
34
45
Licensed under the Apache License, Version 2.0 (the "License");
56
you may not use this file except in compliance with the License.
@@ -25,6 +26,7 @@ import { _t } from 'matrix-react-sdk/lib/languageHandler';
2526
const Modal = require('matrix-react-sdk/lib/Modal');
2627
const Resend = require("matrix-react-sdk/lib/Resend");
2728
import * as UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore';
29+
import { isUrlPermitted } from 'matrix-react-sdk/lib/HtmlUtils';
2830

2931
module.exports = React.createClass({
3032
displayName: 'MessageContextMenu',
@@ -275,7 +277,10 @@ module.exports = React.createClass({
275277
}
276278

277279
// Bridges can provide a 'external_url' to link back to the source.
278-
if( typeof(this.props.mxEvent.event.content.external_url) === "string") {
280+
if(
281+
typeof(this.props.mxEvent.event.content.external_url) === "string" &&
282+
isUrlPermitted(this.props.mxEvent.event.content.external_url)
283+
) {
279284
externalURLButton = (
280285
<div className="mx_MessageContextMenu_field">
281286
<a href={ this.props.mxEvent.event.content.external_url }

0 commit comments

Comments
 (0)