fix(bio-links): restrict bio link URLs to http/https schemes and prevent arbitrary iframe embeds
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 2
- Fork
- 1
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sumamakhan761/tryinstance
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#65 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
sumamakhan761/tryinstance#64 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
sumamakhan761/tryinstance#63 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#62 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#60 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của sumamakhan761/tryinstance
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
makecindy/cindy#15342 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
kwitsch/claude-code-plugin-tooling#219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
no-repo-link tool-submission
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100