Update : I made a follow-up post containing a Nginx-based solution to cache map tiles from OSM and limit the amount of PII you send
While monitoring the logs in Rethink DNS (awesome app BTW) today, I noticed the Immich app making requests to api-l.cofractal.com
.
After reaching out on Immich's discord, the devs explained to me that it is used as a tile provider for the map feature. I can confirm it is not realistic to self-host a tile provider without heavily tuning down the level of details on the map (which would still require a lot of disk space and CPU time). I understand the need for a third-party service to provide the map tiles, but I'm concerned by this one.
Visiting cofractal.com only tells us that they're selling APIs. I did not find any details about the company, not even the country they're registered in. The website is also missing informations about what they are logging or not. Everything else seems gated behind a login page, but they "are not currently accepting new customers". The whois for the domain says they're in California. Digging a bit more, I find AS26073 which apparently is the same company.
This bothers me, because Cofractal gets sent every location you viewed (and the zoom level) on Immich's map, along with your client's IP address and a "Referrer" header pointing to your Immich instance. This sounds like a lot of PII to me. It's also behind cloudflare which gets to see the same stuff.
When asked about it, one dev (thanks to them for almost instantly replying to every concern/question I threw at them) explained that they personally know the people behind Cofractal. According to this Immich dev, Cofractal provides free access to its paid service to Immich's user base as a way to support the project, with the side benefit of load testing their platform.
This explanations seems plausible and reasonable to me. However, I do not personally know the people behind Cofractal, and by default, I do not trust for-profit companies to act in an altruistic way. Here's a summary of everything that makes me uneasy about this company :
- it does not say anything about the kind of data they are logging or not
- it requires digging through whois records to find the most basic info about the company
- it freely provides access to its normally paid service (for the whole Immich user base), but it does not communicate about it (or it is really hard to find)
- it does not communicate about anything : searching for its name only returns its home page and websites with informations on Autonomous Systems
- it is "not currently accepting new [paying] customers" while providing the service for free to a quite large user base (Immich v1.109.2 got 170k downloads in 5 days, v1.108.0 got 438k downloads in 13 days )
- It is not mentioned anywhere in the whole immich.app website (searching for
site:immich.app "cofractal"
gave me no result). Not even a "Thank You" or "Sponsor" note on the homepage for the free API - (it is behind cloudflare)
The dev I talked to encouraged me to create a feature request, and seemed favorable to adding a switch for disabling maps client side. It is already possible to disable it server-wide, and the "URL to a style.json map theme" option seems to provide a way to customize the tile provider. Which leads to this post : I'm trying to collect feedback on this before creating the feature request.
- It should be made prominently clear to server admins that leaving maps enabled causes clients to send requests to a third party-server and give details about what is sent (viewed locations, zoom level, IP address, Immich instance URL). The Post Install Steps in the docs and a paragraph above the switch on the config page seem like good places to me. Are there other/more appropriate place for such a warning ?
- The "URL to a style.json map theme" option should probably be renamed to make it clearer that it allows changing tile providers. Or better yet, it could be reworked to make it easier to choose which third-party you decide to trust
- What do you think about the idea of providing instance admins with a list of choices for tile providers ? Maybe with a short pros/cons list in the docs for each provider. I'd be fine with using a more reputable provider with the extra step of configuring my own API key (which would probably require proxying requests to the tile provider to not share the API key with all clients)
- Should the Immich server proxy requests to the tile provider in any case ? Since the tile provider has access to the Referrer and Origin headers (which is probably required for CORS), they are currently able to link user IP addresses with Immich instances. Proxying requests with the Immich server should prevent that.
- I would go as far as making maps disabled by default for new installs. I understand that "disabling by default would be a significant downgrade for a majority of users", but I feel like there's a strong overlap between the self-hosting and privacy communities. So we should at least have some debate about it
I've also been told that I'm the first one to raise concerns about this, which leads to one more question : Did nobody complain because nobody noticed ? Or are my concerns unjustified ?
You could also start by denying any outside connection to anything except private IP ranges for any docker container, and only allow it on a need to have basis.
It's not enough to rely on the the good will and savvy of whoever made the software, you have to make the restrictions stick.
It's the clients (web/android app, probably iOS too) that are making these requests.
To the best of my knowledge, the Immich server inside the container is not making requests to the outside. It is merely sending a
style.json
to the client displaying a map, which then fetches tiles from the Cofractal URL inside this JSON.Thanks for the detailed feedback. According to one Immich dev, they used to use OSM's raster tile provider but switched away from it since they were causing too much load on OSM's servers.
There does not seem to be any non-commercial vector-tile provider at the moment (though OSM seems to be currently working on it), and it seems really overkill to try and self-host a tile provider (at least with the default level of details). Maybe the way is to find a balanced level of details that makes it reasonable to self host
They could host their own caching proxy between OSM and their users though.
Also, Home Assistant uses OpenStreetMap and they have more users than Immich does.
Edit: Home Assistant does use OSM data, but they use it via another third-party called CARTO, who at least have a proper site: https://carto.com/basemaps. Tiles come from URLs like
https://basemaps.cartocdn.com/rastertiles/voyager/12/657/[email protected]
Home assistant's main use case is showing you where your house is on a single map, though. Not sure how immich works, but if it's one tile per photo with location data, that would be a MUCH bigger ask.
Oh yeah, that's a good catch. Hosting their own proxy/CDN in front of OSM should be doable though.
Or you can quite easily configure nginx as your personal caching proxy with an arbitrarily long TTL/retention duration (you can check out my follow-up post for instructions on doing that)
I can see that as a paid premium feature. There are costs to host anything.
At the end of the day, someone has to pay for it. Either the users pay, or Immich's developers pay, or a map provider pays (by offering it for free and covering the costs).