PushSubscription.toJSON encodes base64 values with padding
Reported by
alexen...@gmail.com,
Jan 12 2018
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.85 Safari/537.36 Steps to reproduce the problem: 1. Create a PushSubscription 2. call .toJSON or JSON.stringify What is the expected behavior? The values in keys should be encoded using URL safe base64 without padding https://www.w3.org/TR/push-api/#dom-pushsubscription-tojson What went wrong? Instead the values are encoded with padding Did this work before? N/A Does this work in other browsers? Yes Chrome version: 64.0.3282.85 Channel: beta OS Version: 10.0 Flash Version: Shockwave Flash 28.0 r0
,
Jan 16 2018
Thanks for filing the issue! @Reporter: Could you please share a sample test file along with that it would be highly helpful if shared(if possible) a screenshot/screen cast which describes the issue. Any further inputs from your end helps us to triage the issue in a better way.
,
Jan 16 2018
Sure, where service-worker.js is a file that exists, the following shows the issue. The output is
{
"endpoint": "https://fcm.googleapis.com/fcm/send/...",
"expirationTime": null,
"keys": {
"p256dh": "BMwK00IJzqXYPCl7uZ7rDBR4GAahb9Z2JLMFEIJiHAlP_ree56DUV1-vTI1B2QC7gtILXm7ge-2EaThn702DGAc=",
"auth": "G79lArMieJtphmTraMEcfA=="
}
}
expected
{
"endpoint": "https://fcm.googleapis.com/fcm/send/...",
"expirationTime": null,
"keys": {
"p256dh": "BMwK00IJzqXYPCl7uZ7rDBR4GAahb9Z2JLMFEIJiHAlP_ree56DUV1-vTI1B2QC7gtILXm7ge-2EaThn702DGAc",
"auth": "G79lArMieJtphmTraMEcfA"
}
}
,
Jan 16 2018
Thank you for providing more feedback. Adding requester "vamshi.kommuri@techmahindra.com" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 16 2018
Thank you for the report, this is a bug indeed! I've uploaded a change for review that should be included with Chrome 65. https://chromium-review.googlesource.com/c/chromium/src/+/868295
,
Jan 29 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1be5b5e3d1866879e4d49e2ab34d4a89e3e2657a commit 1be5b5e3d1866879e4d49e2ab34d4a89e3e2657a Author: Peter Beverloo <peter@chromium.org> Date: Mon Jan 29 17:36:17 2018 Strip padding from the JSON encoded PushSubscription data The serialization contains the p256dh and auth values of the push subscription encoded per base64url. Normally it's valid to keep the trailing equal-sign padding, but the Push API specifically forbids this. Bug: 801555 Change-Id: I370f01b6aa398ccd407502c967391ea573352381 Reviewed-on: https://chromium-review.googlesource.com/868295 Commit-Queue: Peter Beverloo <peter@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Cr-Commit-Position: refs/heads/master@{#532474} [modify] https://crrev.com/1be5b5e3d1866879e4d49e2ab34d4a89e3e2657a/third_party/WebKit/LayoutTests/http/tests/push_messaging/push-subscription-stringification.html [modify] https://crrev.com/1be5b5e3d1866879e4d49e2ab34d4a89e3e2657a/third_party/WebKit/Source/modules/BUILD.gn [modify] https://crrev.com/1be5b5e3d1866879e4d49e2ab34d4a89e3e2657a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp [modify] https://crrev.com/1be5b5e3d1866879e4d49e2ab34d4a89e3e2657a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h [add] https://crrev.com/1be5b5e3d1866879e4d49e2ab34d4a89e3e2657a/third_party/WebKit/Source/modules/push_messaging/PushSubscriptionTest.cpp |
||||
►
Sign in to add a comment |
||||
Comment 1 by krajshree@chromium.org
, Jan 16 2018