Added an extra layer of sanitization to error page links (#4953)

Этот коммит содержится в:
Harrison Healey
2017-01-04 09:29:19 -05:00
коммит произвёл Corey Hulen
родитель f1679cb2a0
Коммит c0a5f9fbef

Просмотреть файл

@@ -13,9 +13,11 @@ export default class ErrorPage extends React.Component {
componentDidMount() { componentDidMount() {
$('body').attr('class', 'sticky error'); $('body').attr('class', 'sticky error');
} }
componentWillUnmount() { componentWillUnmount() {
$('body').attr('class', ''); $('body').attr('class', '');
} }
render() { render() {
let title = this.props.location.query.title; let title = this.props.location.query.title;
if (!title || title === '') { if (!title || title === '') {
@@ -30,6 +32,9 @@ export default class ErrorPage extends React.Component {
let link = this.props.location.query.link; let link = this.props.location.query.link;
if (!link || link === '') { if (!link || link === '') {
link = '/'; link = '/';
} else if (link.startsWith('javascript:') || link.startsWith('vbscript:') || link.startsWith('data:')) { // eslint-disable-line no-script-url
// Sanitize out any script links
link = '/';
} }
let linkMessage = this.props.location.query.linkmessage; let linkMessage = this.props.location.query.linkmessage;