CalendarEvent/get treats an empty properties array as requesting all properties

Issue Description

CalendarEvent/get treats an explicitly empty properties array as equivalent to omitting the argument, returning the complete CalendarEvent.

RFC 8620 §5.1 defines the standard /get behavior:

“If supplied, only the properties listed in the array are returned for each Foo object.”

It also specifies that the id property is always returned even when not explicitly requested.

Expected Behavior

With:

{
  "properties": []
}

CalendarEvent/get should return only the mandatory id property.

Omitting properties, or setting it to null, should return all applicable properties.

Actual Behavior

Stalwart treats properties: [] as requesting all properties and returns the complete CalendarEvent object.

Reproduction Steps

  1. Create any CalendarEvent.
  2. Fetch it using CalendarEvent/get with properties: [].
  3. Observe that the response contains the full event rather than only id.

Relevant Log Output

N/A

Stalwart Version

v0.16.x

Installation Method

Built from source

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

This confirms the general pattern in the codebase: if !get.properties.is_empty() { get.properties.insert(Property::Id); } — which never adds Id when properties is empty, but that’s paired with treating empty as “all properties” elsewhere. But this may not be the CalendarEvent path specifically. Let me check the calendar event get handler.

Confirmed the bug in source: return_all_properties treats an empty properties array the same as None, deliberately returning all properties instead of just id.

I checked the calendar event Get handler and can confirm this matches the current source code behavior (crates/jmap/src/calendar_event/get.rs):

let return_all_properties = request
    .properties
    .as_ref()
    .is_none_or(|v| matches!(v, MaybeResultReference::Value(v) if v.is_empty()));

This explicitly treats both “properties omitted” and “properties: ” as return_all_properties = true, which does deviate from RFC 8620 §5.1’s behavior of returning only id for an empty array. Your report accurately describes the code as it stands.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Fixed in v0.16.22 (yet to be released).