Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 45 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/shared/util/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function isWhitelisted(url: string): boolean {

// Checks if url is blacklisted.
export function isBlacklisted(url: string): boolean {
return blacklist.some((bl) => url.includes(bl))
return blacklist.some((bl) => url.toLowerCase().includes(bl))
}

// Tests if a URL string begins with https://.
Expand Down
10 changes: 10 additions & 0 deletions test/shared/util/validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ describe('Test whiteliste check', () => {
})

describe('Test blacklist check', () => {
test('example GooGle.com url is not blacklisted', () => {
const url = 'https://www.GooGle.com'
expect(validation.isBlacklisted(url)).toBe(false)
})

test('localstack url is not blacklisted', () => {
const url = 'http://localhost:4566'
expect(validation.isBlacklisted(url)).toBe(false)
Expand All @@ -18,6 +23,11 @@ describe('Test blacklist check', () => {
const url = 'https://bit.ly/abc'
expect(validation.isBlacklisted(url)).toBe(true)
})

test('example Bit.Ly url is also blacklisted', () => {
const url = 'https://Bit.Ly/abc'
expect(validation.isBlacklisted(url)).toBe(true)
})
})

describe('Test https check', () => {
Expand Down
Loading