Remote participant is stored even when the other server rejected the share

Ouverte
#8,787 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
Une demi-journée
Accessibilité débutants
68/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
php
Domaine
backend

Piste de recherche

The bug is in BoardService::addAcl() in lib/Service/BoardService.php (around line 480), which ignores the response of sendCloudShare() and calls AclMapper::insert() regardless. Read how the CalDAV federation checks the status code in apps/dav/lib/CalDAV/Federation/FederationSharingService.php and mirror that pattern. Done means a rejected share (400, 500, unreachable, or non-201 200) throws an error without inserting the ACL, a 201 still adds the participant, and unit tests assert AclMapper::insert() is not called on failure.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Describe the bug
When a board is shared with a federated user and the other server rejects the share, Deck still adds the remote participant to the board and the API returns 200. The participant never receives anything. The only trace is an error in the sender's nextcloud.log.

BoardService::addAcl() ignores the response of sendCloudShare() and inserts the ACL anyway:
https://github.com/nextcloud/deck/blob/bf65da22e13a366c70c72391beaee00ed2152810/lib/Service/BoardService.php#L480

To Reproduce

  1. Enable Deck federation on instance A.
  2. Share a board with a cloud ID that does not exist on instance B, for example [email protected]. Or share with a valid user on an instance where Deck federation is disabled.
  3. The share appears to succeed and the participant is listed on the board.
  4. The sender's log shows: Error while sending share to federation server: … resulted in a 400 Bad Request response: {"message":"User \"doesnotexist\" does not exists at …"}

Expected behavior
The share fails with an error message and no participant is added.

Suggested fix
Check the response before the ACL is inserted, the way the CalDAV federation does in apps/dav/lib/CalDAV/Federation/FederationSharingService.php:

try {
	$response = $this->cloudFederationProviderManager->sendCloudShare($cloudShare);
} catch (OCMProviderException $e) {
	throw new BadRequestException('Could not reach the remote server to share the board');
}
if ($response->getStatusCode() !== Http::STATUS_CREATED) {
	throw new BadRequestException('The remote server did not accept the board share');
}

The sharing sidebar already shows "Failed to create share with …" when the request fails. Unit tests can cover a rejected share (400, 500 and an unexpected 200), an unreachable server and an accepted share (201), and assert that AclMapper::insert() is not called on failure. I tested this change with unit tests and on the two instances below: a non-existent cloud ID and a receiver with Deck federation disabled now give 400 without a participant, and a valid share still works.

Server details

Two instances, both Docker, MariaDB 11.8 / MySQL, PHP 8.5.13:

  • Instance A: Nextcloud 35.0.3, Deck 1.19.2
  • Instance B: Nextcloud 34.0.6, Deck 1.18.7

The code paths are unchanged on main (bf65da22e).


This report was drafted with AI assistance (Claude Code) and reproduced on the two instances above.

Langage dominant
JavaScript
Étoiles
1.4k
Forks
380
Merge moyen
1 j 17 h
PR mergées (30 j)
72

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de nextcloud/deck

Toutes les issues de nextcloud/deck

Issues similaires

Plus d'issues JavaScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.