QuantEcon / QuantEcon/quantecon-book-theme

Add rel="noopener noreferrer" to all target="_blank" links in layout.html

Open
#429 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Jupyter Notebook
Stars
56
Forks
24
Avg merge
4h 33m
Merged PRs (30d)
4

Description

Every link in the theme that opens in a new tab uses target="_blank" with no rel hardening. There are seven of them in layout.html and none carries noopener or noreferrer:

Line Link
266, 268, 270 author byline links
284 translator byline link
408, 410 toolbar "View Source" links
471 "Launch Notebook" button

Why this is low urgency but still worth doing

Reverse-tabnabbing is the classic reason to add rel="noopener", and it is not actually exploitable here: every browser released since roughly 2021 (Chrome 88+, Firefox 79+, Safari 12.1+) implies noopener for target="_blank" automatically. So this is defence in depth and a way to satisfy security linters, not a live vulnerability.

It is worth doing as one sweep rather than piecemeal, so the template is internally consistent — hardening one byline link while the one directly above it stays bare is worse than either doing all of them or none.

One decision to make

noopener is uncontroversial. noreferrer is not quite: it also strips the Referer header, so author and translator sites lose referrer attribution in their analytics, and the QuantEcon books are exactly the sort of place an author might care about that. Worth deciding explicitly whether the byline links get noopener alone and the toolbar/launch links get both, or whether all seven get both.

Note the byline links already carry rel="author" (authors only), so the added tokens go in the same space-separated list rather than a second attribute.

Raised by Copilot on #427, where it was deliberately deferred rather than fixed in a feature PR: three of the four byline links are pre-existing markup that PR only added rel="author" to, and fixing three of seven would have left the template inconsistent.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in layout.html at lines 266, 268, 270, 284, 408, 410, and 471, and inspect each target="_blank" link together with its existing rel attribute. Resolve the stated noopener/noreferrer policy before editing; done means all seven links are consistently hardened without losing the existing rel="author" token.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.