Skip to content

Commit

Permalink
Action.OpenUrl with a top-level browsing context
Browse files Browse the repository at this point in the history
While HTML links [launch without an opener reference][spec],
[`window.open`][vulnerability] provides a reference to the parent page
through an auxiliary browsing context. Given untrusted URL input, this
can lead to tabnabbing and phishing attacks.

This change uses the [noopener] and [noreferrer] [window features] for
the default link handler in the React renderer.

[spec]: whatwg/html#4078
[vulnerability]: https://mathiasbynens.github.io/rel-noopener/
[window features]: https://developer.mozilla.org/en-US/docs/Web/API/Window/open#windowfeatures
[noopener]: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/noopener
[noreferrer]: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/noreferrer
  • Loading branch information
sch committed Jun 28, 2023
1 parent d757703 commit 6de67c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/nodejs/adaptivecards-react/src/adaptive-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const propTypes = {
};

const defaultOpenUrlHandler = (action: AdaptiveCards.OpenUrlAction) => {
window.open(action.url, '_blank');
window.open(action.url, '_blank', 'noopener,noreferrer');
};

const setUpMarkdownIt = () => {
Expand Down

0 comments on commit 6de67c8

Please sign in to comment.