fix(client): validate urls to improve security
This commit is contained in:
parent
572000f868
commit
788ae2f6ca
4 changed files with 4 additions and 0 deletions
|
@ -86,6 +86,7 @@ let tweetHeight = $ref(150);
|
|||
let unknownUrl = $ref(false);
|
||||
|
||||
const requestUrl = new URL(props.url);
|
||||
if (!['http:', 'https:'].includes(requestUrl.protocol)) throw new Error('invalid url');
|
||||
|
||||
if (requestUrl.hostname === 'twitter.com' || requestUrl.hostname === 'mobile.twitter.com') {
|
||||
const m = requestUrl.pathname.match(/^\/.+\/status(?:es)?\/(\d+)/);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue