nextcloud / nextcloud/server

[Bug]: vCard version 3.0 generated from uploaded vCard 4.0 is invalid

Open
#47,347 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 28-feedback bug feature: carddav feature: dav
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

If a vCard version 4.0 is uploaded to Nextcloud (NC), NC creates a vCard 3.0 from it, which is invalid. The TEL property is not transformed correctly. The resulting erroneous vCard 3.0:

BEGIN:VCARD
VERSION:3.0
PRODID:-//Sabre//Sabre VObject 4.5.4//EN
UID:yllwtc17w1zf0ln772rjv4xcdtcc7kpech32
FN:test v4-2
N:v4-2;test;;;
REV:20240820T123443Z
TEL;TYPE=cell;VALUE=URI:tel:+491234567890
END:VCARD

Because of the invalid TEL property, if you sync the resulting vCard 3.0 to an android phone, the phone number (i.e., TEL) is not shown or available there.

I have noticed this because NC contacts shows the number as tel:+491234567890, including the tel, and thus the URI in the contacts web app becomes tel:tel:+491234567890.

Also, here is the output of vcard, a Python vCard version 3.0 validator:

$ vcard --verbose ../vcard3nc.vcf
Invalid parameter name (See RFC 2426 section 4 for param-name syntax): VALUE
File: ../vcard3nc.vcf
File line: 8
vCard line: 7
Property: TEL
Property line: TEL;TYPE=cell;VALUE=URI:tel:+49133742069

vCard specifications v3.0 & v4.0.

Steps to reproduce
  1. Create a vCard version 4.0. I'm using khard for this.
    Example of a resulting vCard:
BEGIN:VCARD
VERSION:4.0
UID:yllwtc17w1zf0ln772rjv4xcdtcc7kpech32
FN:test v4-2
N:v4-2;test;;;
REV:20240820T123443Z
TEL;TYPE=cell;VALUE=uri:tel:+491234567890
END:VCARD
  1. Upload this vCard to Nextcloud. I'm using vdirsyncer for it.
  2. Download version 3.0 of this vCard, which was created by Nextcloud: curl -ku '<USERNAMER>:<PASSWORD>' https://<NC-DOMAIN>/remote.php/dav/addressbooks/users/<USERNAME>/<ADDRESSBOOK>/<UID>.vcf -H 'Depth: 0' -H 'Content-Type: text/vcard; charset=utf-8;' -H 'Accept: text/vcard; version=3.0'
Expected behavior

A valid vCard version 3.0 should be generated from the vCard 4.0. The TEL property should be transformed such that it conforms to the vCard version 3.0 spec.

Installation method

Community NextcloudPi appliance

Nextcloud Server version

28.0.8

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Well, I did a major upgrade in the past.

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "0": "localhost",
            "1": "nextcloudpi.local",
            "2": "nextcloudpi",
            "3": "nextcloudpi.lan",
            "20": "picloud",
            "21": "picloud.home.arpa",
            "22": "192.168.10.5"
        },
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "28.0.8.1",
        "overwrite.cli.url": "https:\/\/picloud\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "tempdirectory": "\/var\/www\/nextcloud-data\/data\/tmp",
        "mail_smtpmode": "sendmail",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "overwriteprotocol": "https",
        "data-fingerprint": "f1f8769978c71c0cd5016428782b7ccb",
        "maintenance": false,
        "maintenance_window_start": 3,
        "theme": "",
        "loglevel": 2,
        "htaccess.RewriteBase": "\/",
        "default_phone_region": "DE",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "logfile": "\/var\/www\/nextcloud-data\/data\/nextcloud.log",
        "app_install_overwrite": [
            "news",
            "files_rightclick"
        ]
    }
}
List of activated Apps
Enabled:
  - calendar: 4.7.15
  - cloud_federation_api: 1.11.0
  - contacts: 5.5.3
  - cookbook: 0.11.1
  - dav: 1.29.2
  - federatedfilesharing: 1.18.0
  - files: 2.0.0
  - files_reminders: 1.1.0
  - files_versions: 1.21.0
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - news: 24.0.0
  - notes: 4.10.1
  - notifications: 2.16.0
  - notify_push: 0.7.0
  - oauth2: 1.16.3
  - photos: 2.4.0
  - provisioning_api: 1.18.0
  - related_resources: 1.3.0
  - serverinfo: 1.18.0
  - settings: 1.10.1
  - tasks: 0.16.1
  - text: 3.9.2
  - theming: 2.3.0
  - twofactor_backupcodes: 1.17.0
  - unroundedcorners: 1.1.3
  - viewer: 2.2.0
  - workflowengine: 2.10.0
Disabled:
  - activity: 2.20.0 (installed 2.8.2)
  - admin_audit: 1.18.0
  - bruteforcesettings: 2.8.0
  - circles: 28.0.0 (installed 25.0.0)
  - comments: 1.18.0 (installed 1.6.0)
  - contactsinteraction: 1.9.0 (installed 1.1.0)
  - dashboard: 7.8.0 (installed 7.0.0)
  - encryption: 2.16.0 (installed 2.7.0)
  - federation: 1.18.0 (installed 1.5.0)
  - files_external: 1.20.0
  - files_pdfviewer: 2.9.0 (installed 1.5.0)
  - files_rightclick: 0.15.1 (installed 0.15.1)
  - files_sharing: 1.20.0 (installed 1.8.0)
  - files_trashbin: 1.18.0 (installed 1.15.0)
  - firstrunwizard: 2.17.0 (installed 2.4.0)
  - nextcloud_announcements: 1.17.0 (installed 1.5.0)
  - nextcloudpi: 0.0.2 (installed 0.0.1)
  - password_policy: 1.18.0 (installed 1.5.0)
  - previewgenerator: 99.99.99
  - privacy: 1.12.0 (installed 1.0.0)
  - recommendations: 2.0.0 (installed 0.4.0)
  - sharebymail: 1.18.0 (installed 1.6.0)
  - support: 1.11.1 (installed 1.0.0)
  - survey_client: 1.16.0 (installed 1.3.0)
  - suspicious_login: 6.0.0
  - systemtags: 1.18.0 (installed 1.5.0)
  - twofactor_totp: 10.0.0-beta.2
  - updatenotification: 1.18.0 (installed 1.11.0)
  - user_ldap: 1.19.0
  - user_status: 1.8.1 (installed 1.0.0)
  - weather_status: 1.8.0 (installed 1.0.0)
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
{"reqId":"ZsR_3xlX3J4_eWOANZ2sPQAAAA4","level":0,"time":"2024-08-20T11:37:03+00:00","remoteAddr":"fd01::8888:aac:d27b:96fc","user":"<USERNAME>","app":"dav","method":"PUT","url":"/remote.php/dav/addressbooks/users/<USERNAME>/contacts/3dbjzjxxtw30lw9d1x8xj0vahea0j9nlh2a6.vcf","message":"Activity generated for a new card in addressbook 3","userAgent":"vdirsyncer/0.19.2","version":"28.0.8.1","data":{"app":"dav"}}
Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the conversion through the remote.php/dav/addressbooks endpoint using the provided vCard 4.0 input and version 3.0 request, then trace the DAV vCard conversion and Sabre VObject handling. Done means the downloaded vCard validates as version 3.0 and its TEL value no longer includes the invalid VALUE parameter or duplicated tel scheme.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.