@mojaloop/central-services-shared 18.35.5 → 18.35.7
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/.grype.yaml +39 -0
- package/.nvmrc +1 -1
- package/CHANGELOG.md +14 -0
- package/audit-ci.jsonc +14 -1
- package/package.json +28 -23
- package/src/util/hapi/plugins/headerValidation.js +4 -3
- package/test/unit/util/hapi/plugins/headerValidation.test.js +21 -6
- package/test/unit/util/request.test.js +6 -37
package/.grype.yaml
CHANGED
|
@@ -7,6 +7,45 @@ ignore:
|
|
|
7
7
|
- vulnerability: GHSA-3ppc-4f35-3m26
|
|
8
8
|
include-aliases: true
|
|
9
9
|
reason: "Unfixable npm transitive vulnerability: minimatch ReDoS - fix requires v10 major version break as of 2026-02-19"
|
|
10
|
+
- vulnerability: GHSA-2w6w-674q-4c4q
|
|
11
|
+
include-aliases: true
|
|
12
|
+
reason: "Unfixable npm transitive vulnerability: handlebars (critical severity) as of 2026-04-07"
|
|
13
|
+
- vulnerability: GHSA-xjpj-3mr7-gcpf
|
|
14
|
+
include-aliases: true
|
|
15
|
+
reason: "Unfixable npm transitive vulnerability: handlebars (high severity) as of 2026-04-07"
|
|
16
|
+
- vulnerability: GHSA-3mfm-83xf-c92r
|
|
17
|
+
include-aliases: true
|
|
18
|
+
reason: "Unfixable npm transitive vulnerability: handlebars (high severity) as of 2026-04-07"
|
|
19
|
+
- vulnerability: GHSA-xhpv-hc6g-r9c6
|
|
20
|
+
include-aliases: true
|
|
21
|
+
reason: "Unfixable npm transitive vulnerability: handlebars (high severity) as of 2026-04-07"
|
|
22
|
+
- vulnerability: GHSA-25h7-pfq9-p65f
|
|
23
|
+
include-aliases: true
|
|
24
|
+
reason: "Unfixable npm transitive vulnerability: flatted (high severity) as of 2026-04-07"
|
|
25
|
+
- vulnerability: GHSA-9cx6-37pm-9jff
|
|
26
|
+
include-aliases: true
|
|
27
|
+
reason: "Unfixable npm transitive vulnerability: handlebars (high severity) as of 2026-04-07"
|
|
28
|
+
- vulnerability: GHSA-rf6f-7fwh-wjgh
|
|
29
|
+
include-aliases: true
|
|
30
|
+
reason: "Unfixable npm transitive vulnerability: flatted (high severity) as of 2026-04-07"
|
|
31
|
+
- vulnerability: GHSA-7rx3-28cr-v5wh
|
|
32
|
+
include-aliases: true
|
|
33
|
+
reason: "Unfixable npm transitive vulnerability: handlebars (moderate severity) as of 2026-04-07"
|
|
34
|
+
- vulnerability: GHSA-2qvq-rjwj-gvw9
|
|
35
|
+
include-aliases: true
|
|
36
|
+
reason: "Unfixable npm transitive vulnerability: handlebars (moderate severity) as of 2026-04-07"
|
|
37
|
+
- vulnerability: GHSA-442j-39wm-28r2
|
|
38
|
+
include-aliases: true
|
|
39
|
+
reason: "Unfixable npm transitive vulnerability: handlebars (low severity) as of 2026-04-07"
|
|
40
|
+
- vulnerability: GHSA-44fc-8fm5-q62h
|
|
41
|
+
include-aliases: true
|
|
42
|
+
reason: "Unfixable npm transitive vulnerability: unknown (unknown severity) as of 2026-04-07"
|
|
43
|
+
- vulnerability: GHSA-hf2r-9gf9-rwch
|
|
44
|
+
include-aliases: true
|
|
45
|
+
reason: "Unfixable npm transitive vulnerability: unknown (unknown severity) as of 2026-04-07"
|
|
46
|
+
- vulnerability: GHSA-48c2-rrv3-qjmp
|
|
47
|
+
include-aliases: true
|
|
48
|
+
reason: "Unfixable npm transitive vulnerability: unknown (unknown severity) as of 2026-04-07"
|
|
10
49
|
output:
|
|
11
50
|
- table
|
|
12
51
|
- json
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
22.22.
|
|
1
|
+
22.22.2
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [18.35.7](https://github.com/mojaloop/central-services-shared/compare/v18.35.6...v18.35.7) (2026-04-07)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* require Accept header for initiating methods per FSPIOP spec ([#516](https://github.com/mojaloop/central-services-shared/issues/516)) ([4d29c23](https://github.com/mojaloop/central-services-shared/commit/4d29c23464ceaf31961991fa82d6ac986d47e4d4)), closes [mojaloop/project#4183](https://github.com/mojaloop/project/issues/4183)
|
|
11
|
+
|
|
12
|
+
### [18.35.6](https://github.com/mojaloop/central-services-shared/compare/v18.35.5...v18.35.6) (2026-02-26)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Chore
|
|
16
|
+
|
|
17
|
+
* rm circular dependency on sdk-standard-components ([#510](https://github.com/mojaloop/central-services-shared/issues/510)) ([7346920](https://github.com/mojaloop/central-services-shared/commit/7346920e3c3e0996aeebfd7cce4e24ac54d59313))
|
|
18
|
+
|
|
5
19
|
### [18.35.5](https://github.com/mojaloop/central-services-shared/compare/v18.35.4...v18.35.5) (2026-02-20)
|
|
6
20
|
|
|
7
21
|
|
package/audit-ci.jsonc
CHANGED
|
@@ -5,6 +5,19 @@
|
|
|
5
5
|
"moderate": true,
|
|
6
6
|
"allowlist": [ // NOTE: Please add as much information as possible to any items added to the allowList
|
|
7
7
|
"GHSA-2g4f-4pwh-qvx6",
|
|
8
|
-
"GHSA-3ppc-4f35-3m26"
|
|
8
|
+
"GHSA-3ppc-4f35-3m26",
|
|
9
|
+
"GHSA-2w6w-674q-4c4q",
|
|
10
|
+
"GHSA-xjpj-3mr7-gcpf",
|
|
11
|
+
"GHSA-3mfm-83xf-c92r",
|
|
12
|
+
"GHSA-xhpv-hc6g-r9c6",
|
|
13
|
+
"GHSA-25h7-pfq9-p65f",
|
|
14
|
+
"GHSA-9cx6-37pm-9jff",
|
|
15
|
+
"GHSA-rf6f-7fwh-wjgh",
|
|
16
|
+
"GHSA-7rx3-28cr-v5wh",
|
|
17
|
+
"GHSA-2qvq-rjwj-gvw9",
|
|
18
|
+
"GHSA-442j-39wm-28r2",
|
|
19
|
+
"GHSA-44fc-8fm5-q62h",
|
|
20
|
+
"GHSA-hf2r-9gf9-rwch",
|
|
21
|
+
"GHSA-48c2-rrv3-qjmp"
|
|
9
22
|
]
|
|
10
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/central-services-shared",
|
|
3
|
-
"version": "18.35.
|
|
3
|
+
"version": "18.35.7",
|
|
4
4
|
"description": "Shared code for mojaloop central services",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "ModusBox",
|
|
@@ -67,25 +67,25 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@hapi/catbox": "12.1.1",
|
|
69
69
|
"@hapi/catbox-memory": "5.0.1",
|
|
70
|
-
"@hapi/hapi": "21.4.
|
|
70
|
+
"@hapi/hapi": "21.4.8",
|
|
71
71
|
"@hapi/joi-date": "2.0.1",
|
|
72
|
-
"@mojaloop/inter-scheme-proxy-cache-lib": "2.
|
|
73
|
-
"@opentelemetry/api": "1.9.
|
|
72
|
+
"@mojaloop/inter-scheme-proxy-cache-lib": "2.10.0",
|
|
73
|
+
"@opentelemetry/api": "1.9.1",
|
|
74
74
|
"async-exit-hook": "2.0.1",
|
|
75
75
|
"async-retry": "1.3.3",
|
|
76
|
-
"axios": "1.
|
|
76
|
+
"axios": "1.14.0",
|
|
77
77
|
"clone": "2.1.2",
|
|
78
|
-
"convict": "
|
|
79
|
-
"dotenv": "17.
|
|
78
|
+
"convict": "6.2.5",
|
|
79
|
+
"dotenv": "17.4.1",
|
|
80
80
|
"env-var": "7.5.0",
|
|
81
81
|
"event-stream": "4.0.1",
|
|
82
82
|
"fast-safe-stringify": "2.1.1",
|
|
83
|
-
"immutable": "5.1.
|
|
83
|
+
"immutable": "5.1.5",
|
|
84
84
|
"ioredis": "5.6.1",
|
|
85
|
-
"joi": "18.
|
|
86
|
-
"lodash": "4.
|
|
85
|
+
"joi": "18.1.2",
|
|
86
|
+
"lodash": "4.18.1",
|
|
87
87
|
"mustache": "4.2.0",
|
|
88
|
-
"openapi-backend": "5.
|
|
88
|
+
"openapi-backend": "5.16.1",
|
|
89
89
|
"raw-body": "3.0.2",
|
|
90
90
|
"rc": "1.2.8",
|
|
91
91
|
"redlock": "5.0.0-beta.2",
|
|
@@ -93,15 +93,14 @@
|
|
|
93
93
|
"ulidx": "2.4.1",
|
|
94
94
|
"uuid4": "2.0.3",
|
|
95
95
|
"widdershins": "4.0.1",
|
|
96
|
-
"yaml": "2.8.
|
|
96
|
+
"yaml": "2.8.3"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@mojaloop/central-services-error-handling": "13.1.6",
|
|
100
100
|
"@mojaloop/central-services-logger": "11.10.4",
|
|
101
101
|
"@mojaloop/central-services-metrics": "12.8.5",
|
|
102
102
|
"@mojaloop/event-sdk": "14.8.3",
|
|
103
|
-
"@
|
|
104
|
-
"@opentelemetry/auto-instrumentations-node": "^0.70.0",
|
|
103
|
+
"@opentelemetry/auto-instrumentations-node": "^0.72.0",
|
|
105
104
|
"@types/hapi__joi": "17.1.15",
|
|
106
105
|
"ajv": "8.18.0",
|
|
107
106
|
"ajv-formats": "^3.0.1",
|
|
@@ -109,14 +108,14 @@
|
|
|
109
108
|
"audit-ci": "7.1.0",
|
|
110
109
|
"base64url": "3.0.1",
|
|
111
110
|
"chance": "1.1.13",
|
|
112
|
-
"npm-check-updates": "
|
|
113
|
-
"nyc": "
|
|
111
|
+
"npm-check-updates": "20.0.0",
|
|
112
|
+
"nyc": "18.0.0",
|
|
114
113
|
"portfinder": "1.0.38",
|
|
115
114
|
"pre-commit": "1.2.2",
|
|
116
115
|
"proxyquire": "2.1.3",
|
|
117
116
|
"replace": "1.2.2",
|
|
118
117
|
"rewire": "9.0.1",
|
|
119
|
-
"sinon": "21.0.
|
|
118
|
+
"sinon": "21.0.3",
|
|
120
119
|
"standard": "17.1.2",
|
|
121
120
|
"standard-version": "9.5.0",
|
|
122
121
|
"tap-spec": "5.0.0",
|
|
@@ -125,9 +124,9 @@
|
|
|
125
124
|
"tapes": "4.1.0"
|
|
126
125
|
},
|
|
127
126
|
"overrides": {
|
|
128
|
-
"axios": "1.
|
|
127
|
+
"axios": "1.14.0",
|
|
129
128
|
"qs": "6.14.2",
|
|
130
|
-
"brace-expansion": "
|
|
129
|
+
"brace-expansion": "1.1.13",
|
|
131
130
|
"form-data": "4.0.5",
|
|
132
131
|
"nanoid": "5.1.5",
|
|
133
132
|
"postcss": {
|
|
@@ -145,15 +144,21 @@
|
|
|
145
144
|
"swagger2openapi": "7.0.8"
|
|
146
145
|
},
|
|
147
146
|
"markdown-it": "12.3.2",
|
|
148
|
-
"fast-xml-parser": "5.
|
|
147
|
+
"fast-xml-parser": "5.5.10",
|
|
149
148
|
"trim": "0.0.3",
|
|
150
149
|
"cross-spawn": "7.0.6",
|
|
151
150
|
"yargs-parser": "21.1.1",
|
|
152
151
|
"jws": "3.2.3",
|
|
153
152
|
"validator": "13.15.22",
|
|
154
|
-
"lodash": "4.
|
|
155
|
-
"lodash-es": "4.
|
|
156
|
-
"undici": "7.
|
|
153
|
+
"lodash": "4.18.1",
|
|
154
|
+
"lodash-es": "4.18.1",
|
|
155
|
+
"undici": "7.24.7",
|
|
156
|
+
"@hapi/content": "6.0.1",
|
|
157
|
+
"replace": {
|
|
158
|
+
"minimatch": "3.1.4"
|
|
159
|
+
},
|
|
160
|
+
"path-to-regexp": "0.1.13",
|
|
161
|
+
"picomatch": "2.3.2"
|
|
157
162
|
},
|
|
158
163
|
"peerDependencies": {
|
|
159
164
|
"@mojaloop/central-services-error-handling": "13.x.x",
|
|
@@ -81,9 +81,10 @@ const plugin = {
|
|
|
81
81
|
|
|
82
82
|
if (needProxySourceValidation) validateProxySourceHeaders(request.headers)
|
|
83
83
|
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
|
|
84
|
+
// Require accept header for request-initiating methods (GET, POST, DELETE)
|
|
85
|
+
// per FSPIOP API spec. PUT/PATCH callbacks do not require Accept.
|
|
86
|
+
const methodRequiresAccept = ['get', 'post', 'delete'].includes(request.method.toLowerCase())
|
|
87
|
+
if (methodRequiresAccept || request.headers.accept) {
|
|
87
88
|
if (request.headers.accept === undefined) {
|
|
88
89
|
throw createFSPIOPError(Enums.FSPIOPErrorCodes.MISSING_ELEMENT, errorMessages.REQUIRE_ACCEPT_HEADER)
|
|
89
90
|
}
|
|
@@ -151,7 +151,8 @@ Test('headerValidation plugin test', async (pluginTest) => {
|
|
|
151
151
|
t.end()
|
|
152
152
|
})
|
|
153
153
|
|
|
154
|
-
pluginTest.test('accept validation is
|
|
154
|
+
pluginTest.test('accept validation is performed on post requests without an accept header', async t => {
|
|
155
|
+
const fspiopCode = ErrorHandling.Enums.FSPIOPErrorCodes.MISSING_ELEMENT
|
|
155
156
|
const opts = {
|
|
156
157
|
url: `/${resource}`,
|
|
157
158
|
headers: {
|
|
@@ -159,11 +160,25 @@ Test('headerValidation plugin test', async (pluginTest) => {
|
|
|
159
160
|
date: new Date().toUTCString()
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
|
-
await
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
const res = await server.inject({ ...opts, method: 'post' })
|
|
164
|
+
t.is(res.statusCode, fspiopCode.httpStatusCode)
|
|
165
|
+
const payload = JSON.parse(res.payload)
|
|
166
|
+
t.is(payload.apiErrorCode.code, fspiopCode.code)
|
|
167
|
+
t.is(payload.message, errorMessages.REQUIRE_ACCEPT_HEADER)
|
|
168
|
+
t.end()
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
pluginTest.test('accept validation is not required for put requests without an accept header', async t => {
|
|
172
|
+
const opts = {
|
|
173
|
+
url: `/${resource}`,
|
|
174
|
+
headers: {
|
|
175
|
+
'content-type': generateContentTypeHeader(resource, 1),
|
|
176
|
+
date: new Date().toUTCString()
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const res = await server.inject({ ...opts, method: 'put' })
|
|
180
|
+
t.is(res.payload, '')
|
|
181
|
+
t.is(res.statusCode, 202)
|
|
167
182
|
t.end()
|
|
168
183
|
})
|
|
169
184
|
|
|
@@ -10,35 +10,6 @@ const Enum = require('../../../src/enums')
|
|
|
10
10
|
const Helper = require('../../util/helper')
|
|
11
11
|
const Metrics = require('@mojaloop/central-services-metrics')
|
|
12
12
|
const Uuid = require('uuid4')
|
|
13
|
-
const JwsSigner = require('@mojaloop/sdk-standard-components').Jws.signer
|
|
14
|
-
|
|
15
|
-
const signingKey = `-----BEGIN RSA PRIVATE KEY-----
|
|
16
|
-
MIIEowIBAAKCAQEA0eJEh3Op5p6x137lRkAsvmEBbd32dbRChrCUItZbtxjf/qfB
|
|
17
|
-
yD5k8Hn4n4vbqzP8XSGS0f6KmNC+iRaP74HVgzAqc4Uid4J8dtSBq3VmucYQYzLc
|
|
18
|
-
101QjuvD+SKmZwlw/q0PtulmqlASI2SbMfwcAraMi6ab7v5W4EGNeIPLEIo3BXsQ
|
|
19
|
-
DTCWqiZb7aXkHkcY7sOjAzK/2bNGYFmAthdYrHzvCkqnJ7LAHX3Oj7rJea5MqtuN
|
|
20
|
-
B9POZYaD10n9JuYWdwPqLrw6/hVgPSFEy+ulrVbXf54ZH0dfMThAYRvFrT81yulk
|
|
21
|
-
H95JhXWGdi6cTp6t8LVOKFhnNfxjWw0Jayj9xwIDAQABAoIBADB2u/Y/CgNbr5sg
|
|
22
|
-
DRccqHhJdAgHkep59kadrYch0knEL6zg1clERxCUSYmlxNKSjXp/zyQ4T46b3PNQ
|
|
23
|
-
x2m5pDDHxXWpT10jP1Q9G7gYwuCw0IXnb8EzdB+cZ0M28g+myXW1RoSo/nDjTlzn
|
|
24
|
-
1UJEgb9Kocd5cFZOWocr+9vRKumlZULMsA8yiNwlAfJHcMBM7acsa3myCqVhLyWt
|
|
25
|
-
4BQylVuLFa+A6QzpMXEwFCq8EOXf07gl1XVzC6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uwT
|
|
40
|
-
Oyqsp6pzAWFrCD3JAoTLxClV+j5m+SXZ/ItD6ziGpl/h7DyayrFZ
|
|
41
|
-
-----END RSA PRIVATE KEY-----`
|
|
42
13
|
|
|
43
14
|
Test('ParticipantEndpoint Model Test', modelTest => {
|
|
44
15
|
let sandbox
|
|
@@ -483,10 +454,9 @@ Test('ParticipantEndpoint Model Test', modelTest => {
|
|
|
483
454
|
method: 'post',
|
|
484
455
|
headers: Helper.defaultHeaders(fsp, Enum.Http.HeaderResources.PARTICIPANTS, payeefsp)
|
|
485
456
|
}
|
|
486
|
-
const jwsSigner =
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
})
|
|
457
|
+
const jwsSigner = {
|
|
458
|
+
getSignature: () => 'mock-jws-signature'
|
|
459
|
+
}
|
|
490
460
|
request = sandbox.stub().returns({ status: 200 })
|
|
491
461
|
Model = proxyquire('../../../src/util/request', { axios: request })
|
|
492
462
|
const signSpy = Sinon.spy(jwsSigner, 'getSignature')
|
|
@@ -517,10 +487,9 @@ Test('ParticipantEndpoint Model Test', modelTest => {
|
|
|
517
487
|
method: 'post',
|
|
518
488
|
headers: Helper.defaultHeaders(fsp, Enum.Http.HeaderResources.PARTICIPANTS, payeefsp)
|
|
519
489
|
}
|
|
520
|
-
const jwsSigner =
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
})
|
|
490
|
+
const jwsSigner = {
|
|
491
|
+
getSignature: () => 'mock-jws-signature'
|
|
492
|
+
}
|
|
524
493
|
request = sandbox.stub().returns({ status: 200 })
|
|
525
494
|
Model = proxyquire('../../../src/util/request', { axios: request })
|
|
526
495
|
const signSpy = Sinon.spy(jwsSigner, 'getSignature')
|