@mojaloop/event-stream-processor 12.0.1

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.
Files changed (52) hide show
  1. package/.circleci/config.yml +12 -0
  2. package/.editorconfig +18 -0
  3. package/.grype.yaml +37 -0
  4. package/.ncurc.yaml +7 -0
  5. package/.nvmrc +1 -0
  6. package/.nycrc.yml +19 -0
  7. package/CHANGELOG.md +89 -0
  8. package/CODEOWNERS +38 -0
  9. package/Dockerfile +49 -0
  10. package/LICENSE.md +9 -0
  11. package/README.md +178 -0
  12. package/audit-ci.jsonc +10 -0
  13. package/audit-resolve.json +21 -0
  14. package/config/default.json +133 -0
  15. package/config/policy-rollover-mojaloop.json +24 -0
  16. package/config/template-mojaloop.json +222 -0
  17. package/docker/configs/apm-server.docker.yml +1015 -0
  18. package/docker/docker-compose.yaml +170 -0
  19. package/docker/kafka-consume.sh +1 -0
  20. package/docker/kafka-produces-multi.sh +1 -0
  21. package/docker/kafka-produces-single.sh +1 -0
  22. package/docker/msg-example.single +1 -0
  23. package/docker/msg-examples.multi +8 -0
  24. package/package.json +124 -0
  25. package/sbom-v12.0.0-snapshot.25.csv +1233 -0
  26. package/src/index.js +44 -0
  27. package/src/lib/config.js +10 -0
  28. package/src/lib/efk/index.js +104 -0
  29. package/src/lib/healthCheck/subServiceHealth.js +85 -0
  30. package/src/lib/tracer/index.js +21 -0
  31. package/src/observables/apmTracerObservable.js +303 -0
  32. package/src/observables/elastic-logger.js +80 -0
  33. package/src/observables/fluentd-logger.js +20 -0
  34. package/src/observables/index.js +35 -0
  35. package/src/observables/testing_agents.-js +33 -0
  36. package/src/setup.js +128 -0
  37. package/src/templates/register.js +72 -0
  38. package/test/sample-data/messages.json +4327 -0
  39. package/test/unit/index.test.js +88 -0
  40. package/test/unit/lib/config.test.js +77 -0
  41. package/test/unit/lib/efk/index.test.js +187 -0
  42. package/test/unit/lib/healthCheck/subServiceHealth.test.js +119 -0
  43. package/test/unit/lib/tracer/index.test.js +59 -0
  44. package/test/unit/observables/apmTracerObservable.test.js +788 -0
  45. package/test/unit/observables/elastic-logger.test.js +187 -0
  46. package/test/unit/observables/fluentd-logger.test.js +101 -0
  47. package/test/unit/observables/index.test.js +47 -0
  48. package/test/unit/templates/register.test.js +66 -0
  49. package/test/util/scripts/docker-efk/docker-compose.yml +74 -0
  50. package/test/util/scripts/docker-efk/fluentd/Dockerfile +2 -0
  51. package/test/util/scripts/docker-efk/fluentd/conf/fluent.conf +18 -0
  52. package/test/util/scripts/docker-efk/misc/clients-td-agent.conf +14 -0
@@ -0,0 +1,12 @@
1
+ version: 2.1
2
+ setup: true
3
+ orbs:
4
+ build: mojaloop/build@1.1.17
5
+ workflows:
6
+ setup:
7
+ jobs:
8
+ - build/workflow:
9
+ context: org-global
10
+ filters:
11
+ tags:
12
+ only: /v\d+(\.\d+){2}(-[a-zA-Z-][0-9a-zA-Z-]*\.\d+)?/
package/.editorconfig ADDED
@@ -0,0 +1,18 @@
1
+ root = true
2
+
3
+ [*]
4
+ end_of_line = lf
5
+ insert_final_newline = true
6
+ trim_trailing_whitespace = true
7
+ charset = utf-8
8
+
9
+ [*.js]
10
+ indent_style = space
11
+ indent_size = 2
12
+
13
+ [{package.json,*.yml,*.cjson}]
14
+ indent_style = space
15
+ indent_size = 2
16
+
17
+ [*.md]
18
+ trim_trailing_whitespace = false
package/.grype.yaml ADDED
@@ -0,0 +1,37 @@
1
+ scan-type: source
2
+
3
+ ignore:
4
+ - vulnerability: CVE-2025-60876
5
+ include-aliases: true
6
+ reason: "Alpine base image package (apk): busybox - no npm fix available as of 2026-02-23 (moderate severity)"
7
+ - vulnerability: GHSA-7h2j-956f-4vf2
8
+ include-aliases: true
9
+ reason: >-
10
+ Base image npm package: @isaacs/brace-expansion - bundled in Node.js base image, not fixable via application
11
+ dependencies as of 2026-02-23 (high severity)
12
+ - vulnerability: GHSA-83g3-92jg-28cx
13
+ include-aliases: true
14
+ reason: >-
15
+ Base image npm package: tar - bundled in Node.js base image, not fixable via application dependencies as of
16
+ 2026-02-23 (high severity)
17
+ - vulnerability: GHSA-34x7-hfp2-rc4v
18
+ include-aliases: true
19
+ reason: >-
20
+ Base image npm package: tar - bundled in Node.js base image, not fixable via application dependencies as of
21
+ 2026-02-23 (high severity)
22
+ - vulnerability: CVE-2026-27171
23
+ include-aliases: true
24
+ reason: "Alpine base image package (apk): zlib - no npm fix available as of 2026-02-23 (moderate severity)"
25
+ - vulnerability: GHSA-p9pc-299p-vxgp
26
+ include-aliases: true
27
+ reason: "Unfixable npm transitive vulnerability: yargs-parser (moderate severity) as of 2026-02-23"
28
+ - vulnerability: GHSA-2g4f-4pwh-qvx6
29
+ include-aliases: true
30
+ reason: "Unfixable npm transitive vulnerability: ajv (moderate severity) as of 2026-02-23"
31
+ output:
32
+ - table
33
+ - json
34
+ search:
35
+ scope: squashed
36
+ quiet: false
37
+ check-for-app-update: false
package/.ncurc.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ## Add a TODO comment indicating the reason for each rejected dependency upgrade added to this list, and what should be done to resolve it (i.e. handle it through a story, etc).
2
+ reject: [
3
+ ## TODO: Added "@hapi/catbox", "@hapi/catbox-memory" to ncurc for dep:check to ignore updates due to breaking changes which should be handled by another story
4
+ "@hapi/catbox",
5
+ "@hapi/catbox-memory",
6
+ "eslint"
7
+ ]
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 22.22.0
package/.nycrc.yml ADDED
@@ -0,0 +1,19 @@
1
+ temp-directory: "./.nyc_output"
2
+ check-coverage: true
3
+ per-file: true
4
+ lines: 90
5
+ statements: 90
6
+ functions: 90
7
+ # branches: 90 ## TODO: This should be un-commented to 90 once code-coverage is improved!
8
+ all: true
9
+ include: [
10
+ "src/**/*.js"
11
+ ]
12
+ reporter: [
13
+ "lcov"
14
+ ]
15
+ exclude: [
16
+ "src/setup.js", # Ignoring this until there is a reason to test this file. Currently just exports the library functions.
17
+ "src/lib/kafka/index.js", # Ignoring this until there is a reason to test this file. Currently just exports the library functions.
18
+ "**/node_modules/**"
19
+ ]
package/CHANGELOG.md ADDED
@@ -0,0 +1,89 @@
1
+ # Changelog
2
+
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
+
5
+ ### [12.0.1](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.26...v12.0.1) (2026-03-31)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * add tap-xunit devDependency for CI xunit test output ([1e4e80b](https://github.com/mojaloop/event-stream-processor/commit/1e4e80b55710521970992f40eb3a1cba47185c15))
11
+ * **security:** update npm overrides to resolve CI vulnerabilities ([fc0b06c](https://github.com/mojaloop/event-stream-processor/commit/fc0b06c1f95328f3f710902ba91bf598d0d19ee4))
12
+
13
+ ## [12.0.0-snapshot.26](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.25...v12.0.0-snapshot.26) (2026-02-25)
14
+
15
+ ## [12.0.0-snapshot.25](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.24...v12.0.0-snapshot.25) (2026-02-23)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * bump fast-xml-parser override to 5.3.6, remove minimatch override ([1960b93](https://github.com/mojaloop/event-stream-processor/commit/1960b93a966d26ae0b849776b3fba33dc19003d8))
21
+ * remove duplicate GHSA-3ppc-4f35-3m26 entry from .grype.yaml ([4cbedd0](https://github.com/mojaloop/event-stream-processor/commit/4cbedd01d355b8932f14368cb6a88a52f597be76))
22
+
23
+ ## [12.0.0-snapshot.24](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.23...v12.0.0-snapshot.24) (2026-02-12)
24
+
25
+
26
+ ### Features
27
+
28
+ * replace Consumer.isConnected with consumer.isHealthy() for Kafka health checks ([24f2950](https://github.com/mojaloop/event-stream-processor/commit/24f2950b2b151f70daa15dc261ae13e8d58c4f92)), closes [#1238](https://github.com/mojaloop/event-stream-processor/issues/1238)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * add lodash override and allowlist yargs-parser for audit-ci ([698310f](https://github.com/mojaloop/event-stream-processor/commit/698310fcf2963136b41e9cf89232af286dda7be9))
34
+
35
+ ## [12.0.0-snapshot.23](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.22...v12.0.0-snapshot.23) (2026-01-14)
36
+
37
+ ## [12.0.0-snapshot.22](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.21...v12.0.0-snapshot.22) (2025-12-08)
38
+
39
+ ## [12.0.0-snapshot.21](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.20...v12.0.0-snapshot.21) (2025-10-09)
40
+
41
+ ## [12.0.0-snapshot.20](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.19...v12.0.0-snapshot.20) (2025-07-30)
42
+
43
+ ## [12.0.0-snapshot.19](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.18...v12.0.0-snapshot.19) (2025-07-30)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * genrate sbom and node version ([9cef22a](https://github.com/mojaloop/event-stream-processor/commit/9cef22a29c0aaa0ffd9fc909addaa63bb55ce0b7))
49
+
50
+ ## [12.0.0-snapshot.18](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.17...v12.0.0-snapshot.18) (2025-07-30)
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * sbom generation ([d3c4b30](https://github.com/mojaloop/event-stream-processor/commit/d3c4b3069477d461568d925bca9b3db605bef971))
56
+
57
+ ## [12.0.0-snapshot.17](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.16...v12.0.0-snapshot.17) (2025-07-29)
58
+
59
+ ## [12.0.0-snapshot.16](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.15...v12.0.0-snapshot.16) (2025-07-25)
60
+
61
+ ## [12.0.0-snapshot.15](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.14...v12.0.0-snapshot.15) (2025-06-17)
62
+
63
+ ## [12.0.0-snapshot.14](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.13...v12.0.0-snapshot.14) (2025-02-25)
64
+
65
+ ## [12.0.0-snapshot.13](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.12...v12.0.0-snapshot.13) (2025-01-29)
66
+
67
+ ## [12.0.0-snapshot.12](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.11...v12.0.0-snapshot.12) (2025-01-27)
68
+
69
+ ## [12.0.0-snapshot.11](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.10...v12.0.0-snapshot.11) (2025-01-16)
70
+
71
+
72
+ ### Bug Fixes
73
+
74
+ * downgrade nodejs to v18.20.4 ([16f2152](https://github.com/mojaloop/event-stream-processor/commit/16f2152136f7486aa797d4e93adb778d2aec5aaa))
75
+
76
+ ## [12.0.0-snapshot.10](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.9...v12.0.0-snapshot.10) (2025-01-13)
77
+
78
+ ## [12.0.0-snapshot.9](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.8...v12.0.0-snapshot.9) (2023-12-20)
79
+
80
+ ## [12.0.0-snapshot.7](https://github.com/mojaloop/event-stream-processor/compare/v12.0.0-snapshot.6...v12.0.0-snapshot.7) (2022-07-25)
81
+
82
+
83
+ ### ⚠ BREAKING CHANGES
84
+
85
+ * **mojaloop/#2092:** Major version bump for node v16 LTS support, re-structuring of project directories to align to core Mojaloop repositories and docker image now uses `/opt/app` instead of `/opt/event-stream-processor` which will impact config mounts.
86
+
87
+ ### Features
88
+
89
+ * **mojaloop/#2092:** upgrade nodeJS version for core services ([#61](https://github.com/mojaloop/event-stream-processor/issues/61)) ([d27db35](https://github.com/mojaloop/event-stream-processor/commit/d27db3501b415ca54d89e8389808dd11b9ca3ab3)), closes [mojaloop/#2092](https://github.com/mojaloop/project/issues/2092)
package/CODEOWNERS ADDED
@@ -0,0 +1,38 @@
1
+ # This is a comment.
2
+ # Each line is a file pattern followed by one or more owners.
3
+
4
+ ## These owners will be the default owners for everything in
5
+ ## the repo. Unless a later match takes precedence,
6
+ ## @global-owner1 and @global-owner2 will be requested for
7
+ ## review when someone opens a pull request.
8
+ #* @global-owner1 @global-owner2
9
+ * @elnyry-sam-k @bushjames @shashi165 @gibaros
10
+
11
+ ## Order is important; the last matching pattern takes the most
12
+ ## precedence. When someone opens a pull request that only
13
+ ## modifies JS files, only @js-owner and not the global
14
+ ## owner(s) will be requested for a review.
15
+ # *.js @js-owner
16
+
17
+ ## You can also use email addresses if you prefer. They'll be
18
+ ## used to look up users just like we do for commit author
19
+ ## emails.
20
+ #*.go docs@example.com
21
+
22
+ # In this example, @doctocat owns any files in the build/logs
23
+ # directory at the root of the repository and any of its
24
+ # subdirectories.
25
+ # /build/logs/ @doctocat
26
+
27
+ ## The `docs/*` pattern will match files like
28
+ ## `docs/getting-started.md` but not further nested files like
29
+ ## `docs/build-app/troubleshooting.md`.
30
+ # docs/* docs@example.com
31
+
32
+ ## In this example, @octocat owns any file in an apps directory
33
+ ## anywhere in your repository.
34
+ #apps/ @octocat
35
+
36
+ ## In this example, @doctocat owns any file in the `/docs`
37
+ ## directory in the root of your repository.
38
+ #/docs/ @doctocat
package/Dockerfile ADDED
@@ -0,0 +1,49 @@
1
+ # Arguments
2
+ ARG NODE_VERSION=22.22.0-alpine3.23
3
+
4
+ # NOTE: Ensure you set NODE_VERSION Build Argument as follows...
5
+ #
6
+ # export NODE_VERSION="$(cat .nvmrc)-alpine" \
7
+ # docker build \
8
+ # --build-arg NODE_VERSION=$NODE_VERSION \
9
+ # -t mojaloop/event-stream-processor:local \
10
+ # . \
11
+ #
12
+
13
+ # Build Image
14
+ FROM node:${NODE_VERSION} as builder
15
+ USER root
16
+
17
+ WORKDIR /opt/app
18
+
19
+ RUN apk --no-cache add git
20
+ RUN apk add --no-cache -t build-dependencies make gcc g++ python3 libtool openssl-dev autoconf automake bash \
21
+ && cd $(npm root -g)/npm
22
+
23
+ COPY package.json package-lock.json* /opt/app/
24
+
25
+ RUN npm ci
26
+
27
+ RUN apk del build-dependencies
28
+
29
+ COPY src /opt/app/src
30
+ COPY config /opt/app/config
31
+
32
+ FROM node:${NODE_VERSION}
33
+
34
+ WORKDIR /opt/app
35
+
36
+ # Create empty log file & link stdout to the application log file
37
+ RUN mkdir ./logs && touch ./logs/combined.log
38
+ # Links combined to stdout
39
+ RUN ln -sf /dev/stdout ./logs/combined.log
40
+
41
+ # Create a non-root user:app-user
42
+ RUN adduser -D app-user
43
+ USER app-user
44
+
45
+ COPY --chown=app-user --from=builder /opt/app .
46
+ RUN npm prune --production
47
+
48
+ EXPOSE 3082
49
+ CMD ["npm", "start"]
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ # LICENSE
2
+
3
+ Copyright © 2020-2025 Mojaloop Foundation
4
+
5
+ The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License.
6
+
7
+ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,178 @@
1
+ # event-stream-processor
2
+
3
+ [![Git Commit](https://img.shields.io/github/last-commit/mojaloop/event-stream-processor.svg?style=flat)](https://github.com/mojaloop/event-stream-processor/commits/master)
4
+ [![Git Releases](https://img.shields.io/github/release/mojaloop/event-stream-processor.svg?style=flat)](https://github.com/mojaloop/event-stream-processor/releases)
5
+ [![Docker pulls](https://img.shields.io/docker/pulls/mojaloop/event-stream-processor.svg?style=flat)](https://hub.docker.com/r/mojaloop/event-stream-processor)
6
+ [![CircleCI](https://circleci.com/gh/mojaloop/event-stream-processor.svg?style=svg)](https://app.circleci.com/pipelines/github/mojaloop/event-stream-processor)
7
+
8
+ Event Stream Processor (ESP) for Event Stream (logs, audits, errors, trace, etc)
9
+
10
+ ## TODO
11
+
12
+ - Improve unit tests using Jest (NOT tap/tape!).
13
+ - Improve code-coverage to 90% across the board: [.nycrc.yml](./.nycrc.yml).
14
+ - Add NPM script `test` as a `pre-commit` in the package.json.
15
+ - Update CI-CD to include unit and code-coverage checks.
16
+ - Technical Debt to be resolved:
17
+ - Address legacy API changes that will be deprecated with RXJS v8.
18
+ - Investigate the reason/cause for `observable.complete()` throwing the following unhandled error: "TypeError: teardown.unsubscribe is not a function" to be thrown.
19
+ - Re-factor solution to not rely on forked implementations of `@mojaloop/elastic-apm-node*` dependencies. Consider something using [elastic-apm-http-client](https://www.npmjs.com/package/elastic-apm-http-client), or completely replace with [opentelemetry](https://opentelemetry.io/docs/instrumentation/js/getting-started/).
20
+ - Re-factor solution to use [@elastic/elasticsearch](https://www.npmjs.com/package/@elastic/elasticsearch) instead of deprecated [elasticsearch](https://www.npmjs.com/package/elasticsearch) dependency.
21
+ - Removed unused `FluentD` legacy code/dependencies.
22
+ - Fix issues with updated `@hapi/catbox*` dependency releases.
23
+
24
+ ## 1. Pre-requisites
25
+
26
+ ### 1.1 Elasticsearch
27
+
28
+ Ensure that you have created the following resources prior to deploying the ESP component:
29
+
30
+ 1. [Create a Policy](#1111-create) with the desired Rollover configurations: [policy-rollover-mojaloop.json](./config/policy-rollover-mojaloop.json)
31
+ 2. [Create a Template](#1121-create) to associate the Policy Settings to the Logstash index based on the following config: [template-mojaloop.json](./config/template-mojaloop.json)
32
+
33
+ > **NOTE**:
34
+ > If ESP component is running prior to configuring the above template, the index mapping will be auto-created and will not take effect.
35
+
36
+ #### 1.1.1 Mojaloop Index Rollover Policy
37
+
38
+ ##### 1.1.1.1 Create
39
+
40
+ ```curl
41
+ curl -X PUT "http://elasticsearch:9200/_ilm/policy/mojaloop_rollover_policy?pretty" -H 'Content-Type: application/json' -d @config/policy-rollover-mojaloop.json
42
+ ```
43
+
44
+ curl -X PUT "http://localhost:9200/_ilm/policy/mojaloop_rollover_policy?pretty" -H 'Content-Type: application/json' -d @config/policy-rollover-mojaloop.json
45
+
46
+ ##### 1.1.1.2 Delete
47
+
48
+ > **NOTE**:
49
+ > only needed if you need to remove the policy_
50
+
51
+ ```curl
52
+ curl -X DELETE "http://elasticsearch:9200/_ilm/policy/mojaloop_rollover_policy?"
53
+ ```
54
+
55
+ #### 1.1.1.3 Get
56
+
57
+ > **NOTE**:
58
+ > useful for debugging issues_
59
+
60
+ ```curl
61
+ curl -X GET "http://elasticsearch:9200/_ilm/policy/mojaloop_rollover_policy?"
62
+ ```
63
+
64
+ #### 1.1.2 Mojaloop Index Template
65
+
66
+ ##### 1.1.2.1 Create
67
+
68
+ ```curl
69
+ curl -X PUT "http://elasticsearch:9200/_template/moja_template?pretty" -H 'Content-Type: application/json' -d @config/template-mojaloop.json
70
+ ```
71
+
72
+ curl -X PUT "http://localhost:9200/_template/moja_template?pretty" -H 'Content-Type: application/json' -d @config/template-mojaloop.json'
73
+
74
+ ##### 1.1.2.2 Delete
75
+
76
+ > **NOTE**:
77
+ > only needed if you need to remove the template_
78
+
79
+ ```curl
80
+ curl -X DELETE "http://elasticsearch:9200/_template/moja_template"
81
+ ```
82
+
83
+ #### 1.1.3 Get Template
84
+
85
+ > **NOTE**:
86
+ useful for debugging template issues_
87
+
88
+ ```curl
89
+ curl -X GET "http://elasticsearch:9200/_template/moja_template"
90
+ ```
91
+
92
+ ## Testing
93
+
94
+ ### Local
95
+
96
+ 1. Run Docker-compose which will start up the following dependencies:
97
+
98
+ 1. Kafka - Message Bus
99
+ 2. ElasticSearch - Event Indexing of all Event types (traces, audits, errors, logs, etc) from the `event-topic`
100
+ 3. APM - Application Monitoring for Trace event
101
+ 4. Kibana - ElasticSearch UI
102
+ 5. Kowl - Helpful UI for managing/monitoring/querying Kafka visually
103
+
104
+ ```bash
105
+ cd ./docker
106
+ docker-compose up -d
107
+ ```
108
+
109
+ 2. Helper script to produce a single sample message using [kcat](https://github.com/edenhill/kcat)
110
+
111
+ ```bash
112
+ sh ./docker/kafka-produces-single.sh
113
+ ```
114
+
115
+ 3. Helper script to produce multiple sample messages using [kcat](https://github.com/edenhill/kcat)
116
+
117
+ ```bash
118
+ sh ./docker/kafka-produces-multi.sh
119
+ ```
120
+
121
+ ## Auditing Dependencies
122
+
123
+ We use `npm-audit-resolver` along with `npm audit` to check dependencies for node vulnerabilities, and keep track of resolved dependencies with an `audit-resolve.json` file.
124
+
125
+ To start a new resolution process, run:
126
+
127
+ ```bash
128
+ npm run audit:resolve
129
+ ```
130
+
131
+ You can then check to see if the CI will pass based on the current dependencies with:
132
+
133
+ ```bash
134
+ npm run audit:check
135
+ ```
136
+
137
+ And commit the changed `audit-resolve.json` to ensure that CircleCI will build correctly.
138
+
139
+ ## Container Scans
140
+
141
+ As part of our CI/CD process, we use anchore-cli to scan our built docker container for vulnerabilities upon release.
142
+
143
+ If you find your release builds are failing, refer to the [container scanning](https://github.com/mojaloop/ci-config#container-scanning) in our shared Mojaloop CI config repo. There is a good chance you simply need to update the `mojaloop-policy-generator.js` file and re-run the circleci workflow.
144
+
145
+ For more information on anchore and anchore-cli, refer to:
146
+
147
+ - [Anchore CLI](https://github.com/anchore/anchore-cli)
148
+ - [Circle Orb Registry](https://circleci.com/orbs/registry/orb/anchore/anchore-engine)
149
+
150
+ ## Automated Releases
151
+
152
+ As part of our CI/CD process, we use a combination of CircleCI, standard-version
153
+ npm package and github-release CircleCI orb to automatically trigger our releases
154
+ and image builds. This process essentially mimics a manual tag and release.
155
+
156
+ On a merge to master, CircleCI is configured to use the mojaloopci github account
157
+ to push the latest generated CHANGELOG and package version number.
158
+
159
+ Once those changes are pushed, CircleCI will pull the updated master, tag and
160
+ push a release triggering another subsequent build that also publishes a docker image.
161
+
162
+ ### Potential problems
163
+
164
+ - There is a case where the merge to master workflow will resolve successfully, triggering
165
+ a release. Then that tagged release workflow subsequently failing due to the image scan,
166
+ audit check, vulnerability check or other "live" checks.
167
+
168
+ This will leave master without an associated published build. Fixes that require
169
+ a new merge will essentially cause a skip in version number or require a clean up
170
+ of the master branch to the commit before the CHANGELOG and bump.
171
+
172
+ This may be resolved by relying solely on the previous checks of the
173
+ merge to master workflow to assume that our tagged release is of sound quality.
174
+ We are still mulling over this solution since catching bugs/vulnerabilities/etc earlier
175
+ is a boon.
176
+
177
+ - It is unknown if a race condition might occur with multiple merges with master in
178
+ quick succession, but this is a suspected edge case.
package/audit-ci.jsonc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
3
+ // audit-ci supports reading JSON, JSONC, and JSON5 config files.
4
+ // Only use one of ["low": true, "moderate": true, "high": true, "critical": true]
5
+ "moderate": true,
6
+ "allowlist": [ // NOTE: Please add as much information as possible to any items added to the allowList
7
+ "GHSA-p9pc-299p-vxgp",
8
+ "GHSA-2g4f-4pwh-qvx6"
9
+ ]
10
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "decisions": {
3
+ "1500|@mojaloop/central-services-shared>widdershins>yargs>yargs-parser": {
4
+ "decision": "ignore",
5
+ "madeAt": 1629451295380,
6
+ "expiresAt": 1630056086511
7
+ },
8
+ "1675|@mojaloop/central-services-shared>shins>sanitize-html": {
9
+ "decision": "ignore",
10
+ "madeAt": 1629451300400,
11
+ "expiresAt": 1630056086511
12
+ },
13
+ "1676|@mojaloop/central-services-shared>shins>sanitize-html": {
14
+ "decision": "ignore",
15
+ "madeAt": 1629451300400,
16
+ "expiresAt": 1630056086511
17
+ }
18
+ },
19
+ "rules": {},
20
+ "version": 1
21
+ }
@@ -0,0 +1,133 @@
1
+ {
2
+ "CACHE": {
3
+ "ttl": 300000,
4
+ "segment": "trace",
5
+ "expectSpanTimeout": 270000,
6
+ "CATBOX_MEMORY": {
7
+ "partition": "trace-cache",
8
+ "maxByteSize": 524288000,
9
+ "minCleanupIntervalMsec": 100000
10
+ }
11
+ },
12
+ "SPAN": {
13
+ "START_CRITERIA": {
14
+ "transfer": [
15
+ {
16
+ "prepare": {
17
+ "service": "ml_transfer_prepare"
18
+ }
19
+ },
20
+ {
21
+ "abort": {
22
+ "service": "ml_transfer_abort"
23
+ }
24
+ },
25
+ {
26
+ "timeout-received": {
27
+ "service": "cl_transfer_timeout"
28
+ }
29
+ }
30
+ ]
31
+ },
32
+ "END_CRITERIA": {
33
+ "transfer": [
34
+ {
35
+ "fulfil": {
36
+ "service": "ml_notification_event"
37
+ }
38
+ },
39
+ {
40
+ "abort": {
41
+ "service": "ml_notification_event"
42
+ }
43
+ }, {
44
+ "timeout-received": {
45
+ "service": "ml_notification_event"
46
+ }
47
+ },
48
+ {
49
+ "prepare": {
50
+ "service": "ml_notification_event",
51
+ "isError": true
52
+ }
53
+ }
54
+ ],
55
+ "exceptionList": []
56
+ }
57
+ },
58
+ "efk": {
59
+ "host": "dev1-fluentd.mojaloop.live",
60
+ "port": 24224,
61
+ "timeout": 3.0,
62
+ "reconnectInterval": 600,
63
+ "requireAckResponse": true,
64
+ "namespace": "logstash"
65
+ },
66
+ "EFK_CLIENT": {
67
+ "host": "localhost:9200",
68
+ "log": "error",
69
+ "index": {
70
+ "name": "mojaloop",
71
+ "template": "{{index}}-{{date}}"
72
+ }
73
+ },
74
+ "APM": {
75
+ "serviceName": "event-stream-processor",
76
+ "serverUrl": "http://localhost:8200",
77
+ "captureErrorLogStackTraces": "never"
78
+ },
79
+ "PORT": 3082,
80
+ "KAFKA": {
81
+ "TOPIC_TEMPLATES": {
82
+ "GENERAL_TOPIC_TEMPLATE": {
83
+ "TEMPLATE": "topic-{{functionality}}",
84
+ "REGEX": "topic-(.*)"
85
+ }
86
+ },
87
+ "PRODUCER": {
88
+ "EVENT": {
89
+ "config": {
90
+ "options": {
91
+ "messageCharset": "utf8"
92
+ },
93
+ "rdkafkaConf": {
94
+ "metadata.broker.list": "localhost:9092",
95
+ "client.id": "es-prod-event",
96
+ "event_cb": true,
97
+ "dr_cb": true,
98
+ "socket.keepalive.enable": true,
99
+ "queue.buffering.max.messages": 10000000
100
+ },
101
+ "topicConf": {
102
+ "request.required.acks": "all"
103
+ }
104
+ }
105
+ }
106
+ },
107
+ "CONSUMER": {
108
+ "EVENT": {
109
+ "config": {
110
+ "options": {
111
+ "mode": 2,
112
+ "batchSize": 1,
113
+ "pollFrequency": 10,
114
+ "recursiveTimeout": 100,
115
+ "messageCharset": "utf8",
116
+ "messageAsJSON": true,
117
+ "sync": true,
118
+ "consumeTimeout": 1000
119
+ },
120
+ "rdkafkaConf": {
121
+ "client.id": "cep-event-mediation",
122
+ "group.id": "cep-event-mediation-group",
123
+ "metadata.broker.list": "localhost:9092",
124
+ "socket.keepalive.enable": true
125
+ },
126
+ "topicConf": {
127
+ "auto.offset.reset": "earliest"
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
133
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "policy": {
3
+ "phases": {
4
+ "hot": {
5
+ "actions": {
6
+ "rollover": {
7
+ "max_age": "30d",
8
+ "max_size": "20GB"
9
+ },
10
+ "set_priority": {
11
+ "priority": 100
12
+ }
13
+ },
14
+ "min_age": "0ms"
15
+ },
16
+ "delete": {
17
+ "min_age": "30d",
18
+ "actions": {
19
+ "delete": {}
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }