Skip to content

Commit 0e98ccd

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/decode-uri-component-0.2.2
2 parents 92c3d5b + ba48dd6 commit 0e98ccd

File tree

9 files changed

+136
-96
lines changed

9 files changed

+136
-96
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,41 @@
11
name: ci
22
on:
33
push:
4-
branches: [ master, release, alpha, beta ]
4+
branches:
5+
- master
56
pull_request:
6-
branches: [ '**' ]
7+
branches:
8+
- '**'
79
jobs:
810
test:
9-
runs-on: ubuntu-18.04
10-
timeout-minutes: 30
11+
strategy:
12+
matrix:
13+
include:
14+
- name: Node.js 14
15+
NODE_VERSION: 14
16+
- name: Node.js 16
17+
NODE_VERSION: 16
18+
- name: Node.js 18
19+
NODE_VERSION: 18
20+
- name: Node.js 20
21+
NODE_VERSION: 20
22+
fail-fast: false
23+
name: ${{ matrix.name }}
24+
timeout-minutes: 15
25+
runs-on: ubuntu-latest
1126
steps:
12-
- name: Checkout repository
13-
uses: actions/checkout@v2
14-
- name: Setup Node
15-
uses: actions/setup-node@v2
27+
- uses: actions/checkout@v2
28+
- name: Use Node.js ${{ matrix.NODE_VERSION }}
29+
uses: actions/setup-node@v1
1630
with:
17-
node-version: 14
31+
node-version: ${{ matrix.NODE_VERSION }}
1832
- name: Cache Node.js modules
1933
uses: actions/cache@v2
2034
with:
2135
path: ~/.npm
22-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
36+
key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
2337
restore-keys: |
24-
${{ runner.os }}-node-
38+
${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-
2539
- name: Install dependencies
2640
run: npm ci
2741
- name: Build package

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
## [4.2.1](https://github.com/parse-community/parse-server-push-adapter/compare/4.2.0...4.2.1) (2023-10-02)
2+
3+
4+
### Bug Fixes
5+
6+
* Upgrade @parse/node-apn from 5.2.1 to 5.2.3 ([#221](https://github.com/parse-community/parse-server-push-adapter/issues/221)) ([7aaab38](https://github.com/parse-community/parse-server-push-adapter/commit/7aaab38b8c97215ea9e63f87fc627450646c714e))
7+
8+
# [4.2.0](https://github.com/parse-community/parse-server-push-adapter/compare/4.1.3...4.2.0) (2023-08-06)
9+
10+
11+
### Features
12+
13+
* Upgrade @parse/node-apn from 5.1.3 to 5.2.1 ([#220](https://github.com/parse-community/parse-server-push-adapter/issues/220)) ([3b932d1](https://github.com/parse-community/parse-server-push-adapter/commit/3b932d1e40ddf81d38fcd7f3bbb71bbdcf848978))
14+
15+
## [4.1.3](https://github.com/parse-community/parse-server-push-adapter/compare/4.1.2...4.1.3) (2023-05-20)
16+
17+
18+
### Bug Fixes
19+
20+
* Validate push notification payload; fixes a security vulnerability in which the adapter can crash Parse Server due to an invalid push notification payload ([#217](https://github.com/parse-community/parse-server-push-adapter/issues/217)) ([598cb84](https://github.com/parse-community/parse-server-push-adapter/commit/598cb84d0866b7c5850ca96af920e8cb5ba243ec))
21+
122
## [4.1.2](https://github.com/parse-community/parse-server-push-adapter/compare/4.1.1...4.1.2) (2022-03-27)
223

324

README.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ The official Push Notification adapter for Parse Server. See [Parse Server Push
1919
- [Install Push Adapter](#install-push-adapter)
2020
- [Configure Parse Server](#configure-parse-server)
2121

22-
23-
2422
# Silent Notifications
2523

2624
If you have migrated from parse.com and you are seeing situations where silent (newsstand-like presentless) notifications are failing to deliver please ensure that your payload is setting the content-available attribute to Int(1) and not "1" This value will be explicitly checked.
@@ -44,30 +42,26 @@ This will produce a more verbose output for all the push sending attempts
4442
## Install Push Adapter
4543

4644
```
47-
npm install --save @parse/push-adapter@VERSION
45+
npm install --save @parse/push-adapter@<VERSION>
4846
```
4947

50-
Replace VERSION with the version you want to install.
48+
Replace `<VERSION>` with the version you want to install.
5149

5250
## Configure Parse Server
5351

5452
```js
5553
const PushAdapter = require('@parse/push-adapter').default;
56-
const pushOptions = {
57-
ios: { /* iOS push options */ } ,
58-
android: { /* android push options */ }
59-
}
60-
// starting 3.0.0
61-
const options = {
62-
appId: "****",
63-
masterKey: "****",
54+
const parseServerOptions = {
6455
push: {
65-
adapter: new PushAdapter(pushOptions),
56+
adapter: new PushAdapter({
57+
ios: {
58+
/* Apple push notification options */
59+
},
60+
android: {
61+
/* Android push options */
62+
}
63+
})
6664
},
67-
/* ... */
65+
/* Other Parse Server options */
6866
}
69-
70-
const server = new ParseServer(options);
71-
72-
/* continue with the initialization of parse-server */
7367
```

package-lock.json

Lines changed: 38 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@parse/push-adapter",
3-
"version": "4.1.2",
3+
"version": "4.2.1",
44
"description": "Base parse-server-push-adapter",
55
"main": "lib/index.js",
66
"files": [
@@ -40,7 +40,7 @@
4040
"semantic-release": "17.4.6"
4141
},
4242
"dependencies": {
43-
"@parse/node-apn": "5.1.3",
43+
"@parse/node-apn": "5.2.3",
4444
"@parse/node-gcm": "1.0.2",
4545
"npmlog": "4.1.2",
4646
"parse": "3.4.0"

spec/APNS.spec.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ describe('APNS', () => {
104104

105105
var prodApnsConnection = apns.providers[0];
106106
expect(prodApnsConnection.index).toBe(0);
107-
107+
108108
// TODO: Remove this checking onec we inject APNS
109109
var prodApnsOptions = prodApnsConnection.client.config;
110110
expect(prodApnsOptions.cert).toBe(args[1].cert);
@@ -239,7 +239,7 @@ describe('APNS', () => {
239239
expect(notification.pushType).toEqual('alert');
240240
done();
241241
});
242-
242+
243243
it('can generate APNS notification from raw data', (done) => {
244244
//Mock request data
245245
let data = {
@@ -259,17 +259,17 @@ describe('APNS', () => {
259259
let collapseId = "collapseIdentifier";
260260
let pushType = "background";
261261
let priority = 5;
262-
262+
263263
let notification = APNS._generateNotification(data, { expirationTime: expirationTime, collapseId: collapseId, pushType: pushType, priority: priority });
264-
264+
265265
expect(notification.expiry).toEqual(Math.round(expirationTime / 1000));
266266
expect(notification.collapseId).toEqual(collapseId);
267267
expect(notification.pushType).toEqual(pushType);
268268
expect(notification.priority).toEqual(priority);
269-
269+
270270
let stringifiedJSON = notification.compile();
271271
let jsonObject = JSON.parse(stringifiedJSON);
272-
272+
273273
expect(jsonObject.aps.alert).toEqual({ "loc-key" : "GAME_PLAY_REQUEST_FORMAT", "loc-args" : [ "Jenna", "Frank"] });
274274
expect(jsonObject.aps.badge).toEqual(100);
275275
expect(jsonObject.aps.sound).toEqual('test');
@@ -315,6 +315,20 @@ describe('APNS', () => {
315315
done();
316316
});
317317

318+
it('does log on invalid APNS notification', async () => {
319+
const args = {
320+
cert: new Buffer('testCert'),
321+
key: new Buffer('testKey'),
322+
production: true,
323+
topic: 'topic'
324+
};
325+
const log = require('npmlog');
326+
const spy = spyOn(log, 'warn');
327+
const apns = new APNS(args);
328+
apns.send();
329+
expect(spy).toHaveBeenCalled();
330+
});
331+
318332
it('can send APNS notification', (done) => {
319333
let args = {
320334
cert: new Buffer('testCert'),

0 commit comments

Comments
 (0)