Skip to content
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

feat: add test/.test to server.allowedHosts/server.cors.origin by default #19250

Closed
wants to merge 5 commits into from

Conversation

sapphi-red
Copy link
Member

Description

Built on top of #19249

@sapphi-red sapphi-red marked this pull request as draft January 21, 2025 05:04
Comment on lines +94 to +98
// allow test and .test by default as they will never be registered
// https://datatracker.ietf.org/doc/html/rfc6761#section-6.2
if (hostname === 'test' || hostname.endsWith('.test')) {
return true
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the test domain name / hostname, the document mentions:

  1. Application software SHOULD NOT recognize test names as special,
    and SHOULD use test names as they would other domain names.

Should we not handle the test hostname in that case?

For TLDs I think it's fine since it doesn't mention anything like that https://datatracker.ietf.org/doc/rfc2606/

Copy link
Member Author

@sapphi-red sapphi-red Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that sentence is meant to include both test and *.tests. So I think we should include both test / *.test or not include both.

The domain "test.", and any names falling within ".test.", are special in the following ways:

(FYI the last dot of test./.test. is to clarify that it's the last item)

Copy link
Member Author

@sapphi-red sapphi-red Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should not add .test anyway as trusting the (cache) DNS server does not necessarily mean you can trust the IPs listed in that DNS server.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Then I guess technically it discourages treating test TLDs differently, so I think I'm somewhat leaning on not adding .test as a special case 🤔

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should not add .test anyway as trusting the (cache) DNS server does not necessarily mean you can trust the IPs listed in that DNS server.

I don't quite understand this reasoning. You would never hit a public (potentially malicious) site under the .test TLD, so a remote attacker could never change DNS resolving of such a domain. Do you mean there is no built-in security on any modern system that prevents local DNS cache from containing (injected) .test domains? (don't know, thought the system would be responsible of ensuring this)

Copy link
Member Author

@sapphi-red sapphi-red Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's say there's an internal DNS server and you and your team all uses that DNS server. Then, a member of your team added foo.test that points to some IP. You know that the DNS server would not fool you, but don't know whether the IP foo.test is pointing is trustable. In most cases, you would never add a DNS record that points to an IP that you don't hold, but you can point to an IP you don't have control of.
You may say that you should never put an IP you don't control, but it's not enforced by something, and there maybe a user that is using .test like that.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's say there's an internal DNS server and you and your team all uses that DNS server. Then, a member of your team added foo.test that points to some IP. (...)

Thanks for explanation. I just thought there would be system level safeguards that would prevent any modern system from ever resolving the .test domain via DNS. But I am probably asking for too much here and we cannot count on such (potential) system level implementations, and anyway that would be against the rfc6761 Application software SHOULD NOT recognize test names as special principle.

@sapphi-red
Copy link
Member Author

Closing for now as it seems it's not something everyone would expect.

@timacdonald
Copy link
Contributor

Appreciate you considering this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants