This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add very basic domain validation for DomainSpecificString
.
#9071
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix "Failed to send request" errors when a client provides an invalid room alias. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bunch of rules about valid domain names that we could enforce (< 253 characters, made up of labels of 63 characters, etc) but I'm no confident in those not being broke by same real domain names out there. Commas shouldn't be allowed, as well as other general punctuation (
:!@#$%^&*()
, etc.)... I can expand this if we'd like. 😄There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:
absolutely can go in the domain part of a domain specific string, since they can include ipv6 literals, with all the fun that entails.There already exists a function
parse_and_validate_server_name
which does what I think you want here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to remember the reason we didn't already do more validation here. I think the reason is some combination of:
DomainSpecificString
. However I'm prepared to believe that increased robustness from better checking makes that a price worth paying.If you want to give it a go, I won't object. Just trying to give some background.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, IP literals complicate things a bit. 😢
Pulling things out of the database might not need validation, but we should be validating new data coming in. I might be able to do something a bit more specific for that endpoint to fix the Sentry issue, but that feels more like a hack. I could believe there's some broken aliases and such already in events, unfortunately. I'll think a bit about.
Thanks for the pointer to
parse_and_validate_server_name
!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some changes based on this conversation -- the additional validation is only done on
is_valid
and not withfrom_string
. I did a bit of auditing and it looks likeis_valid
is never called with data pulled from the database so I hope this is safer!