Skip to content

Commit

Permalink
Updated the process_anchors.js file to remove vulnerability when dete…
Browse files Browse the repository at this point in the history
…rmining if a link is internal or external.
  • Loading branch information
felder101 committed Dec 3, 2024
1 parent 87cd69e commit b60b5c6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/plugins/process_anchors.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ import path from 'path'
function isInternalDomain(url) {
try {
const domain = new URL(url)

return domain.hostname === 'gsa.gov' || domain.hostname === 'www.gsa.gov'|| domain.protocol === 'mailto:'
const internalHost = [
'gsa.gov',
'www.gsa.gov'
]
return internalHost.includes(domain.hostname) || domain.protocol === 'mailto:'
} catch(e) {
// this represents urls like "/some/path" without domain
return true
Expand Down

0 comments on commit b60b5c6

Please sign in to comment.