Network Working Group | M. Thomson |
Internet-Draft | Mozilla |
Intended status: Standards Track | P. Beverloo |
Expires: March 8, 2018 | |
September 04, 2017 |
Voluntary Application Server Identification (VAPID) for Web Push
draft-ietf-webpush-vapid-04
An application server can use the method described to voluntarily identify itself to a push service. The “vapid” authentication scheme allows a client to include its an identity in a signed token with requests that it makes. The signature can be used by the push service to attribute requests that are made by the same application server to a single entity. The identification information can allow the operator of a push service to contact the operator of the application server. The signature can be used to restrict the use of a push subscription to a single application server.
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 http://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 March 8, 2018.
Copyright (c) 2017 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 (http://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 Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
The Web Push protocol [RFC8030] describes how an application server is able to request that a push service deliver a push message to a user agent.
As a consequence of the expected deployment architecture, there is no basis for an application server to be known to a push service prior to requesting delivery of a push message. Requiring that the push service be able to authenticate application servers places an unwanted constraint on the interactions between user agents and application servers, who are the ultimate users of a push service. That constraint would also degrade the privacy-preserving properties the protocol provides. For these reasons, [RFC8030] does not define a mandatory system for authentication of application servers.
An unfortunate consequence of the design of [RFC8030] is that a push service is exposed to a greater risk of denial of service attack. While requests from application servers can be indirectly attributed to user agents, this is not always efficient or even sufficient. Providing more information about the application server directly to a push service allows the push service to better distinguish between legitimate and bogus requests.
Additionally, the design of RFC 8030 relies on maintaining the secrecy of push subscription URIs. Any application server in possession of this URI is able to send messages to the user agent. If use of a subscription could be limited to a single application server, this would reduce the impact of the push subscription URI being learned by an unauthorized party.
This document describes a system whereby an application server can volunteer information about itself to a push service. At a minimum, this provides a stable identity for the application server, though this could also include contact information, such as an email address.
A consistent identity can be used by a push service to establish behavioral expectations for an application server. Significant deviations from an established norm can then be used to trigger exception handling procedures.
Voluntarily-provided contact information can be used to contact an application server operator in the case of exceptional situations.
Experience with push service deployment has shown that software errors or unusual circumstances can cause large increases in push message volume. Contacting the operator of the application server has proven to be valuable.
Even in the absence of usable contact information, an application server that has a well-established reputation might be given preference over an unidentified application server when choosing whether to discard a push message.
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.
The terms “push message”, “push service”, “push subscription”, “application server”, and “user agent” are used as defined in [RFC8030].
Application servers that wish to self-identify generate and maintain a signing key pair. This key pair MUST be usable with elliptic curve digital signature (ECDSA) over the P-256 curve [FIPS186]. Use of this key when sending push messages establishes an identity for the application server that is consistent across multiple messages.
When requesting delivery of a push message, the application includes a JSON Web Token (JWT) [RFC7519], signed using its signing key. The token includes a number of claims as follows:
This JWT is included in an Authorization header field, using an auth-scheme of “vapid”. A push service MAY reject a request with a 403 (Forbidden) status code [RFC7235] if the JWT signature or its claims are invalid. A push service MUST NOT use information from an invalid token.
The JWT MUST use a JSON Web Signature (JWS) [RFC7515]. The signature MUST use ECDSA on the NIST P-256 curve [FIPS186] which is identified as “ES256” [RFC7518].
If the application server wishes to provide contact details it MAY include a “sub” (Subject) claim in the JWT. The “sub” claim SHOULD include a contact URI for the application server as either a “mailto:” (email) [RFC6068] or an “https:” [RFC2818] URI.
An application server MAY include additional claims using public or private names (see Sections 4.2 and 4.3 of [RFC7519]). Since the JWT is in a header field, the size of additional claims SHOULD be kept as small as possible.
The “vapid” HTTP authentication scheme (Section 3) is used to identify the specific profile of JWT defined in this document. A different authentication scheme is needed to update the signature algorithm or other parameters. This ensures that existing mechanisms for negotiating authentication scheme can be used rather than defining new parameter negotiation mechanisms.
An application server requests the delivery of a push message as described in [RFC8030]. If the application server wishes to self-identify, it includes an Authorization header field with credentials that use the “vapid” authentication scheme.
POST /p/JzLQ3raZJfFBR0aqvOMsLrt54w4rJUsV HTTP/1.1 Host: push.example.net TTL: 30 Content-Length: 136 Content-Encoding: aes128gcm Authorization: vapid t=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiJodHRwczovL3 B1c2guZXhhbXBsZS5uZXQiLCJleHAiOjE0NTM1MjM3NjgsInN1YiI6Im1ha Wx0bzpwdXNoQGV4YW1wbGUuY29tIn0.i3CYb7t4xfxCDquptFOepC9GAu_H LGkMlMuCGSK2rpiUfnK9ojFwDXb1JrErtmysazNjjvW2L9OkSSHzvoD1oA, k=BA1Hxzyi1RUM1b5wjxsn7nGxAszw2u61m164i3MrAIxHF6YK5h4SDYic-dR uU_RCPCfA5aq9ojSwk5Y2EmClBPs { encrypted push message }
Figure 1: Requesting Push Message Delivery with JWT
Note that the example header fields in this document include extra line wrapping to meet formatting constraints.
The t parameter of the Authorization header field contains a JWT; the k parameter includes the base64url-encoded key that signed that token. The JWT input values and the JWK [RFC7517] corresponding to the signing key are shown in Figure 2 with additional whitespace added for readability purposes. This JWT would be valid until 2016-01-23T04:36:08Z [RFC3339].
JWT header = { "typ": "JWT", "alg": "ES256" } JWT body = { "aud": "https://push.example.net", "exp": 1453523768, "sub": "mailto:push@example.com" } JWK = { "crv":"P-256", "kty":"EC", "x":"DUfHPKLVFQzVvnCPGyfucbECzPDa7rWbXriLcysAjEc", "y":"F6YK5h4SDYic-dRuU_RCPCfA5aq9ojSwk5Y2EmClBPs" }
Figure 2: Decoded Example Values
A new “vapid” HTTP authentication scheme [RFC7235] is defined. This authentication scheme carries a signed JWT, as described in Section 2, plus the key that signed that JWT.
This authentication scheme is for origin-server authentication only. Therefore, this authentication scheme MUST NOT be used with the Proxy-Authenticate or Proxy-Authorization header fields.
The challenge for the “vapid” authentication scheme contains only the auth-scheme production. No parameters are currently defined.
Two parameters are defined for this authentication scheme: t and k. All unknown or unsupported parameters to “vapid” authentication credentials MUST be ignored. The realm parameter is ignored for this authentication scheme.
This authentication scheme is intended for use by an application server when using the Web Push protocol [RFC8030].
The t parameter of the “vapid” authentication scheme carries a JWT as described in Section 2.
In order for the push service to be able to validate the JWT, it needs to learn the public key of the application server. A k parameter is defined for the “vapid” authentication scheme to carry this information.
The k parameter includes an elliptic curve digital signature algorithm (ECDSA) public key [FIPS186] in uncompressed form [X9.62] that is encoded using base64url encoding [RFC7515].
Some elliptic curve implementations permit the same P-256 key to be used for signing and key exchange. An application server MUST select a different private key for the key exchange [WEBPUSH-ENCRYPTION] and signing the authentication token. Though a push service is not obligated to check either parameter for every push message, a push service SHOULD reject push messages that have identical values for these parameters with a 400 (Bad Request) status code.
The public key of the application server serves as a stable identifier for the server. This key can be used to restrict a push subscription to a specific application server.
Subscription restriction reduces the reliance on endpoint secrecy by requiring that an application server provide a signed token when requesting delivery of a push message. This provides an additional level of protection against leaking of the details of the push subscription.
A user agent that wishes to create a restricted subscription includes the public key of the application server when requesting the creation of a push subscription. This restricts use of the resulting subscription to application servers that are able to provide a valid JWT signed by the corresponding private key.
The user agent then adds the public key to the request to create a push subscription. The push subscription request is extended to include a body. The body of the request is a JSON object as described in [RFC7159]. The user agent adds a “vapid” member to this JSON object that contains a public key on the P-256 curve, encoded in the uncompressed form [X9.62] and base64url encoded [RFC7515]. The media type of the body is set to “application/webpush-options+json” (see Section 6.3 for registration of this media type).
A push service MUST ignore the body of a request that uses a different media type. For the “application/webpush-options+json” media type, a push service MUST ignore any members on this object that it does not understand.
The example in Figure 3 shows a restriction to the key used in Figure 1. Extra whitespace is added to meet formatting constraints.
POST /subscribe/ HTTP/1.1 Host: push.example.net Content-Type: application/webpush-options+json Content-Length: 104 { "vapid": "BA1Hxzyi1RUM1b5wjxsn7nGxAszw2u61m164i3MrAIxH F6YK5h4SDYic-dRuU_RCPCfA5aq9ojSwk5Y2EmClBPs" }
Figure 3: Example Subscribe Request
An application might use the Web Push API [API] to provide the user agent with a public key.
When a push subscription has been restricted to an application server, the request for push message delivery MUST include a JWT signed by the private key that corresponds to the public key used when creating the subscription.
A push service MUST reject a message sent to a restricted push subscription if that message includes no “vapid” authentication or invalid “vapid” authentication. A 401 (Unauthorized) status code might be used if the authentication is absent; a 403 (Forbidden) status code might be used if authentication is invalid.
“vapid” authentication is invalid if:
A push service MUST NOT forward the JWT or public key to the user agent when delivering the push message.
An application server that needs to replace its signing key needs to request the creation of a new subscription by the user agent that is restricted to the updated key. Application servers need to remember the key that was used when requesting the creation of a subscription.
This authentication scheme is vulnerable to replay attacks if an attacker can acquire a valid JWT. Sending requests using HTTPS as required by [RFC8030] provides confidentiality. Additionally, applying narrow limits to the period over which a replayable token can be reused limits the potential value of a stolen token to an attacker and can increase the difficulty of stealing a token.
An application server might offer falsified contact information. The application server asserts its email address or contact URI without any evidence to support the claim. A push service operator cannot use the presence of unvalidated contact information as input to any security-critical decision-making process.
Validation of a signature on the JWT requires a non-trivial amount of computation. For something that might be used to identify legitimate requests under denial of service attack conditions, this is not ideal. Application servers are therefore encouraged to reuse tokens, which permits the push service to cache the results of signature validation.
An application server that changes its signing key breaks linkability between push messages that it sends under the different keys. A push service that relies on a consistent identity for application servers might categorize requests made with new keys differently. Gradual migration to a new signing key reduces the chances that requests that use the new key will be categorized as abusive.
This document registers a new authentication scheme, a registry for parameters of that scheme, and media type for push options.
This document registers the “vapid” authentication scheme in the “Hypertext Transfer Protocol (HTTP) Authentication Scheme Registry” established in [RFC7235].
This document creates a “Vapid Authentication Scheme Parameters” registry for parameters to the “vapid” authentication scheme. These parameters are defined for use in requests (in the Authorization header field) and for challenges (in the WWW-Authenticate header field). This registry is under the “WebPush Parameters” grouping. The registry operates on the “Specification Required” policy [RFC5226].
Registrations MUST include the following information:
This registry initially contains the following entries:
Parameter Name | Purpose | Header Fields | Specification |
---|---|---|---|
t | JWT authentication token | Authorization | [[RFC-to-be]], Section 3.1 |
k | signing key | Authorization | [[RFC-to-be]], Section 3.2 |
This document registers the “application/webpush-options+json” media type in the “Media Types” registry following the process described in [RFC6838].
[[RFC editor: please replace instances of RFCXXXX in this section with a reference to the published RFC.]]
This document would have been much worse than it is if not for the contributions of Benjamin Bangert, JR Conlin, Chris Karlof, Costin Manolache, Adam Roach, and others.
[API] | Beverloo, P., Thomson, M., van Ouwerkerk, M., Sullivan, B. and E. Fullea, "Push API", May 2017. |
[RFC3339] | Klyne, G. and C. Newman, "Date and Time on the Internet: Timestamps", RFC 3339, DOI 10.17487/RFC3339, July 2002. |
[RFC7517] | Jones, M., "JSON Web Key (JWK)", RFC 7517, DOI 10.17487/RFC7517, May 2015. |