Skip to content

Commit

Permalink
feat(fileStroage): add check for ips
Browse files Browse the repository at this point in the history
  • Loading branch information
kishore03109 committed Sep 29, 2023
1 parent 4c6b6d5 commit 613ec1a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/routes/fileStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export class FileStorageRouter {
const stagingUrl = await getStagingUrlFromId(repoName)
console.log(stagingUrl)
console.log(req.headers["x-forwarded-host"])
console.log(req.headers["x-forwarded-for"])
const x = req.headers["x-forwarded-host"]

//! todo check if forwarded-host iss of type string or array. if array, get the last value (last hop)
if (req.headers["x-forwarded-host"] !== stagingUrl) {
res.status(403).send("Unauthorized")
return
Expand Down Expand Up @@ -71,6 +75,7 @@ export class FileStorageRouter {
console.log(req.headers["x-forwarded-host"])
const repoName = await getRepoNameFromId(req.params.id)
const stagingUrl = await getStagingUrlFromId(repoName)
console.log(typeof req.headers["x-forwarded-host"])
if (req.headers["x-forwarded-host"] !== stagingUrl) {
res.status(403).send("Unauthorized")
return
Expand Down

0 comments on commit 613ec1a

Please sign in to comment.