Skip to content

Conversation

@jernst
Copy link

@jernst jernst commented Dec 19, 2014

I'm not quite understanding how ownCloud releases are produced from git, nor how to run the tests, and so I don't quite know how to test this. I'm hoping that a friendly soul will advise and/or merge. Thanks.
Corresponding pull requests to docs coming.

@ghost
Copy link

ghost commented Dec 19, 2014

Thanks a lot for your contribution! Contributions to the core repo require a signed contributors agreement http://owncloud.org/contribute/agreement/ Alternatively you can add a comment here stating that this contribution is MIT licensed. Some more details about out pull request workflow can be found here: http://owncloud.org/code-reviews-on-github/

@scrutinizer-notifier
Copy link

The inspection completed: 2 new issues, 1 updated code elements

@karlitschek
Copy link
Contributor

@LukasReschke

@@ -110,9 +110,26 @@ public static function isTrustedDomain($domainWithPort) {
return true;
}

return in_array($domain, $trustedList);
// Allow access from an explicitly listed domain
if( in_array($domain, $trustedList)) {
Copy link
Member

Choose a reason for hiding this comment

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

No space here after the (

@LukasReschke
Copy link
Member

Thanks for your contribution @jernst.

We're using PHPUnit for our PHP unit tests, running a single test-suite is pretty straight forward:

  1. Download PHPUnit (https://phpunit.de/getting-started.html)
  2. Open a terminal
  3. cd into the owncloud root directory
  4. cd into the tests directory within that
  5. run the unit test on the file that contains the test such as phpunit lib/request.php

The output will look like following if everything worked:

➜  tests git:(master) ✗ phpunit lib/request.php
PHPUnit 4.3.4 by Sebastian Bergmann.

Configuration read from /Users/lreschke/Programming/core/tests/phpunit.xml.dist

.............................................

Time: 366 ms, Memory: 12.00Mb

OK (45 tests, 60 assertions)

If something failed you will pretty much notice it as it will complain - I guess that should be enough to get you started for now to adjust the unit tests? I'm kinda reluctant to add new features without having them covered by tests.

Then we also have that fancy autotest.sh script which you can invoke with bash autotest.sh sqlite which runs ALL unit-tests and takes about 15 minutes. You normally don't need to run that.

By the way, don't worry about the "Failed" sign here on GitHub our Continuous Integration (CI) system is currently somewhat buggy, that system is running our autotest.sh script for every contribution to ensure that nothing broke. We hope to get that sorted out over christmas.

Let me know if you have any further question or require further assistance. I'd be glad to help you! :-)

@DeepDiver1975
Copy link
Member

unit tests are required -> moving to OC8.1

@DeepDiver1975 DeepDiver1975 added this to the 8.1-next milestone Dec 22, 2014
@BernhardPosselt
Copy link
Contributor

I feel like this is really bad from a security POV and basically circumvents the host header poisoning prevention. Use a free service like http://www.noip.com/ to handle dynamic ips or use a VPN 👎

@jernst
Copy link
Author

jernst commented Jan 10, 2015

@Raydiation: either you enforce security in the code base to the extent that it is "impossible" to run ownCloud with anything other than maximum security (per your view, whatever that is), in which case you make it impossible for users who know what they are doing (or are willing to take the risk) to do what they want. Or you set the right secure defaults, but let people override them. I'm in favor of #2, thus this proposed patch. I do not believe that it reduces security at all, unless the user decides they want that.

@LukasReschke
Copy link
Member

Agreed with @jernst - if this change is done correctly I don't mind it.

There is always a compromise between usability and security. This one is fine and has certainly some reasonability behind it. (for example auto-provisoning in a fixed IP block / subdomain etc...)

@LukasReschke LukasReschke changed the title Allow * wildcard in trusted_domains to support unstable DNS names and unstable IP addresses [WIP] Allow * wildcard in trusted_domains to support unstable DNS names and unstable IP addresses Feb 24, 2015
@LukasReschke
Copy link
Member

Requires unit tests and rebase. Otherwise we can't merge this :-(

@uboslinux
Copy link

We currently do our own ownCloud patch in UBOS, it's here: https://github.com/indiebox/ubos-owncloud/blob/master/owncloud/allow-wildcard-trusted.patch. This replaces this merge request.

Corresponding test is here: https://github.com/indiebox/ubos-owncloud/blob/master/owncloud/tests/OwnCloud1Test.pm but that uses the UBOS webapptest framework, not your's. I don't currently have time to get up to speed with your test infrastructure, so I don't know how to proceed.

@LukasReschke LukasReschke removed their assignment Mar 4, 2015
@DeepDiver1975 DeepDiver1975 modified the milestones: 8.2-next, 8.1-current Apr 2, 2015
@ghost
Copy link

ghost commented Apr 30, 2015

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/12057/
💣 Test FAILed. 💣

nooo432

@LukasReschke
Copy link
Member

Closing due to inactivity. Feel free to reopen once unit tests have been added, see

public function testGetServerHostWithUntrustedDomain() {
$this->config
->expects($this->at(3))
->method('getSystemValue')
->with('trusted_domains')
->will($this->returnValue(['my.trusted.host']));
$this->config
->expects($this->at(4))
->method('getSystemValue')
->with('trusted_domains')
->will($this->returnValue(['my.trusted.host']));
$request = new Request(
[
'server' => [
'HTTP_X_FORWARDED_HOST' => 'my.untrusted.host',
],
],
$this->secureRandom,
$this->config,
$this->stream
);
$this->assertEquals('my.trusted.host', $request->getServerHost());
}
and Co. for examples.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants