Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend): add rel="external" to external links #50

Merged
merged 1 commit into from
Oct 3, 2022

Conversation

invakid404
Copy link
Contributor

@invakid404 invakid404 commented Oct 2, 2022

This patch resolves the CSRF issue with some apps (most notably, QBitTorrent).
TL;DR: some apps enforce that the Referer and Target headers must match,
which isn't the case by default with a tags, Referer is the URL you were
redirected from instead.

This is generally fixed with rel="noopener noreferrer" (as implemented by
@toboshii) but SvelteKit's router renders those options useless unless
rel="external" is set as well. This effectively bypasses the client-side
router for those links.

Resolves #48.

This patch resolves the CSRF issue with some apps (most notably, QBitTorrent).
TL;DR: some apps enforce that the `Referer` and `Target` headers must match,
which isn't the case by default with `a` tags, `Referer` is the URL you were
redirected from instead.

This is generally fixed with `rel="noopener noreferrer"` (as implemented by
@toboshii) but SvelteKit's router renders those options useless unless
`rel="external"` is set as well.
@toboshii
Copy link
Owner

toboshii commented Oct 3, 2022

Doh, when I tested I checked the html contents and saw the rel there after compiling, but I didn't think about the router grabbing and ignoring that...

LGTM, 0.3.1 on it's way shortly :)

@toboshii toboshii merged commit 1d21ef0 into toboshii:main Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support specifying extra attributes for a tags
2 participants