aedes 0.51.0 → 0.51.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/dependabot.yml +11 -10
- package/.github/workflows/ci.yml +11 -11
- package/.github/workflows/{sast.yml → codeql.yml} +11 -5
- package/.github/workflows/labeler.yml +9 -4
- package/README.md +3 -5
- package/SECURITY.md +1 -1
- package/lib/client.js +7 -0
- package/lib/handlers/connect.js +0 -1
- package/package.json +20 -16
- package/test/will.js +23 -0
package/.github/dependabot.yml
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
version: 2
|
|
2
2
|
updates:
|
|
3
|
-
- package-ecosystem: github-actions
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
- package-ecosystem: github-actions
|
|
4
|
+
directory: /
|
|
5
|
+
schedule:
|
|
6
|
+
interval: daily
|
|
7
|
+
open-pull-requests-limit: 10
|
|
8
|
+
|
|
9
|
+
- package-ecosystem: npm
|
|
10
|
+
directory: /
|
|
11
|
+
schedule:
|
|
12
|
+
interval: daily
|
|
13
|
+
open-pull-requests-limit: 10
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: CI
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
@@ -10,33 +10,33 @@ on:
|
|
|
10
10
|
- 'docs/**'
|
|
11
11
|
- '*.md'
|
|
12
12
|
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
13
16
|
jobs:
|
|
14
17
|
dependency-review:
|
|
15
18
|
name: Dependency Review
|
|
16
19
|
if: github.event_name == 'pull_request'
|
|
17
20
|
runs-on: ubuntu-latest
|
|
18
|
-
permissions:
|
|
19
|
-
contents: read
|
|
20
21
|
steps:
|
|
21
|
-
- name:
|
|
22
|
-
uses: actions/checkout@
|
|
22
|
+
- name: Checkout repository
|
|
23
|
+
uses: actions/checkout@v4
|
|
23
24
|
with:
|
|
24
25
|
persist-credentials: false
|
|
25
26
|
|
|
26
27
|
- name: Dependency review
|
|
27
|
-
uses: actions/dependency-review-action@
|
|
28
|
+
uses: actions/dependency-review-action@v4
|
|
28
29
|
|
|
29
30
|
test:
|
|
30
31
|
runs-on: ${{ matrix.os }}
|
|
31
|
-
permissions:
|
|
32
|
-
contents: read
|
|
33
32
|
strategy:
|
|
34
33
|
matrix:
|
|
35
34
|
node-version: [16, 18, 20]
|
|
36
35
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
37
36
|
fail-fast: false
|
|
38
37
|
steps:
|
|
39
|
-
-
|
|
38
|
+
- name: Checkout repository
|
|
39
|
+
uses: actions/checkout@v4
|
|
40
40
|
with:
|
|
41
41
|
persist-credentials: false
|
|
42
42
|
|
|
@@ -45,6 +45,8 @@ jobs:
|
|
|
45
45
|
with:
|
|
46
46
|
node-version: ${{ matrix.node-version }}
|
|
47
47
|
check-latest: true
|
|
48
|
+
cache: npm
|
|
49
|
+
cache-dependency-path: package.json
|
|
48
50
|
|
|
49
51
|
- name: Install
|
|
50
52
|
run: |
|
|
@@ -68,8 +70,6 @@ jobs:
|
|
|
68
70
|
coverage:
|
|
69
71
|
needs: test
|
|
70
72
|
runs-on: ubuntu-latest
|
|
71
|
-
permissions:
|
|
72
|
-
contents: read
|
|
73
73
|
steps:
|
|
74
74
|
- name: Coveralls Finished
|
|
75
75
|
uses: coverallsapp/github-action@master
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: CodeQL
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
@@ -11,19 +11,25 @@ jobs:
|
|
|
11
11
|
name: Analyze
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
permissions:
|
|
14
|
+
actions: read
|
|
14
15
|
contents: read
|
|
15
16
|
security-events: write
|
|
16
17
|
strategy:
|
|
17
18
|
fail-fast: true
|
|
18
19
|
matrix:
|
|
19
|
-
language: [ 'javascript' ]
|
|
20
|
+
language: [ 'javascript-typescript' ]
|
|
20
21
|
steps:
|
|
21
|
-
-
|
|
22
|
+
- name: Checkout repository
|
|
23
|
+
uses: actions/checkout@v4
|
|
22
24
|
with:
|
|
23
25
|
persist-credentials: false
|
|
24
26
|
|
|
25
|
-
-
|
|
27
|
+
- name: Initialize CodeQL
|
|
28
|
+
uses: github/codeql-action/init@v3
|
|
26
29
|
with:
|
|
27
30
|
languages: ${{ matrix.language }}
|
|
28
31
|
|
|
29
|
-
-
|
|
32
|
+
- name: Perform CodeQL Analysis
|
|
33
|
+
uses: github/codeql-action/analyze@v3
|
|
34
|
+
with:
|
|
35
|
+
category: "/language:${{ matrix.language }}"
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Pull Request Labeler
|
|
2
|
+
|
|
2
3
|
on: pull_request_target
|
|
3
4
|
|
|
5
|
+
permissions:
|
|
6
|
+
contents: read
|
|
7
|
+
pull-requests: write
|
|
8
|
+
|
|
4
9
|
jobs:
|
|
5
10
|
label:
|
|
6
11
|
runs-on: ubuntu-latest
|
|
7
12
|
steps:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
- uses: actions/labeler@v5
|
|
14
|
+
with:
|
|
15
|
+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
package/README.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
<!-- markdownlint-disable MD013
|
|
1
|
+
<!-- markdownlint-disable MD013 -->
|
|
2
2
|
# Aedes
|
|
3
3
|
|
|
4
4
|

|
|
5
|
-
[](
|
|
5
|
+
[](https://standardjs.com/)
|
|
6
6
|
[](https://github.com/moscajs/aedes/graphs/commit-activity)
|
|
7
7
|
[](https://github.com/moscajs/aedes/pulls)\
|
|
8
|
-
[](https://lgtm.com/projects/g/moscajs/aedes/alerts/)
|
|
9
|
-
[](https://lgtm.com/projects/g/moscajs/aedes/context:javascript)
|
|
10
8
|
[](https://coveralls.io/github/moscajs/aedes?branch=main)
|
|
11
9
|
[](https://snyk.io/test/github/moscajs/aedes)\
|
|
12
10
|

|
|
@@ -283,7 +281,7 @@ Want to contribute? Check our list of
|
|
|
283
281
|
|
|
284
282
|
## Security notice
|
|
285
283
|
|
|
286
|
-
Messages sent to the broker are considered _valid_ once they pass the [`authorizePublish`](
|
|
284
|
+
Messages sent to the broker are considered _valid_ once they pass the [`authorizePublish`](./docs/Aedes.md#handler-authorizepublish-client-packet-callback) callback.
|
|
287
285
|
In other terms, if permissions for the given client are revoked after the call completes, the message is still considered valid.
|
|
288
286
|
In case you are sending time-sensitive messages, make sure to use QoS 0 or connect with a clean session.
|
|
289
287
|
|
package/SECURITY.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -313,7 +313,14 @@ Client.prototype.close = function (done) {
|
|
|
313
313
|
}, noop)
|
|
314
314
|
}
|
|
315
315
|
})
|
|
316
|
+
} else if (will) {
|
|
317
|
+
// delete the persisted will even on clean disconnect https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349232
|
|
318
|
+
that.broker.persistence.delWill({
|
|
319
|
+
id: that.id,
|
|
320
|
+
brokerId: that.broker.id
|
|
321
|
+
}, noop)
|
|
316
322
|
}
|
|
323
|
+
|
|
317
324
|
that.will = null // this function might be called twice
|
|
318
325
|
that._will = null
|
|
319
326
|
|
package/lib/handlers/connect.js
CHANGED
|
@@ -74,7 +74,6 @@ function init (client, packet, done) {
|
|
|
74
74
|
if (returnCode > 0) {
|
|
75
75
|
const error = new Error(errorMessages[returnCode])
|
|
76
76
|
error.errorCode = returnCode
|
|
77
|
-
console.error(error)
|
|
78
77
|
doConnack(
|
|
79
78
|
{ client, returnCode, sessionPresent: false },
|
|
80
79
|
done.bind(this, error))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aedes",
|
|
3
|
-
"version": "0.51.
|
|
3
|
+
"version": "0.51.2",
|
|
4
4
|
"description": "Stream-based MQTT broker",
|
|
5
5
|
"main": "aedes.js",
|
|
6
6
|
"types": "aedes.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"test:typescript": "tsd",
|
|
17
17
|
"unit": "tap -J test/*.js",
|
|
18
18
|
"unit:report": "tap -J test/*.js --cov --coverage-report=html --coverage-report=cobertura | tee out.tap",
|
|
19
|
-
"license-checker": "license-checker --production --onlyAllow=\"MIT;ISC;BSD-3-Clause;BSD-2-Clause\"",
|
|
19
|
+
"license-checker": "license-checker --production --onlyAllow=\"MIT;ISC;BSD-3-Clause;BSD-2-Clause;0BSD\"",
|
|
20
20
|
"release": "read -p 'GITHUB_TOKEN: ' GITHUB_TOKEN && export GITHUB_TOKEN=$GITHUB_TOKEN && release-it --disable-metrics"
|
|
21
21
|
},
|
|
22
22
|
"release-it": {
|
|
@@ -89,6 +89,10 @@
|
|
|
89
89
|
}
|
|
90
90
|
],
|
|
91
91
|
"license": "MIT",
|
|
92
|
+
"funding": {
|
|
93
|
+
"type": "opencollective",
|
|
94
|
+
"url": "https://opencollective.com/aedes"
|
|
95
|
+
},
|
|
92
96
|
"bugs": {
|
|
93
97
|
"url": "https://github.com/moscajs/aedes/issues"
|
|
94
98
|
},
|
|
@@ -97,24 +101,24 @@
|
|
|
97
101
|
"node": ">=16"
|
|
98
102
|
},
|
|
99
103
|
"devDependencies": {
|
|
100
|
-
"@sinonjs/fake-timers": "^
|
|
101
|
-
"@types/node": "^20.
|
|
102
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
103
|
-
"@typescript-eslint/parser": "^
|
|
104
|
+
"@sinonjs/fake-timers": "^11.2.2",
|
|
105
|
+
"@types/node": "^20.11.17",
|
|
106
|
+
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
107
|
+
"@typescript-eslint/parser": "^7.0.1",
|
|
104
108
|
"concat-stream": "^2.0.0",
|
|
105
109
|
"duplexify": "^4.1.2",
|
|
106
110
|
"license-checker": "^25.0.1",
|
|
107
|
-
"markdownlint-cli": "^0.
|
|
108
|
-
"mqtt": "^5.
|
|
111
|
+
"markdownlint-cli": "^0.41.0",
|
|
112
|
+
"mqtt": "^5.3.5",
|
|
109
113
|
"mqtt-connection": "^4.1.0",
|
|
110
114
|
"pre-commit": "^1.2.2",
|
|
111
115
|
"proxyquire": "^2.1.3",
|
|
112
|
-
"release-it": "^
|
|
116
|
+
"release-it": "^17.0.5",
|
|
113
117
|
"snazzy": "^9.0.0",
|
|
114
118
|
"standard": "^17.1.0",
|
|
115
|
-
"tap": "^16.3.
|
|
116
|
-
"tsd": "^0.
|
|
117
|
-
"typescript": "^5.
|
|
119
|
+
"tap": "^16.3.10",
|
|
120
|
+
"tsd": "^0.31.0",
|
|
121
|
+
"typescript": "^5.3.3",
|
|
118
122
|
"websocket-stream": "^5.5.2"
|
|
119
123
|
},
|
|
120
124
|
"dependencies": {
|
|
@@ -124,11 +128,11 @@
|
|
|
124
128
|
"fastfall": "^1.5.1",
|
|
125
129
|
"fastparallel": "^2.4.1",
|
|
126
130
|
"fastseries": "^2.0.0",
|
|
127
|
-
"hyperid": "^3.
|
|
128
|
-
"mqemitter": "^
|
|
131
|
+
"hyperid": "^3.2.0",
|
|
132
|
+
"mqemitter": "^6.0.0",
|
|
129
133
|
"mqtt-packet": "^9.0.0",
|
|
130
|
-
"retimer": "^
|
|
134
|
+
"retimer": "^4.0.0",
|
|
131
135
|
"reusify": "^1.0.4",
|
|
132
|
-
"uuid": "^9.0.
|
|
136
|
+
"uuid": "^9.0.1"
|
|
133
137
|
}
|
|
134
138
|
}
|
package/test/will.js
CHANGED
|
@@ -420,6 +420,29 @@ test('does not deliver will when client sends a DISCONNECT', function (t) {
|
|
|
420
420
|
})
|
|
421
421
|
})
|
|
422
422
|
|
|
423
|
+
test('deletes from persistence on DISCONNECT', function (t) {
|
|
424
|
+
t.plan(2)
|
|
425
|
+
|
|
426
|
+
const opts = {
|
|
427
|
+
clientId: 'abcde'
|
|
428
|
+
}
|
|
429
|
+
const broker = aedes()
|
|
430
|
+
t.teardown(broker.close.bind(broker))
|
|
431
|
+
|
|
432
|
+
const s = noError(willConnect(setup(broker), opts, function () {
|
|
433
|
+
s.inStream.end({
|
|
434
|
+
cmd: 'disconnect'
|
|
435
|
+
})
|
|
436
|
+
}), t)
|
|
437
|
+
|
|
438
|
+
s.broker.persistence.getWill({
|
|
439
|
+
id: opts.clientId
|
|
440
|
+
}, function (err, packet) {
|
|
441
|
+
t.error(err, 'no error')
|
|
442
|
+
t.notOk(packet)
|
|
443
|
+
})
|
|
444
|
+
})
|
|
445
|
+
|
|
423
446
|
test('does not store multiple will with same clientid', function (t) {
|
|
424
447
|
t.plan(4)
|
|
425
448
|
|