Giter Site home page Giter Site logo

Comments (9)

robocoder avatar robocoder commented on April 29, 2024

There's a special case where the IP (or IP range) to be excluded falls within these reserved ranges:

* 10.0.0.0 - 10.255.255.255
* 172.16.0.0 - 172.31.255.255
* 192.168.0.0 - 192.168.255.255 

I'm going to roll the requirements in from #567. Visitors with HTTP_CLIENT_IP or HTTP_X_FORWARDED_FOR, IP addresses in the private IP address ranges should instead use the first public address in the list, falling back to $_SERVER!['REMOTE_ADDR'].

Also, it looks like there are a couple of unreachable codepaths in the current implementation of getIp() which should be reviewed.

from matomo.

robocoder avatar robocoder commented on April 29, 2024

In http://forum.piwik.org/index.php?showtopic=1540 there's a mod to Provider to map local IP addresses to internal "provider" names, eg "net1", "net2", ...

from matomo.

mattab avatar mattab commented on April 29, 2024

this has become by far the most requested feature - receiving messages twice a day asking for this feature. We should push it in the product.

from matomo.

mattab avatar mattab commented on April 29, 2024

(In [1970]) Fixes #5463

  • modify websites admin UI, API to add a column Exclude IPs
  • IPs contain wildcards, unlimited IPs per website
  • below the website table, added a "Global IP exclude" list. Ips there are excluded from all websites automatically.
  • IPs are stored in the tracker cache file for fast access at Tracking time.
  • added new field in website table "excluded_ips"
  • refactored the ajax loading/error display to allow multiple loading/error div per page

from matomo.

mattab avatar mattab commented on April 29, 2024

Known limitations

  • does not work with IPv6 addresses
  • I haven't researched the getIpString() function as explained by Anthon in [#comment:10] - feel free to pick it up from there

from matomo.

robocoder avatar robocoder commented on April 29, 2024

I see the code uses ip2long() and <= => for comparisons. This smells like a latent bug. Since longs are signed, we have to make sure IPs in the range of 128.0.0.0-255.255.255.255 are handled correctly. Re-opening so we can add isVisitorIpExcluded() testable via unit tests.

re: #comment:10, I've re-opened #567.

from matomo.

mattab avatar mattab commented on April 29, 2024

ouch you're right, thanks for the review!

from matomo.

mattab avatar mattab commented on April 29, 2024

(In [1972]) Fixes #5463
Adding tests that prove that the code was working as expected (I got lucky :)
the IP 255.255.255.* is stored in the config file as:
array (
0 => -256,
1 => -1,
),
which passes the test >= && <= as expected

from matomo.

robocoder avatar robocoder commented on April 29, 2024

(In [1977]) refs #5463 - getIp() returns a stringified, unsigned number; changed unit test to match getIp()'s behaviour; SitesManager converts min/max to non-negative numbers

from matomo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.