Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
🐛 Fix CWE-20 in URL parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 8, 2020
1 parent d9ad820 commit ac17d98
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/modules/domains/domains.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ export class DomainsService {
where: { id: groupId },
select: { profilePictureUrl: true },
});
if (
currentProfilePicture.profilePictureUrl.startsWith(
'https://ui-avatars.com',
)
)
const parsedProfilePicture = new URL(
currentProfilePicture.profilePictureUrl,
);
if (parsedProfilePicture.hostname === 'ui-avatars.com')
try {
const img = await got('https://logo.clearbit.com/${data.domain}', {
responseType: 'buffer',
Expand Down

0 comments on commit ac17d98

Please sign in to comment.