Skip to content

Commit 62b9c22

Browse files
committed
fix: Add missing PasswordConfirmationRequired attributes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent c126084 commit 62b9c22

6 files changed

Lines changed: 12 additions & 2 deletions

File tree

apps/oauth2/lib/Controller/SettingsController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use OCA\OAuth2\Db\ClientMapper;
1414
use OCP\AppFramework\Controller;
1515
use OCP\AppFramework\Http;
16+
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
1617
use OCP\AppFramework\Http\JSONResponse;
1718
use OCP\Authentication\Token\IProvider as IAuthTokenProvider;
1819
use OCP\IL10N;
@@ -40,6 +41,7 @@ public function __construct(
4041
parent::__construct($appName, $request);
4142
}
4243

44+
#[PasswordConfirmationRequired(strict: true)]
4345
public function addClient(string $name,
4446
string $redirectUri): JSONResponse {
4547
if (filter_var($redirectUri, FILTER_VALIDATE_URL) === false) {
@@ -66,6 +68,7 @@ public function addClient(string $name,
6668
return new JSONResponse($result);
6769
}
6870

71+
#[PasswordConfirmationRequired]
6972
public function deleteClient(int $id): JSONResponse {
7073
$client = $this->clientMapper->getByUid($id);
7174

apps/provisioning_api/lib/Controller/AppsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function getAppInfo(string $app): DataResponse {
109109
*
110110
* 200: App enabled successfully
111111
*/
112-
#[PasswordConfirmationRequired]
112+
#[PasswordConfirmationRequired(strict: true)]
113113
public function enable(string $app): DataResponse {
114114
try {
115115
$app = $this->verifyAppId($app);

apps/settings/lib/Controller/AppSettingsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ public function enableApp(string $appId, array $groups = []): JSONResponse {
566566
* @param array $groups
567567
* @return JSONResponse
568568
*/
569-
#[PasswordConfirmationRequired]
569+
#[PasswordConfirmationRequired(strict: true)]
570570
public function enableApps(array $appIds, array $groups = []): JSONResponse {
571571
try {
572572
$updateRequired = false;

apps/settings/lib/Controller/AuthorizedGroupController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use OCA\Settings\Service\AuthorizedGroupService;
1111
use OCA\Settings\Service\NotFoundException;
1212
use OCP\AppFramework\Controller;
13+
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
1314
use OCP\AppFramework\Http\DataResponse;
1415
use OCP\DB\Exception;
1516
use OCP\IRequest;
@@ -27,6 +28,7 @@ public function __construct(
2728
* @throws NotFoundException
2829
* @throws Exception
2930
*/
31+
#[PasswordConfirmationRequired(strict: true)]
3032
public function saveSettings(array $newGroups, string $class): DataResponse {
3133
$currentGroups = $this->authorizedGroupService->findExistingGroupsForClass($class);
3234

apps/settings/lib/Controller/TwoFactorSettingsController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use OC\Authentication\TwoFactorAuth\EnforcementState;
1212
use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor;
1313
use OCP\AppFramework\Controller;
14+
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
1415
use OCP\AppFramework\Http\JSONResponse;
1516
use OCP\IRequest;
1617

@@ -31,6 +32,7 @@ public function index(): JSONResponse {
3132
return new JSONResponse($this->mandatoryTwoFactor->getState());
3233
}
3334

35+
#[PasswordConfirmationRequired(strict: true)]
3436
public function update(bool $enforced, array $enforcedGroups = [], array $excludedGroups = []): JSONResponse {
3537
$this->mandatoryTwoFactor->setState(
3638
new EnforcementState($enforced, $enforcedGroups, $excludedGroups)

core/Controller/TwoFactorApiController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use OC\Authentication\TwoFactorAuth\ProviderManager;
1212
use OCP\AppFramework\Http;
1313
use OCP\AppFramework\Http\Attribute\ApiRoute;
14+
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
1415
use OCP\AppFramework\Http\DataResponse;
1516
use OCP\AppFramework\OCSController;
1617
use OCP\Authentication\TwoFactorAuth\IRegistry;
@@ -60,6 +61,7 @@ public function state(string $user): DataResponse {
6061
* 404: user not found
6162
*/
6263
#[ApiRoute(verb: 'POST', url: '/enable', root: '/twofactor')]
64+
#[PasswordConfirmationRequired]
6365
public function enable(string $user, array $providers = []): DataResponse {
6466
$userObject = $this->userManager->get($user);
6567
if ($userObject !== null) {
@@ -84,6 +86,7 @@ public function enable(string $user, array $providers = []): DataResponse {
8486
* 404: user not found
8587
*/
8688
#[ApiRoute(verb: 'POST', url: '/disable', root: '/twofactor')]
89+
#[PasswordConfirmationRequired(strict: true)]
8790
public function disable(string $user, array $providers = []): DataResponse {
8891
$userObject = $this->userManager->get($user);
8992
if ($userObject !== null) {

0 commit comments

Comments
 (0)