Skip to content

Commit fda5859

Browse files
fblundunalexanderdean
authored andcommitted
Made IP address regex more strict (fixes snowplow#267)
1 parent 2db3afa commit fda5859

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Integrated the Tracker Core (#255)
2727
Removed deprecated trackImpression method (#256)
2828
Added forceSecureTracker boolean option to the argmap, thanks @kujo4pmZ! (#247)
2929
Moved link click tracking into its own file (#266)
30+
Made IP address regex more strict (#267)
3031

3132
Version 2.0.2 (2014-10-20)
3233
--------------------------

src/js/lib/proxies.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Test whether a string is an IP address
4343
*/
4444
function isIpAddress(string) {
45-
var IPRegExp = new RegExp('^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$');
45+
var IPRegExp = new RegExp('^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$');
4646
return IPRegExp.test(string);
4747
}
4848

@@ -96,6 +96,6 @@
9696
hostName = helpers.getHostName(href);
9797
}
9898
return [hostName, href, referrer];
99-
}
99+
};
100100

101101
}());

0 commit comments

Comments
 (0)