-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Domain resolution too clever #1991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is also happening in API v2: http://readthedocs.org/api/v2/cname/?host=packaging.python.org {"host":"packaging.python.org","slug":"python"}
$ dig +short packaging.python.org
python.map.fastly.net.
prod.python.map.fastlylb.net.
151.101.60.223 I've opened #2317 to use the same helper both in middleware and API. |
So, I was reading this, I don't fully understand the issue. In what case this bug is triggered? Why some of this domains aren't resolving to *.readthedocs.io (but they are hosted by rtd). As a solution, we should check that the domain matches Also, do we really need the |
So, to trigger this, we have middleware that tries to guess the project based on DNS. I'm not convinced this should be a feature of RTD. The lookup logic is supposed to be:
When it fails is when the domain we're seeing a request for either isn't actually pointing to us, or when there's some other record, like the DNS request above:
Our code assumes the project slug is So!
Based on what you find, we are going to be weighing:
Looks like things could be stacking up to just remove the feature 🔥 |
So, this happens if users cname us without creating a domain in the admin panel, right? |
There are ~1k of these.
It is required to generate a certificate but With that said, I'm +1 on removing this feature. If people want to use RTD with a custom domain, I don't think requiring them to put that domain in the dashboard is burdensome. |
Correct
I'd say it is probably expected even |
+1 to removing our old magic logic. We just need to make sure it won't break a bunch of users when we do it. I believe we backported domains that were doing this into |
One of the tactics that we use for domain magic can result in some unexpected problems. If the project does not have a domain associated with it yet, our middleware will attempt a DNS lookup. This block will attempt to get a slug from a CNAME:
https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/core/middleware.py#L67-L76
We aren't doing anything to check that the domain is our though. In this case, the domain
virtualenv.pypa.io
resolves as such:The above block will split the CNAME returned, assume the slug is the
c
, and apply the domain to this project if it exists.Instead, we should probably ensure the CNAME domain is something we control, and this is indeed a slug, not a hostname.
The text was updated successfully, but these errors were encountered: