feat(ssulbox): 썰박스 상세에 공식 링크 오버레이 추가
This commit is contained in:
1 parent
3bcca23e97
commit
94b39a44bd
5 files changed
+63
-24
No files matched your search
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 사용자·크롤링에서 온 URL을 링크로 그리기 전에 검증한다.
|
||||
*
|
||||
* `official_site_url`은 업체가 직접 입력하거나 네이버 플레이스에서 긁어온 값이라
|
||||
* `javascript:` 같은 스킴이 섞이면 href에 그대로 실려 XSS가 된다. http/https만 통과시킨다.
|
||||
*/
|
||||
export const isSafeHttpUrl = (url?: string | null): boolean => {
|
||||
if (!url) return false;
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
return parsed.protocol === 'http:' || parsed.protocol === 'https:';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user