Fluentui: rel="noopener noreferrer" is not added for external link for Nav

Created on 24 Jan 2020  路  3Comments  路  Source: microsoft/fluentui

Environment Information

  • Package version(s): 7.84.0
  • Browser and OS versions: N/A

Please provide a reproduction of the bug in a codepen:

Codepen Demo

https://codepen.io/dance2die/pen/ZEYwdRX?editors=0010

Reproduction Steps

  1. Go to https://developer.microsoft.com/en-us/fabric#/controls/web/nav
  2. Scroll down to "Nav similar to the one in this demo app" section
  3. Export to Codepen.
  4. Replace internal links with external links.
    e.g.)
<Nav
      styles={{ root: { width: 300 } }}
      ariaLabel="Nav example similiar to one found in this demo page"
      groups={[
        {
          name: 'External Links',
          expandAriaLabel: 'Expand Basic components section',
          collapseAriaLabel: 'Collapse Basic components section',
          links: [
            {
              key: 'r/reactjs',
              name: 'r/reactjs',
              url: 'https://www.reddit.com/r/reactjs/',
              target: "__blank"
            },
            {
              key: 'Nav',
              name: 'Fabric Nav',
              url: 'https://developer.microsoft.com/en-us/fabric#/controls/web/nav'
              ,target: "__blank"
            }
          ]
        }
      ]}
    />
  1. Open a new preview window.
    image
  2. View the generated source on links.
  3. You can see that rel="noopener noreferrer" is not added for the external links.
    image

Actual behavior:

rel="noopener noreferrer" is not added for external links with target specified for Nav component.

Expected behavior:

Generated anchor tags must have rel="noopener noreferrer".

Nav.base.tsx implements it but rel attribute isn't added.

Priorities and help requested:

Are you willing to submit a PR to fix? No

Requested priority: High (security issue)

Nav Fixed Type

All 3 comments

Hi @dance2die, thanks for filing this issue! I can confirm this is happening and have a pretty good idea as to why so I should have a fix relatively soon. Thanks!

You're welcome and thank you, @khmakoto for the review & the PR~

:tada:This issue was addressed in #11792, which has now been successfully released as [email protected].:tada:

Handy links:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rickyp-ms picture rickyp-ms  路  3Comments

prashkan picture prashkan  路  3Comments

mattcoxonline picture mattcoxonline  路  3Comments

VincentBailly picture VincentBailly  路  3Comments

carruthe picture carruthe  路  3Comments