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

[stable26] feat: add switch to disable dns pinning #40167

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c450516
Catch more invalid cache source storage paths
joshtrichards Aug 3, 2023
fe85d7d
fix: simplify `sourceData` check
skjnldsv Aug 5, 2023
e876408
fix: close cursor after reading the invitation
kesselb Aug 3, 2023
91e081b
Do not log passwords in debug mode
miaulalala Aug 23, 2023
61e61fb
fix(cache): Remove displayname cache entry on delete
nickvergessen Aug 28, 2023
652a8a8
feat: add switch to disable dns pinning
kesselb Aug 29, 2023
ce71b03
Fix(l10n): Update translations from Transifex
nextcloud-bot Aug 31, 2023
7deef46
fix(s3): fix handling verify_bucket_exists parameter
tcitworld Jun 26, 2023
844a8bb
Fix(l10n): Update translations from Transifex
nextcloud-bot Sep 1, 2023
322001f
Fix(l10n): Update translations from Transifex
nextcloud-bot Sep 2, 2023
f3e3f9b
Fix(l10n): Update translations from Transifex
nextcloud-bot Sep 3, 2023
057b65d
Fix(l10n): Update translations from Transifex
nextcloud-bot Sep 4, 2023
c3f146b
fix: prevent sharing permissions on user root folder
skjnldsv Sep 1, 2023
1340133
more share permission logic to storage wrapper
icewind1991 Aug 14, 2023
065f636
cleanup di for share permissions wrapper
icewind1991 Aug 15, 2023
c2a2416
enh: skip processing for empty response
kesselb Sep 4, 2023
3be562d
Fix(l10n): Update translations from Transifex
nextcloud-bot Sep 5, 2023
22d19af
Merge pull request #40229 from nextcloud/backport/40195/stable26
skjnldsv Sep 5, 2023
02e0098
Merge pull request #40260 from nextcloud/backport/40234/stable26
kesselb Sep 5, 2023
f7d890c
Merge pull request #39726 from nextcloud/backport/39698/stable26
blizzz Sep 5, 2023
db56190
Merge pull request #39816 from nextcloud/backport/39700/stable26
blizzz Sep 5, 2023
f755b50
Merge pull request #40187 from nextcloud/backport/39017/stable26
blizzz Sep 5, 2023
1c29d87
Merge pull request #40232 from nextcloud/sharing-mask-wrapper-26
blizzz Sep 5, 2023
f756d8f
Merge pull request #40076 from nextcloud/fix/stable26/remove-pw-from-…
blizzz Sep 5, 2023
4230aa8
Merge pull request #40085 from nextcloud/backport/40077/stable26
blizzz Sep 5, 2023
d5f6249
Merge pull request #40167 from nextcloud/backport/40108/stable26
blizzz Sep 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/private/Http/Client/ClientService.php
Expand Up @@ -27,8 +27,8 @@
namespace OC\Http\Client;

use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\ICertificateManager;
Expand Down Expand Up @@ -65,7 +65,9 @@ public function __construct(IConfig $config,
public function newClient(): IClient {
$handler = new CurlHandler();
$stack = HandlerStack::create($handler);
$stack->push($this->dnsPinMiddleware->addDnsPinning());
if ($this->config->getSystemValueBool('dns_pinning', true)) {
$stack->push($this->dnsPinMiddleware->addDnsPinning());
}

$client = new GuzzleClient(['handler' => $stack]);

Expand Down
43 changes: 42 additions & 1 deletion tests/lib/Http/Client/ClientServiceTest.php
Expand Up @@ -12,8 +12,8 @@
namespace Test\Http\Client;

use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
use OC\Http\Client\Client;
use OC\Http\Client\ClientService;
use OC\Http\Client\DnsPinMiddleware;
Expand All @@ -28,6 +28,9 @@ class ClientServiceTest extends \Test\TestCase {
public function testNewClient(): void {
/** @var IConfig $config */
$config = $this->createMock(IConfig::class);
$config->method('getSystemValueBool')
->with('dns_pinning', true)
->willReturn(true);
/** @var ICertificateManager $certificateManager */
$certificateManager = $this->createMock(ICertificateManager::class);
$dnsPinMiddleware = $this->createMock(DnsPinMiddleware::class);
Expand All @@ -50,6 +53,44 @@ public function testNewClient(): void {
$stack->push($dnsPinMiddleware->addDnsPinning());
$guzzleClient = new GuzzleClient(['handler' => $stack]);

$this->assertEquals(
new Client(
$config,
$certificateManager,
$guzzleClient,
$remoteHostValidator,
),
$clientService->newClient()
);
}

public function testDisableDnsPinning(): void {
/** @var IConfig $config */
$config = $this->createMock(IConfig::class);
$config->method('getSystemValueBool')
->with('dns_pinning', true)
->willReturn(false);
/** @var ICertificateManager $certificateManager */
$certificateManager = $this->createMock(ICertificateManager::class);
$dnsPinMiddleware = $this->createMock(DnsPinMiddleware::class);
$dnsPinMiddleware
->expects($this->never())
->method('addDnsPinning')
->willReturn(function () {
});
$remoteHostValidator = $this->createMock(IRemoteHostValidator::class);

$clientService = new ClientService(
$config,
$certificateManager,
$dnsPinMiddleware,
$remoteHostValidator,
);

$handler = new CurlHandler();
$stack = HandlerStack::create($handler);
$guzzleClient = new GuzzleClient(['handler' => $stack]);

$this->assertEquals(
new Client(
$config,
Expand Down