fix(web): add noopener and noreferrer to external source links#771
fix(web): add noopener and noreferrer to external source links#771Sahilshrma31 wants to merge 1 commit intonodejs:mainfrom
Conversation
PR SummaryLow Risk Overview Reviewed by Cursor Bugbot for commit 15b232b. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
bmuenzenmeyer
left a comment
There was a problem hiding this comment.
this is probably overkill for a GH link (we trust them more implicitly) but no harm here. noopener is redundant in most browsers, but again, not much harm
((we do both within nodejs.org anyways))
Description
Adds rel="noopener noreferrer" to source-code links generated by the web docs pipeline when links open in a new tab (target="_blank").
The source link rendering in jsx-ast currently opens external GitHub links in a new tab but does not set a rel attribute. This change hardens link behavior by preventing opener access and aligning with standard security best practices for external links.
Validation
I validated this by generating docs and inspecting rendered source-code links in the output HTML.
Before
Generated source links had:
target="_blank"
no rel attribute
After
Generated source links now have:
target="_blank"
rel="noopener noreferrer"
This preserves existing behavior (open in new tab) while adding safer link semantics.
Related Issues
N/A
Check List
node --run testand all tests passed.node --run format&node --run lint.