Skip to content

Commit

Permalink
Fixed handling of invalid URLs in the addRequestedHeaders function (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
rorylshanks authored Mar 15, 2024
1 parent 8c93acb commit a426910
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/authz.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ async function checkUserGroupMembership(user, groups) {
async function addRequestedHeaders(req, res, route, user, discoveredGroups) {
var proxyTo = {}
try {
proxyTo = new URL(route.to.url || route.to.name || route.to)
var rawURL = route.to.url || route.to.name || route.to
var urlWithPrefix = rawURL.startsWith("http") ? rawURL : `http://${rawURL}`
proxyTo = new URL(urlWithPrefix)
} catch (error) {
log.warn({ message: "Unable to get audience from route", context: { error: error.message, stack: error.stack, route: route } })
}
Expand Down

0 comments on commit a426910

Please sign in to comment.