Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not send imip email to invalid recipients #25582

Merged
merged 1 commit into from
Feb 11, 2021

Conversation

ChristophWurst
Copy link
Member

@ChristophWurst ChristophWurst commented Feb 11, 2021

I just had an error caused by Calendar as I trued to save this vcard:

BEGIN:VCALENDAR
PRODID:-//IDN nextcloud.com//Calendar app 2.1.3//EN
CALSCALE:GREGORIAN
VERSION:2.0
BEGIN:VEVENT
CREATED:20210211T120406Z
DTSTAMP:20210211T121704Z
LAST-MODIFIED:20210211T121704Z
SEQUENCE:3
UID:4d5ce95b-a3b3-48cd-bf3b-1d66d5560f98
DTSTART;TZID=Europe/Vienna:20210211T100000
DTEND;TZID=Europe/Vienna:20210211T173000
SUMMARY:Busy
TRANSP:OPAQUE
ATTENDEE;CN=otheruser;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTIC
 IPANT;RSVP=FALSE:mailto:
ORGANIZER;CN=admin:mailto:myemail@domain.com
END:VEVENT
BEGIN:VTIMEZONE
TZID:Europe/Vienna
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
END:VCALENDAR
{
  "reqId": "nQnCxyq0HNQqfZZFuxWv",
  "level": 4,
  "time": "2021-02-11T12:18:06+00:00",
  "remoteAddr": "127.0.0.1",
  "user": "admin",
  "app": "webdav",
  "method": "PUT",
  "url": "/remote.php/dav/calendars/admin/personal/7A27E6FF-0910-46B1-A0CF-429B35126D4D.ics",
  "message": {
    "Exception": "TypeError",
    "Message": "idn_to_ascii() expects parameter 1 to be string, null given",
    "Code": 0,
    "Trace": [
      {
        "file": "/home/christoph/workspace/nextcloud/lib/private/Mail/Message.php",
        "line": 84,
        "function": "idn_to_ascii",
        "args": [
          "*** sensitive parameter replaced ***",
          0,
          1
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/lib/private/Mail/Message.php",
        "line": 149,
        "function": "convertAddresses",
        "class": "OC\\Mail\\Message",
        "type": "->",
        "args": [
          {
            "": "otheruser"
          }
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php",
        "line": 238,
        "function": "setTo",
        "class": "OC\\Mail\\Message",
        "type": "->",
        "args": [
          {
            "": "otheruser"
          }
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "schedule",
        "class": "OCA\\DAV\\CalDAV\\Schedule\\IMipPlugin",
        "type": "->",
        "args": [
          {
            "uid": "4d5ce95b-a3b3-48cd-bf3b-1d66d5560f98",
            "component": "VEVENT",
            "method": "REQUEST",
            "sequence": 3,
            "sender": "mailto:myemail@domain.com",
            "senderName": {
              "name": "CN",
              "noName": false,
              "parent": null,
              "__class__": "Sabre\\VObject\\Parameter"
            },
            "recipient": "mailto:",
            "recipientName": "otheruser",
            "scheduleStatus": "3.7;Could not find principal.",
            "message": {
              "name": "VCALENDAR",
              "parent": null,
              "__class__": "Sabre\\VObject\\Component\\VCalendar"
            },
            "significantChange": true,
            "__class__": "Sabre\\VObject\\ITip\\Message"
          }
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/dav/lib/CalDAV/Schedule/Plugin.php",
        "line": 350,
        "function": "emit",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          "schedule",
          [
            {
              "uid": "4d5ce95b-a3b3-48cd-bf3b-1d66d5560f98",
              "component": "VEVENT",
              "method": "REQUEST",
              "sequence": 3,
              "sender": "mailto:myemail@domain.com",
              "senderName": {
                "name": "CN",
                "noName": false,
                "parent": null,
                "__class__": "Sabre\\VObject\\Parameter"
              },
              "recipient": "mailto:",
              "recipientName": "otheruser",
              "scheduleStatus": "3.7;Could not find principal.",
              "message": {
                "name": "VCALENDAR",
                "parent": null,
                "__class__": "Sabre\\VObject\\Component\\VCalendar"
              },
              "significantChange": true,
              "__class__": "Sabre\\VObject\\ITip\\Message"
            }
          ]
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/dav/lib/CalDAV/Schedule/Plugin.php",
        "line": 626,
        "function": "deliver",
        "class": "Sabre\\CalDAV\\Schedule\\Plugin",
        "type": "->",
        "args": [
          {
            "uid": "4d5ce95b-a3b3-48cd-bf3b-1d66d5560f98",
            "component": "VEVENT",
            "method": "REQUEST",
            "sequence": 3,
            "sender": "mailto:myemail@domain.com",
            "senderName": {
              "name": "CN",
              "noName": false,
              "parent": null,
              "__class__": "Sabre\\VObject\\Parameter"
            },
            "recipient": "mailto:",
            "recipientName": "otheruser",
            "scheduleStatus": "3.7;Could not find principal.",
            "message": {
              "name": "VCALENDAR",
              "parent": null,
              "__class__": "Sabre\\VObject\\Component\\VCalendar"
            },
            "significantChange": true,
            "__class__": "Sabre\\VObject\\ITip\\Message"
          }
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/dav/lib/CalDAV/Schedule/Plugin.php",
        "line": 337,
        "function": "processICalendarChange",
        "class": "Sabre\\CalDAV\\Schedule\\Plugin",
        "type": "->",
        "args": [
          {
            "name": "VCALENDAR",
            "parent": null,
            "__class__": "Sabre\\VObject\\Component\\VCalendar"
          },
          {
            "name": "VCALENDAR",
            "parent": null,
            "__class__": "Sabre\\VObject\\Component\\VCalendar"
          },
          [
            "mailto:myemail@domain.com",
            "/remote.php/dav/principals/users/admin/"
          ],
          [],
          true
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/apps/dav/lib/CalDAV/Schedule/Plugin.php",
        "line": 150,
        "function": "calendarObjectChange",
        "class": "Sabre\\CalDAV\\Schedule\\Plugin",
        "type": "->",
        "args": [
          {
            "__class__": "Sabre\\HTTP\\Request"
          },
          {
            "__class__": "Sabre\\HTTP\\Response"
          },
          {
            "name": "VCALENDAR",
            "parent": null,
            "__class__": "Sabre\\VObject\\Component\\VCalendar"
          },
          "calendars/admin/personal",
          true,
          false
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "calendarObjectChange",
        "class": "OCA\\DAV\\CalDAV\\Schedule\\Plugin",
        "type": "->",
        "args": [
          {
            "__class__": "Sabre\\HTTP\\Request"
          },
          {
            "__class__": "Sabre\\HTTP\\Response"
          },
          {
            "name": "VCALENDAR",
            "parent": null,
            "__class__": "Sabre\\VObject\\Component\\VCalendar"
          },
          "calendars/admin/personal",
          true,
          false
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/dav/lib/CalDAV/Plugin.php",
        "line": 897,
        "function": "emit",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          "calendarObjectChange",
          [
            {
              "__class__": "Sabre\\HTTP\\Request"
            },
            {
              "__class__": "Sabre\\HTTP\\Response"
            },
            {
              "name": "VCALENDAR",
              "parent": null,
              "__class__": "Sabre\\VObject\\Component\\VCalendar"
            },
            "calendars/admin/personal",
            true,
            false
          ]
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/dav/lib/CalDAV/Plugin.php",
        "line": 739,
        "function": "validateICalendar",
        "class": "Sabre\\CalDAV\\Plugin",
        "type": "->",
        "args": [
          "*** sensitive parameter replaced ***",
          "*** sensitive parameter replaced ***",
          false,
          {
            "__class__": "Sabre\\HTTP\\Request"
          },
          {
            "__class__": "Sabre\\HTTP\\Response"
          },
          false
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "beforeWriteContent",
        "class": "Sabre\\CalDAV\\Plugin",
        "type": "->",
        "args": [
          "*** sensitive parameter replaced ***",
          {
            "__class__": "OCA\\DAV\\CalDAV\\CalendarObject"
          },
          "*** sensitive parameter replaced ***",
          false
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 1133,
        "function": "emit",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          "beforeWriteContent",
          [
            "*** sensitive parameter replaced ***",
            {
              "__class__": "OCA\\DAV\\CalDAV\\CalendarObject"
            },
            "*** sensitive parameter replaced ***",
            false
          ]
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",
        "line": 492,
        "function": "updateFile",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
        "line": 89,
        "function": "httpPut",
        "class": "Sabre\\DAV\\CorePlugin",
        "type": "->",
        "args": [
          {
            "__class__": "Sabre\\HTTP\\Request"
          },
          {
            "__class__": "Sabre\\HTTP\\Response"
          }
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 472,
        "function": "emit",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          "method:PUT",
          [
            {
              "__class__": "Sabre\\HTTP\\Request"
            },
            {
              "__class__": "Sabre\\HTTP\\Response"
            }
          ]
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 253,
        "function": "invokeMethod",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": [
          {
            "__class__": "Sabre\\HTTP\\Request"
          },
          {
            "__class__": "Sabre\\HTTP\\Response"
          }
        ]
      },
      {
        "file": "/home/christoph/workspace/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
        "line": 321,
        "function": "start",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/home/christoph/workspace/nextcloud/apps/dav/lib/Server.php",
        "line": 332,
        "function": "exec",
        "class": "Sabre\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/home/christoph/workspace/nextcloud/apps/dav/appinfo/v2/remote.php",
        "line": 35,
        "function": "exec",
        "class": "OCA\\DAV\\Server",
        "type": "->",
        "args": []
      },
      {
        "file": "/home/christoph/workspace/nextcloud/remote.php",
        "line": 167,
        "args": [
          "/home/christoph/workspace/nextcloud/apps/dav/appinfo/v2/remote.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/home/christoph/workspace/nextcloud/lib/private/Mail/Message.php",
    "Line": 84,
    "CustomMessage": "--"
  },
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0",
  "version": "22.0.0.0"
}

This smells very related to #25310.

Fixes #18941 #15243

@ChristophWurst ChristophWurst added bug 3. to review Waiting for reviews labels Feb 11, 2021
@ChristophWurst ChristophWurst added this to the Nextcloud 22 milestone Feb 11, 2021
@ChristophWurst ChristophWurst self-assigned this Feb 11, 2021
@ChristophWurst
Copy link
Member Author

/backport to stable21

@ChristophWurst
Copy link
Member Author

/backport to stable20

@ChristophWurst
Copy link
Member Author

/backport to stable19

Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems sane. Is it easy to add some tests?

Copy link
Member

@tcitworld tcitworld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs tests changes into IMipPluginTest.php.

@tcitworld
Copy link
Member

Makes me think we could first check in validateMailAddress that the $email length is > 0 without even loading the validators.

@faily-bot

This comment has been minimized.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst
Copy link
Member Author

Makes me think we could first check in validateMailAddress that the $email length is > 0 without even loading the validators.

#25585 :)

@rullzer rullzer merged commit f124cb0 into master Feb 11, 2021
@rullzer rullzer deleted the fix/no-imip-for-invalid-recpient branch February 11, 2021 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in saving a meeting when no email address is suppiied
3 participants