Skip to content

False negative when target and rel attributes are dynamic #2962

@just-boris

Description

@just-boris

I have this code example

<a
    href={href}
    target={isExternal ? '_blank' : undefined}
    rel={isExternal ? 'noopener noreferrer' : undefined}
/>

Both target and rel attribute are dynamically defined, and always both present when needed. However, the rule reports it as an error:

Using target="_blank" without rel="noreferrer" is a security risk

Plugin version: 7.23.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions