Open Bug 1961494 Opened 22 days ago Updated 18 days ago

CardDAV address book initial sync not working when sync token is forgotten

Categories

(Thunderbird :: Address Book, defect)

Thunderbird 128
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: shubhraprakash.nandi, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0

Steps to reproduce:

We have developed a new CardDAV server (by extending SabreDAV) and use WebDAV sync and were testing it using Thunderbird CardDAV address book. SabreDAV documentation (read Caveats in this link https://sabre.io/dav/building-a-carddav-client/ ) says if sync token is forgotten by CardDAV server, server would emit HTTP 403 status code which our server does but Thunderbird never initializes initial sync / full sync again after receiving the HTTP status code and keeps sending the old sync token instead of a null sync token. Can you elaborate under what circumstances Thunderbird would perform a initial sync / full sync while using the WebDAV sync?

Actual results:

Thunderbird CardDAV address book never attempts initial sync / full sync after receiving HTTP 403 status code from remote server when using WebDAV sync.

Expected results:

Thunderbird CardDAV address book should attempt initial sync / full sync after receiving HTTP 403 status code from remote server when using WebDAV sync.

I am providing two patches for file - mailnews/addrbook/modules/CardDAVDirectory.sys.mjs@729ca45ce25d2699369bcb7291cf7663ba54daf9
I have not tested these patches.

One if you want to change old behaviour (preferred)
Two if you want to continue legacy behaviour.

Patch 1

--- a/CardDAVDirectory.sys.mjs	2025-04-24 03:21:08.130010906 +0530
+++ b/CardDAVDirectory.sys.mjs	2025-04-24 03:28:33.816092742 +0530
@@ -830,10 +830,10 @@
       headers: {
         Depth: 1, // Only Google seems to need this.
       },
-      expectedStatuses: [207, 400],
+      expectedStatuses: [207, 403],
     });
 
-    if (response.status == 400) {
+    if (response.status == 403) {
       log.warn(
         `Server ${this._serverURL} responded with: ${response.status} ${response.statusText}`
       );

Patch 2

--- a/CardDAVDirectory.sys.mjs	2025-04-24 03:21:08.130010906 +0530
+++ c/CardDAVDirectory.sys.mjs	2025-04-24 03:25:33.935531721 +0530
@@ -830,10 +830,10 @@
       headers: {
         Depth: 1, // Only Google seems to need this.
       },
-      expectedStatuses: [207, 400],
+      expectedStatuses: [207, 400, 403],
     });
 
-    if (response.status == 400) {
+    if (response.status == 400 || response.status == 403) {
       log.warn(
         `Server ${this._serverURL} responded with: ${response.status} ${response.statusText}`
       );
You need to log in before you can comment on or make changes to this bug.