Internet-Draft | Use of VAPID in JMAP WebPush | August 2024 |
Gultsch | Expires 7 February 2025 | [Page] |
This document defines a method for JMAP servers to advertise their capability to authenticate WebPush notifications using the Voluntary Application Server Identification protocol.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 7 February 2025.¶
Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
JMAP [RFC8620] specifies how clients can subscribe to events using a protocol that is compatible to WebPush [RFC8030]. Some push services require that the application server authenticates all push messages using the Voluntary Application Server Identification protocol [RFC8292]. To faciliate that the client (or user agent in WebPush terminology) needs the VAPID public key of the application server to pass it along to the push service when retrieving a new endpoint.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. These words may also appear in this document in lower case as plain English words, absent their normative meanings.¶
The JMAP capabilities object is returned as part of the standard JMAP session object (see Section 2 of [RFC8620]). Servers supporting this specification MUST add a property called "urn:ietf:params:jmap:webpush-vapid" to the capabilities object. The value of this property is an object that MUST contain the following information:¶
Every time the server sends a push message to a PushSubscription URL it MUST authenticate that POST request using the protocol outlined in [RFC8292]. This includes both StateChange events and PushVerification notifications. The server MUST use the application server key that was advertised in the capabilites object at the time the PushSubscription was created.¶
When a server needs to replace its VAPID key, it MUST update the sessionState in accordance with [RFC8620]. The client MUST monitor the JMAP session object for changes to the VAPID key and MUST recreate its push subscription after detecting such a change.¶
After key rotation, the server MAY continue to send push notifications for existing push subscriptions using the old application server key for a transitional period. This allows clients time to recreate their respective push subscriptions. After the transitional period (or immediately for implementations that do not have one), the server MUST destroy push subscriptions that use the old key.¶
When destroying push subscriptions that include the data type PushSubscription
, the server MAY issue one final StateChange push notification using the old URL and application server key to notify the client of changes to the PushSubscription data type. This prompts the client to make a PushSubscription/changes
method call. The response to this call will contain an updated sessionState, that refers to a session object that contains the new VAPID key.¶
A race condition can occur when the server updates its VAPID key after the client has refreshed the session object but before calling the PushSubscription/set method. This situation causes the server to send a PushVerification object to a push resource URL that is now associated with an outdated VAPID key. Consequently, the push service will reject the PushVerification with a 403 (Forbidden) status code, as specified in [RFC8292].¶
To alleviate this problem, the client SHOULD check if the sessionState in the response from the PushSubscription/set method points to a session object with an applicationServerKey that matches their expectations. If there is a mismatch, the client SHOULD retry creating the PushSubscription. Additionally, the client MAY destroy the PushSubscription from the earlier, failed attempt.¶
The security considerations for JMAP ([RFC8620], especially Section 8.6 and Section 8.7 of that document), WebPush ([RFC8030]) and VAPID ([RFC8292]) apply to this document.¶