View Issue Details

IDProjectCategoryView StatusLast Update
0005955SOGoBackend Address Bookpublic2024-04-20 16:03
Reportermstilkerich Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
PlatformServerOSDebianOS Version11
Product Version5.10.0 
Summary0005955: CardDAV addressbook-query report prop-filter equals match yields no result
Description

The CardDAV addressbook-query report supports searching for vcards where a property's value (e.g. EMAIL) matches a search value. SOGo always returns an empty result. Using the collation "i;unicode-casemap", which is also the default per RFC 6352, the text match should furthermore be performed case insensitive. (Tests 1+2 in the attached file).

As a special case, for properties with a group prefix (e.g., GROUPX.EMAIL), the prop-filter must only match properties having the specified group prefix. Interestingly, using an equals match on a property with group prefix, SOGo shows different behavior and returns all cards o the addressbook. (Test 3 in the attached file)

Test 3 is also helpful as the result will show you that the addressbook actually contains an object that should have matched in Tests 1 and 2.

Steps To Reproduce

Simply issue an addressbook-query report with a prop-filter containing a text-match with match-type "equals" to an addressbook, with a search value that should match at least on object of the addressbook. The result will be empty. See example attached.

TagsNo tags attached.

Activities

mstilkerich

mstilkerich

2024-04-20 16:03

reporter  

AbookQuery_PropFilterEqualsMatch_WrongResult.txt (7,673 bytes)   
Test 1+2: Query an addressbook for vcards where the EMAIL property EQUALS as search value.
Expected result: Only contacts with an EMAIL property containing the exact search value are returned.
Actual result: SOGo returns an empty result.
  - Test 1: Search cards with EMAIL=johndoe@example.com. The card with
            UID=sabre-vobject-04122e61-c800-4099-b0e9-6cf91b96f985 should have been returned.

  - Test 2: Search cards with EMAIL=johNDOE@EXAmple.com to check that match is case-insensitive

Test 3: Query an addressbook for vcards where an EMAIL property belonging to a specific group EQUALS a search value.
Expected result: Only contacts with a SEARCHGROUP.EMAIL property containing the exact search value are returned.
Actual result: SOGo returns all cards of the addressbook.

RFC6352 references:
 - 8.3: Collations supported by the server MUST support "equality" and "substring" match operations as per [RFC4790],
   Section 4.2, including the "prefix" and "suffix" options for "substring" matching.
 - 8.3: CardDAV servers are REQUIRED to support the "i;ascii-casemap" [RFC4790] and "i;unicode-casemap" [RFC5051]
   collations
 - 10.5.1 (prop-filter XML element): When the "name" attribute does not specify a group prefix, it MUST match properties
   in the vCard data without a group prefix or with any group prefix.  When the "name" attribute includes a group
   prefix, it MUST match properties that have exactly the same group prefix and name.



=== TEST 1: Search cards with EMAIL=johndoe@example.com ===

[2024-03-31 08:38:28]: [2 NFO] "REPORT /SOGo/dav/mikey@dev.mike2k.de/Contacts/personal/ HTTP/1.1" 207
>>>>>>>>
REPORT /SOGo/dav/mikey@dev.mike2k.de/Contacts/personal/ HTTP/1.1
Content-Length: 513
User-Agent: GuzzleHttp/7
Host: etain.mike2k.de
Depth: 1
Content-Type: application/xml; charset=UTF-8

<?xml version="1.0"?>
<CARDDAV:addressbook-query xmlns:DAV="DAV:" xmlns:CARDDAV="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/">
 <DAV:prop>
  <DAV:getetag/>
  <CARDDAV:address-data/>
 </DAV:prop>
 <CARDDAV:filter test="anyof">
  <CARDDAV:prop-filter name="EMAIL" test="anyof">
   <CARDDAV:text-match negate-condition="no" collation="i;unicode-casemap" match-type="equals">johndoe@example.com</CARDDAV:text-match>
  </CARDDAV:prop-filter>
 </CARDDAV:filter>
</CARDDAV:addressbook-query>

<<<<<<<<
HTTP/1.1 207 Multi-Status
Server: nginx
Date: Sun, 31 Mar 2024 08:38:28 GMT
Content-Type: text/xml; charset=utf-8
Content-Length: 127
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
X-Frame-Options: SAMEORIGIN

<?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav"></D:multistatus>
--------
NULL





=== TEST 2: Search cards with EMAIL=johNDOE@EXAmple.com (check case-insensitive match) ===

[2024-03-31 08:38:28]: [2 NFO] "REPORT /SOGo/dav/mikey@dev.mike2k.de/Contacts/personal/ HTTP/1.1" 207
>>>>>>>>
REPORT /SOGo/dav/mikey@dev.mike2k.de/Contacts/personal/ HTTP/1.1
Content-Length: 513
User-Agent: GuzzleHttp/7
Host: etain.mike2k.de
Depth: 1
Content-Type: application/xml; charset=UTF-8

<?xml version="1.0"?>
<CARDDAV:addressbook-query xmlns:DAV="DAV:" xmlns:CARDDAV="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/">
 <DAV:prop>
  <DAV:getetag/>
  <CARDDAV:address-data/>
 </DAV:prop>
 <CARDDAV:filter test="anyof">
  <CARDDAV:prop-filter name="EMAIL" test="anyof">
   <CARDDAV:text-match negate-condition="no" collation="i;unicode-casemap" match-type="equals">johNDOE@EXAmple.com</CARDDAV:text-match>
  </CARDDAV:prop-filter>
 </CARDDAV:filter>
</CARDDAV:addressbook-query>

<<<<<<<<
HTTP/1.1 207 Multi-Status
Server: nginx
Date: Sun, 31 Mar 2024 08:38:28 GMT
Content-Type: text/xml; charset=utf-8
Content-Length: 127
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
X-Frame-Options: SAMEORIGIN

<?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav"></D:multistatus>
--------
NULL





=== TEST 3: Search cards where item1.EMAIL=foo@ex.com ===

[2024-03-31 08:38:28]: [2 NFO] "REPORT /SOGo/dav/mikey@dev.mike2k.de/Contacts/personal/ HTTP/1.1" 207
>>>>>>>>
REPORT /SOGo/dav/mikey@dev.mike2k.de/Contacts/personal/ HTTP/1.1
Content-Length: 510
User-Agent: GuzzleHttp/7
Host: etain.mike2k.de
Depth: 1
Content-Type: application/xml; charset=UTF-8

<?xml version="1.0"?>
<CARDDAV:addressbook-query xmlns:DAV="DAV:" xmlns:CARDDAV="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/">
 <DAV:prop>
  <DAV:getetag/>
  <CARDDAV:address-data/>
 </DAV:prop>
 <CARDDAV:filter test="anyof">
  <CARDDAV:prop-filter name="item1.EMAIL" test="anyof">
   <CARDDAV:text-match negate-condition="no" collation="i;unicode-casemap" match-type="equals">foo@ex.com</CARDDAV:text-match>
  </CARDDAV:prop-filter>
 </CARDDAV:filter>
</CARDDAV:addressbook-query>

<<<<<<<<
HTTP/1.1 207 Multi-Status
Server: nginx
Date: Sun, 31 Mar 2024 08:38:28 GMT
Content-Type: text/xml; charset=utf-8
Content-Length: 2493
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
X-Frame-Options: SAMEORIGIN

<?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav"><D:response><D:href>/SOGo/dav/mikey@dev.mike2k.de/Contacts/personal/sabre-vobject-a44a962d-110a-42b6-8e1b-f7df655404db.vcf</D:href><D:propstat><D:prop><D:getetag>"gcs00000000"</D:getetag><C:address-data>BEGIN:VCARD
VERSION:3.0
PRODID:-//Sabre//Sabre VObject 4.5.4//EN
UID:sabre-vobject-a44a962d-110a-42b6-8e1b-f7df655404db
FN:CardDavClient Test25842248
N:Test25842248;CardDavClient
NICKNAME:Jonny1
EMAIL:maxmu@abcd.com
X-CUSTOMPROP;X-SPACEPARAM=&quot;HELLO, WORLD&quot;;X-CUSTOMPARAM=HOME,WORK:foobar
END:VCARD</C:address-data></D:prop><D:status>HTTP/1.1 200 OK</D:status></D:propstat></D:response><D:response><D:href>/SOGo/dav/mikey@dev.mike2k.de/Contacts/personal/sabre-vobject-9e667a3a-10f7-4315-a127-cfa4b2a0fe97.vcf</D:href><D:propstat><D:prop><D:getetag>"gcs00000000"</D:getetag><C:address-data>BEGIN:VCARD
VERSION:3.0
PRODID:-//Sabre//Sabre VObject 4.5.4//EN
UID:sabre-vobject-9e667a3a-10f7-4315-a127-cfa4b2a0fe97
FN:CardDavClient Test31398396
N:Test31398396;CardDavClient
NICKNAME:Jonny2
TEL;TYPE=HOME:12345
TEL:555
END:VCARD</C:address-data></D:prop><D:status>HTTP/1.1 200 OK</D:status></D:propstat></D:response><D:response><D:href>/SOGo/dav/mikey@dev.mike2k.de/Contacts/personal/sabre-vobject-e30b7469-dfb1-41b8-8300-a21205c8b358.vcf</D:href><D:propstat><D:prop><D:getetag>"gcs00000000"</D:getetag><C:address-data>BEGIN:VCARD
VERSION:3.0
PRODID:-//Sabre//Sabre VObject 4.5.4//EN
UID:sabre-vobject-e30b7469-dfb1-41b8-8300-a21205c8b358
FN:CardDavClient Test916984687
N:Test916984687;CardDavClient
NICKNAME:Jonny3
ITEM1.EMAIL:foo@ex.com
ITEM1.X-ABLABEL:CustomLabel
IMPP;TYPE=HOME;X-SERVICE-TYPE=Jabber:xmpp:foo@example.com
END:VCARD</C:address-data></D:prop><D:status>HTTP/1.1 200 OK</D:status></D:propstat></D:response><D:response><D:href>/SOGo/dav/mikey@dev.mike2k.de/Contacts/personal/sabre-vobject-04122e61-c800-4099-b0e9-6cf91b96f985.vcf</D:href><D:propstat><D:prop><D:getetag>"gcs00000000"</D:getetag><C:address-data>BEGIN:VCARD
VERSION:3.0
PRODID:-//Sabre//Sabre VObject 4.5.4//EN
UID:sabre-vobject-04122e61-c800-4099-b0e9-6cf91b96f985
FN:CardDavClient Test953816473
N:Test953816473;CardDavClient
NICKNAME:Jonny0
EMAIL;TYPE=WORK:doe@big.corp
EMAIL;TYPE=HOME:johndoe@example.com
X-CUSTOMPROP;X-CUSTOMPARAM=WORK:foobar
END:VCARD</C:address-data></D:prop><D:status>HTTP/1.1 200 OK</D:status></D:propstat></D:response></D:multistatus>
--------
NULL

Issue History

Date Modified Username Field Change
2024-04-20 16:03 mstilkerich New Issue
2024-04-20 16:03 mstilkerich File Added: AbookQuery_PropFilterEqualsMatch_WrongResult.txt