Skip to content

Commit e1e8e4b

Browse files
committed
removed use of x-forwarded-for header
1 parent 33db5c5 commit e1e8e4b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

scripts/jenkins-status.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ const enabledRepos = ['citgm', 'node']
66
const jenkinsIpWhitelist = process.env.JENKINS_WORKER_IPS ? process.env.JENKINS_WORKER_IPS.split(',') : []
77

88
function isJenkinsIpWhitelisted (req) {
9-
const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress
9+
const ip = req.connection.remoteAddress
1010

11-
if (jenkinsIpWhitelist.length) {
12-
if (!jenkinsIpWhitelist.includes(ip)) {
13-
req.log.warn({ ip }, 'Ignoring, not allowed to push Jenkins updates')
14-
return false
15-
}
11+
if (jenkinsIpWhitelist.length && !jenkinsIpWhitelist.includes(ip)) {
12+
req.log.warn({ ip }, 'Ignoring, not allowed to push Jenkins updates')
13+
return false
1614
}
1715

1816
return true

0 commit comments

Comments
 (0)