Skip to content

Commit

Permalink
Fix XSS in runbook URL (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
grobinson-grafana committed Jun 21, 2022
1 parent e92e790 commit f6d351b
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -2,7 +2,7 @@ import React, { FC, Fragment, useState } from 'react';
import { useDispatch } from 'react-redux';
import { useLocation } from 'react-router-dom';
import { css } from '@emotion/css';
import { AppEvents, GrafanaTheme2, urlUtil } from '@grafana/data';
import { AppEvents, GrafanaTheme2, textUtil, urlUtil } from '@grafana/data';
import { config } from '@grafana/runtime';
import { Button, ConfirmModal, ClipboardButton, HorizontalGroup, LinkButton, useStyles2 } from '@grafana/ui';
import { contextSrv } from 'app/core/services/context_srv';
Expand Down Expand Up @@ -96,7 +96,7 @@ export const RuleDetailsActionButtons: FC<Props> = ({ rule, rulesSource }) => {
variant="primary"
icon="book"
target="__blank"
href={rule.annotations[Annotation.runbookURL]}
href={textUtil.sanitizeUrl(rule.annotations[Annotation.runbookURL])}
>
View runbook
</LinkButton>
Expand Down

0 comments on commit f6d351b

Please sign in to comment.