fix(bio-links): restrict bio link URLs to http/https schemes and prevent arbitrary iframe embeds
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Start with the listed DTO and public bio components, then inspect sibling bio link DTOs and how parseMediaEmbed selects providers. Trace URL fields through validation and rendering, and check the existing tests for these paths. Done means bio link URLs accept only HTTP(S), and public media embeds render only for the approved providers.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem Description
-
Stored XSS via
javascript:URIs:
Inapps/api/src/bio-links/dto/upsert-bio-links.dto.ts,BioLinkInputDtoonly validatesurlandredirectUrlwith@IsString(), without restricting the URL scheme tohttp:orhttps:.
As a result, dangerous payloads such asjavascript:...ordata:...can be saved to the database and rendered directly intohrefattributes orwindow.open(...)calls on public bio pages (PublicLinkCard.tsx,PublicProductCard.tsx,PublicSocialButton.tsx), executing arbitrary JavaScript in visitors' browsers when clicked. -
Arbitrary
<iframe>injection on public bio pages:
Inapps/web/components/bio-links/PublicMediaEmbed.tsx,parseMediaEmbedfalls back to returning{ type: ..., embedUrl: cleanUrl }for any URL that does not match YouTube, Spotify, or Instagram, and renders<iframe src={embedUrl}>directly. This allows arbitrary external URLs orjavascript:/data:URIs to be embedded in public/l/[slug]pages.
Expected Behavior
- All URL fields on Bio-Links DTOs (
url,redirectUrl, and any related social/product/media URLs) must validate that onlyhttp:andhttps:schemes are accepted. - Public bio components (
PublicLinkCard.tsx,PublicProductCard.tsx,PublicSocialButton.tsx) must sanitize/verify URLs before renderinghrefor callingwindow.open(...), rejecting non-HTTP(S) schemes. PublicMediaEmbed.tsxmust only render<iframe>elements for approved embed providers/domains (YouTube, Spotify, Instagram) instead of falling back to arbitrary URLs.
Where to Look
apps/api/src/bio-links/dto/upsert-bio-links.dto.ts(BioLinkInputDto)apps/web/components/bio-links/PublicLinkCard.tsxapps/web/components/bio-links/PublicProductCard.tsxapps/web/components/bio-links/PublicSocialButton.tsxapps/web/components/bio-links/PublicMediaEmbed.tsx(parseMediaEmbed)
Solution / Implementation Guide
-
Backend (
apps/api/src/bio-links/dto/):- Replace bare
@IsString()onurlandredirectUrlinBioLinkInputDto(and any sibling bio-links DTOs for products, social buttons, or media embeds) with@IsUrl({ protocols: ['http', 'https'], require_protocol: true }).
- Replace bare
-
Frontend (
apps/web/components/bio-links/):- Add a shared
getSafeHttpUrl(url?: string | null): string | nullhelper that parses withnew URL(...)and only returns the URL ifprotocol === 'http:' || protocol === 'https:'. - Use
getSafeHttpUrlbefore passing URLs tohreforwindow.open(...)inPublicLinkCard.tsx,PublicProductCard.tsx, andPublicSocialButton.tsx. - In
PublicMediaEmbed.tsx, remove the arbitraryembedUrl: cleanUrlfallback for<iframe src={embedUrl}>so only whitelisted provider embeds (YouTube, Spotify, Instagram) render an<iframe>.
- Add a shared
- Lingua principale
- TypeScript
- Stelle
- 2
- Fork
- 1
- Merge medio
- 6m
- PR unite (30g)
- 27
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sumamakhan761/tryinstance
-
backend good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
sumamakhan761/tryinstance#65 ·
I maintainer di solito rispondono entro 1 giorno
-
backend good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
sumamakhan761/tryinstance#64 ·
I maintainer di solito rispondono entro 1 giorno
-
backend good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
sumamakhan761/tryinstance#63 ·
I maintainer di solito rispondono entro 1 giorno
-
backend good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
sumamakhan761/tryinstance#62 ·
I maintainer di solito rispondono entro 1 giorno
-
backend good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
sumamakhan761/tryinstance#60 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di sumamakhan761/tryinstance
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
makecindy/cindy#15342 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
kwitsch/claude-code-plugin-tooling#219 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
no-repo-link tool-submission
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100