Compare commits

...

10 Commits

Author SHA1 Message Date
Nextcloud Command Bot 54b180bf7c
Merge 60f07450ee into 4049485ec6 2024-04-26 13:40:42 -07:00
Andy Scherzinger 4049485ec6
Merge pull request #45066 from nextcloud/feat/workflow-auto-update-dependabot-approve-merge.yml
Updating dependabot-approve-merge.yml workflow from template
2024-04-26 20:20:55 +02:00
Andy Scherzinger 2e910e3070
Merge pull request #45065 from nextcloud/feat/workflow-auto-update-pr-feedback.yml
Updating pr-feedback.yml workflow from template
2024-04-26 20:20:31 +02:00
Nextcloud bot db5adbd7c4 Updating dependabot-approve-merge.yml workflow from template
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2024-04-26 18:13:17 +00:00
Nextcloud bot c9047a8a5e Updating pr-feedback.yml workflow from template
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2024-04-26 17:59:18 +00:00
Christoph Wurst acf8ea1761
Merge pull request #44670 from nextcloud/fix/session/no-authtoken-password-no-check
fix(session): Do not update authtoken last_check for passwordless
2024-04-26 17:13:57 +02:00
Christoph Wurst 21ee7f59bd
fix(session): Do not update authtoken last_check for passwordless
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2024-04-26 16:05:18 +02:00
Robin Appelman a2fefbce9a
Merge pull request #44496 from nextcloud/feat/s3-accelerate
feat: support "s3-accelerate" endpoint
2024-04-26 15:43:52 +02:00
Robin Appelman 40d9a3fcab
feat: add option to enable s3 acceleration
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-04-26 14:40:24 +02:00
nextcloud-command 60f07450ee chore(tests): Update psalm baseline
Signed-off-by: GitHub <noreply@github.com>
2024-04-26 02:19:25 +00:00
6 changed files with 114 additions and 18 deletions

View File

@ -2,6 +2,9 @@
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Dependabot
@ -21,7 +24,7 @@ concurrency:
jobs:
auto-approve-merge:
if: github.actor == 'dependabot[bot]'
if: github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]'
runs-on: ubuntu-latest-low
permissions:
# for hmarr/auto-approve-action to approve PRs

View File

@ -1,3 +1,15 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2023 Marcel Klehr <mklehr@gmx.net>
# SPDX-FileCopyrightText: 2023 Joas Schilling <213943+nickvergessen@users.noreply.github.com>
# SPDX-FileCopyrightText: 2023 Daniel Kesselberg <mail@danielkesselberg.de>
# SPDX-FileCopyrightText: 2023 Florian Steffens <florian.steffens@nextcloud.com>
# SPDX-License-Identifier: MIT
name: 'Ask for feedback on PRs'
on:
schedule:
@ -5,25 +17,25 @@ on:
jobs:
pr-feedback:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: The get-github-handles-from-website action
uses: marcelklehr/get-github-handles-from-website-action@a739600f6b91da4957f51db0792697afbb2f143c # v1.0.0
id: scrape
with:
website: 'https://nextcloud.com/team/'
- uses: marcelklehr/pr-feedback-action@601109aa729eb4c8d6d0ece7567b9d4901db4aef
- uses: marcelklehr/pr-feedback-action@1883b38a033fb16f576875e0cf45f98b857655c4
with:
feedback-message: |
Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.
We hope that the reviewing process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR reviewing process.
We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.
Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6
Thank you for contributing to Nextcloud and we hope to hear from you soon!
days-before-feedback: 14
start-date: "2023-07-10"
exempt-authors: "${{ steps.scrape.outputs.users }}"
exempt-authors: "${{ steps.scrape.outputs.users }},nextcloud-command,nextcloud-android-bot,skjnldsv,datenangebot"
exempt-bots: true

View File

@ -1318,21 +1318,11 @@
<code>$arguments</code>
</ParamNameMismatch>
</file>
<file src="core/Command/App/Install.php">
<TypeDoesNotContainType>
<code>$result === false</code>
</TypeDoesNotContainType>
</file>
<file src="core/Command/App/ListApps.php">
<LessSpecificImplementedReturnType>
<code>array</code>
</LessSpecificImplementedReturnType>
</file>
<file src="core/Command/App/Update.php">
<RedundantCondition>
<code>$result === true</code>
</RedundantCondition>
</file>
<file src="core/Command/Config/Import.php">
<InvalidScalarArgument>
<code>0</code>

View File

@ -71,11 +71,17 @@ trait S3ConnectionTrait {
$this->copySizeLimit = $params['copySizeLimit'] ?? 5242880000;
$this->useMultipartCopy = (bool)($params['useMultipartCopy'] ?? true);
$params['region'] = empty($params['region']) ? 'eu-west-1' : $params['region'];
$params['s3-accelerate'] = $params['hostname'] == 's3-accelerate.amazonaws.com' || $params['hostname'] == 's3-accelerate.dualstack.amazonaws.com';
$params['hostname'] = empty($params['hostname']) ? 's3.' . $params['region'] . '.amazonaws.com' : $params['hostname'];
if (!isset($params['port']) || $params['port'] === '') {
$params['port'] = (isset($params['use_ssl']) && $params['use_ssl'] === false) ? 80 : 443;
}
$params['verify_bucket_exists'] = $params['verify_bucket_exists'] ?? true;
if ($params['s3-accelerate']) {
$params['verify_bucket_exists'] = false;
}
$this->params = $params;
}
@ -122,6 +128,13 @@ trait S3ConnectionTrait {
'http' => ['verify' => $this->getCertificateBundlePath()],
'use_aws_shared_config_files' => false,
];
if ($this->params['s3-accelerate']) {
$options['use_accelerate_endpoint'] = true;
} else {
$options['endpoint'] = $base_url;
}
if ($this->getProxy()) {
$options['http']['proxy'] = $this->getProxy();
}
@ -150,7 +163,9 @@ trait S3ConnectionTrait {
'exception' => $e,
'app' => 'objectstore',
]);
throw new \Exception('Creation of bucket "' . $this->bucket . '" failed. ' . $e->getMessage());
if ($e->getAwsErrorCode() !== "BucketAlreadyOwnedByYou") {
throw new \Exception('Creation of bucket "' . $this->bucket . '" failed. ' . $e->getMessage());
}
}
}

View File

@ -767,8 +767,6 @@ class Session implements IUserSession, Emitter {
return false;
}
$dbToken->setLastCheck($now);
$this->tokenProvider->updateToken($dbToken);
return true;
}

View File

@ -11,9 +11,11 @@ namespace Test\User;
use OC\AppFramework\Http\Request;
use OC\Authentication\Events\LoginFailed;
use OC\Authentication\Exceptions\InvalidTokenException;
use OC\Authentication\Exceptions\PasswordlessTokenException;
use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
use OC\Authentication\Token\PublicKeyToken;
use OC\Security\CSRF\CsrfTokenManager;
use OC\Session\Memory;
use OC\User\LoginException;
@ -35,6 +37,8 @@ use OCP\Security\ISecureRandom;
use OCP\User\Events\PostLoginEvent;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use function array_diff;
use function get_class_methods;
/**
* @group DB
@ -309,6 +313,80 @@ class SessionTest extends \Test\TestCase {
$userSession->login('foo', 'bar');
}
public function testPasswordlessLoginNoLastCheckUpdate(): void {
$session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
$managerMethods = get_class_methods(Manager::class);
// Keep following methods intact in order to ensure hooks are working
$mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']);
$manager = $this->getMockBuilder(Manager::class)
->setMethods($mockedManagerMethods)
->setConstructorArgs([
$this->config,
$this->createMock(ICacheFactory::class),
$this->createMock(IEventDispatcher::class),
])
->getMock();
$userSession = new Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher);
$session->expects($this->never())
->method('set');
$session->expects($this->once())
->method('regenerateId');
$token = new PublicKeyToken();
$token->setLoginName('foo');
$token->setLastCheck(0); // Never
$token->setUid('foo');
$this->tokenProvider
->method('getPassword')
->with($token)
->willThrowException(new PasswordlessTokenException());
$this->tokenProvider
->method('getToken')
->with('app-password')
->willReturn($token);
$this->tokenProvider->expects(self::never())
->method('updateToken');
$userSession->login('foo', 'app-password');
}
public function testLoginLastCheckUpdate(): void {
$session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
$managerMethods = get_class_methods(Manager::class);
// Keep following methods intact in order to ensure hooks are working
$mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']);
$manager = $this->getMockBuilder(Manager::class)
->setMethods($mockedManagerMethods)
->setConstructorArgs([
$this->config,
$this->createMock(ICacheFactory::class),
$this->createMock(IEventDispatcher::class),
])
->getMock();
$userSession = new Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher);
$session->expects($this->never())
->method('set');
$session->expects($this->once())
->method('regenerateId');
$token = new PublicKeyToken();
$token->setLoginName('foo');
$token->setLastCheck(0); // Never
$token->setUid('foo');
$this->tokenProvider
->method('getPassword')
->with($token)
->willReturn('secret');
$this->tokenProvider
->method('getToken')
->with('app-password')
->willReturn($token);
$this->tokenProvider->expects(self::once())
->method('updateToken');
$userSession->login('foo', 'app-password');
}
public function testLoginNonExisting() {
$session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
$manager = $this->createMock(Manager::class);