fix(bio-links): restrict bio link URLs to http/https schemes and prevent arbitrary iframe embeds
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- TypeScript
- スター
- 2
- フォーク
- 1
- 平均マージ
- 6分
- マージ済み PR(30日)
- 27
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sumamakhan761/tryinstance のほかの issue
-
backend good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
sumamakhan761/tryinstance#65 ·
メンテナーはふだん 1 日以内に返信
-
backend good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
sumamakhan761/tryinstance#64 ·
メンテナーはふだん 1 日以内に返信
-
backend good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
sumamakhan761/tryinstance#63 ·
メンテナーはふだん 1 日以内に返信
-
backend good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
sumamakhan761/tryinstance#62 ·
メンテナーはふだん 1 日以内に返信
-
backend good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
sumamakhan761/tryinstance#60 ·
メンテナーはふだん 1 日以内に返信
sumamakhan761/tryinstance の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
makecindy/cindy#15342 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
kwitsch/claude-code-plugin-tooling#219 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
no-repo-link tool-submission
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100