View Issue Details

IDProjectCategoryView StatusLast Update
0005956SOGoBackend Address Bookpublic2024-04-20 16:29
Reportermstilkerich Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
PlatformServerOSDebianOS Version11
Product Version5.10.0 
Summary0005956: CardDAV addressbook-query report ignored negation attribute in text-match filter
Description

The CardDAV addressbook-query report supports searching for vcards where a property's value (e.g. EMAIL) does NOT match a text-match condition (negate-condition="yes" attribute to the text-match element). SOGo appears to ignore this attribute, i.e., it returns the card matching the text-match, which is the exact opposite of what is expected.

See test in the attached file.

Steps To Reproduce

Issue an addressbook-query REPORT as shown in the attached file for an addressbook that has at least one card matching the text-match, and one that does not.

TagsNo tags attached.

Activities

mstilkerich

mstilkerich

2024-04-20 16:29

reporter  

AbookQuery_PropFilterInvTextMatchIgnored.txt (2,458 bytes)   
Test: Query an addressbook for vcards having an EMAIL property that does NOT end in @abcd.com
Expected result: Only contacts with an EMAIL property that does NOT end in @abcd.com are returned.
Actual result: SOGo returns contacts with an EMAIL property ending in @abcd.com, i.e. it ignores the negate-condition="yes" attribute to the text-match.

RFC 6352 references:
  - 10.5.4 (text-match XML element): The "negate-condition" attribute is used to indicate that this test returns a match
    if the text matches, when the attribute value is set to "no", or return a match if the text does not match, if the
    attribute value is set to "yes".

[2024-04-01 07:53:23]: [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: 507
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="yes" collation="i;unicode-casemap" match-type="ends-with">@abcd.com</CARDDAV:text-match>
  </CARDDAV:prop-filter>
 </CARDDAV:filter>
</CARDDAV:addressbook-query>

<<<<<<<<
HTTP/1.1 207 Multi-Status
Server: nginx
Date: Mon, 01 Apr 2024 07:53:23 GMT
Content-Type: text/xml; charset=utf-8
Content-Length: 738
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-88a2b704-2ad4-4d90-bb5f-5e618fe5a3ee.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-88a2b704-2ad4-4d90-bb5f-5e618fe5a3ee
FN:CardDavClient Test1243750715
N:Test1243750715;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:multistatus>
--------
NULL

Issue History

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