-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Allow wildcard * to be used in trusted domains #314
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
Conversation
…re no reliable DNS entry is available (e.g. mDNS) or for simple-to-setup aliasing (e.g. *.example.com)
|
@jernst, thanks for your PR! By analyzing the annotation information on this pull request, we identified @LukasReschke, @DeepDiver1975 and @MorrisJobke to be potential reviewers |
|
|
||
| // If a value contains a *, apply glob-style matching. Any second * is ignored. | ||
| foreach ($trustedList as $trusted) { | ||
| if($trusted == '*') { |
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.
===
|
That's a lot of code for a very minor feature and it also contains some syntax errors (which the unit tests have spotted!). Can you by any chance make the code smaller by switching to a regex or so? |
| } | ||
| $star = strpos($trusted, '*'); | ||
| if($star === false) { | ||
| next; |
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.
Syntax error.
|
You can add test entries at server/tests/lib/Security/TrustedDomainHelperTest.php Lines 46 to 80 in 83ea738
cd tests && phpunit lib/Security/TrustedDomainHelperTest.php
|
Something like:
Wheras you replace all stars with |
Use === instead of == for extra paranoia.
|
I'll see what I can do to make it shorter tomorrow. Regexes for security checks of domains containing . and patterns containing * are easy to get wrong ... |
|
I really would love to see the test cases extended for this: https://github.com/nextcloud/server/blob/master/tests/lib/Security/TrustedDomainHelperTest.php 😉 |
…d domain expression Stricter checking for valid domain names
|
@LukasReschke Please recheck ;) |
|
Code looks good to me. Thanks a lot 🚀 Can I ask you to add a small note to the config option in config.sample.php that the |
|
You mean Next++cloud? :-) |
|
Thanks a lot for your Pull Request. LGTM! 🚀 ❤️ 🎉 |
|
👍 |
…extcloud#314) Resolves: nextcloud#307 - [x] Allow disable and remove actions if default Deploy daemon is not available. - [x] Set ping timeout to 3s --------- Signed-off-by: Andrey Borysenko <[email protected]>
This is to support setups where no reliable DNS entry is available (e.g. mDNS) or for simple-to-setup aliasing (e.g. *.example.com)
This time, I hope, tabs and formatting are all in the right places for your coding standards. We had been doing this patch just for UBOS, but now that you are doing checksums on PHP files, such as private patch leads to warnings in the management console, and I hope it can be merged into the main.
As using a * in a trusted domain is entirely optional, this should have no security implications for the default setup.
If you'd like me to augment some existing tests, I'd appreciate a pointer to which tests.