Skip to content

Files

Latest commit

 

History

History
24 lines (16 loc) · 588 Bytes

Rails-LinkToBlank.md

File metadata and controls

24 lines (16 loc) · 588 Bytes

Pattern: Missing rel: 'noopener' for link_to

Issue: -

Description

This cop checks for calls to link_to that contain a target: '_blank' but no rel: 'noopener'. This can be a security risk as the loaded page will have control over the previous page and could change its location for phishing purposes.

Examples

# bad
link_to 'Click here', url, target: '_blank'

# good
link_to 'Click here', url, target: '_blank', rel: 'noopener'

Further Reading