Skip to content

Commit 994fec2

Browse files
authored
jenkins: handle IPv4 remote address converted to IPv6 (#161)
After the Jenkins IP whitelist was activated, the inline PR status reports for nodejs/node seems to be broken. Seems like the issue here is that IPv4 remote addresses are converted to IPv6, which wasn't expected too happen.. Stripping any IPv6 parts off the remote addresses should make our IPv4 comparisons work as expected. Refs nodejs/build#1016 Refs nodejs/build#985
1 parent 5c683d3 commit 994fec2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/jenkins-status.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const enabledRepos = ['citgm', 'http-parser', 'node']
66
const jenkinsIpWhitelist = process.env.JENKINS_WORKER_IPS ? process.env.JENKINS_WORKER_IPS.split(',') : []
77

88
function isJenkinsIpWhitelisted (req) {
9-
const ip = req.connection.remoteAddress
9+
const ip = req.connection.remoteAddress.split(':').pop()
1010

1111
if (jenkinsIpWhitelist.length && !jenkinsIpWhitelist.includes(ip)) {
1212
req.log.warn({ ip }, 'Ignoring, not allowed to push Jenkins updates')

0 commit comments

Comments
 (0)