badmfck-api-server 6.0.11 → 6.0.13

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 (64) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +247 -79
  3. package/dist/apiServer/APIService.d.ts +3 -1
  4. package/dist/apiServer/APIService.js +25 -1
  5. package/dist/apiServer/LogService.d.ts +2 -0
  6. package/dist/apiServer/LogService.js +10 -8
  7. package/dist/apiServer/MonitorService.d.ts +4 -1
  8. package/dist/apiServer/MonitorService.js +28 -5
  9. package/dist/apiServer/deployment/Activate.js +2 -6
  10. package/dist/apiServer/deployment/Backups.js +3 -2
  11. package/dist/apiServer/deployment/Bundler.d.ts +12 -0
  12. package/dist/apiServer/deployment/Bundler.js +178 -0
  13. package/dist/apiServer/deployment/ConfigService.d.ts +6 -0
  14. package/dist/apiServer/deployment/ConfigService.js +17 -1
  15. package/dist/apiServer/deployment/Deploy.js +101 -57
  16. package/dist/apiServer/deployment/DeployKeyWizard.d.ts +2 -0
  17. package/dist/apiServer/deployment/DeployKeyWizard.js +84 -0
  18. package/dist/apiServer/deployment/Deployer.d.ts +1 -0
  19. package/dist/apiServer/deployment/Deployer.js +7 -5
  20. package/dist/apiServer/deployment/DeployerService.d.ts +27 -2
  21. package/dist/apiServer/deployment/DeployerService.js +129 -30
  22. package/dist/apiServer/deployment/HashPassword.js +2 -2
  23. package/dist/apiServer/deployment/MigrateConfigsWizard.js +9 -5
  24. package/dist/apiServer/deployment/ProjectConfigWizard.js +4 -2
  25. package/dist/apiServer/deployment/Restore.js +9 -8
  26. package/dist/apiServer/deployment/SecretsInjector.js +2 -1
  27. package/dist/apiServer/deployment/SetupConfigWizard.js +38 -2
  28. package/dist/apiServer/deployment/Status.js +5 -8
  29. package/dist/apiServer/deployment/Watchdog.js +1 -1
  30. package/dist/apiServer/deployment/Wizards.js +16 -11
  31. package/dist/apiServer/deployment/cli.js +33 -14
  32. package/dist/apiServer/deployment/cliCommon.d.ts +13 -1
  33. package/dist/apiServer/deployment/cliCommon.js +50 -2
  34. package/dist/apiServer/deployment/resolveConfig.d.ts +4 -1
  35. package/dist/apiServer/deployment/resolveConfig.js +23 -2
  36. package/dist/apiServer/external/MicroserviceClient.d.ts +7 -2
  37. package/dist/apiServer/external/MicroserviceClient.js +90 -10
  38. package/dist/apiServer/external/MicroserviceHost.d.ts +35 -8
  39. package/dist/apiServer/external/MicroserviceHost.js +148 -55
  40. package/dist/apiServer/helper/AppDataPath.d.ts +9 -0
  41. package/dist/apiServer/helper/AppDataPath.js +81 -0
  42. package/dist/apiServer/helper/ClientIp.d.ts +1 -0
  43. package/dist/apiServer/helper/ClientIp.js +5 -0
  44. package/dist/apiServer/helper/Trace.d.ts +8 -0
  45. package/dist/apiServer/helper/Trace.js +30 -0
  46. package/dist/apiServer/helper/Validator.d.ts +1 -0
  47. package/dist/apiServer/helper/Validator.js +21 -18
  48. package/dist/apiServer/http/Http.d.ts +1 -0
  49. package/dist/apiServer/http/Http.js +5 -2
  50. package/dist/apiServer/interceptors/InterceptorSignedAuth.d.ts +40 -0
  51. package/dist/apiServer/interceptors/InterceptorSignedAuth.js +150 -0
  52. package/dist/apiServer/monitor/MonitorAuth.js +8 -5
  53. package/dist/apiServer/monitor/ThreatMonitor.d.ts +8 -0
  54. package/dist/apiServer/monitor/ThreatMonitor.js +87 -1
  55. package/dist/apiServer/monitor/index.html +66 -66
  56. package/dist/apiServer/security/BlockedIps.js +10 -14
  57. package/dist/apiServer/structures/Interfaces.d.ts +2 -0
  58. package/dist/index.d.ts +3 -0
  59. package/dist/index.js +5 -1
  60. package/package.json +21 -6
  61. package/bluegreen.help.md +0 -392
  62. package/cocroach.help.md +0 -191
  63. package/connections.help.md +0 -0
  64. package/monitoring.help.md +0 -350
package/CHANGELOG.md ADDED
@@ -0,0 +1,86 @@
1
+ # Changelog
2
+
3
+ ## 6.0.13 — 2026-11-19
4
+
5
+ ### Before you upgrade
6
+
7
+ These change behaviour. Check each against your project.
8
+
9
+ - **Outgoing HTTP is no longer retried by default.** `Http` used to retry failed requests on its own,
10
+ which could send a payment twice. Retries are now off unless a call asks for them:
11
+ `{ retry: { enabled: true } }`. Multipart requests are never retried.
12
+ - **Validation bounds that were ignored are now enforced.** Two bugs are fixed:
13
+ - Bounds given as separate keys — `$__limit_min: 10`, `$__limit_max: 100` — were never applied.
14
+ They now are.
15
+ - A bound of `0` was treated as "no bound": `$__n: { min: 0 }` let `-1` through. It no longer does.
16
+
17
+ Requests that passed before can now get a 400. Review every `$__*_min`, `$__*_max` and `min: 0` /
18
+ `max: 0` in your models before upgrading.
19
+ - **Every response carries a trace id**: the `X-Request-Id` header and `traceId` in the JSON envelope.
20
+ Clients that compare the whole response body need to allow the new field.
21
+ - **Data now lives in `/var/bmfk/<project>/`** (see the README, "Data folder"): metrics history,
22
+ threats, blocked IPs, monitor 2FA enrollments and deployer secrets. Create the root once on each
23
+ server: `sudo mkdir /var/bmfk && sudo chown <app user> /var/bmfk`. Without it the app falls back to
24
+ a folder beside the code and says so at startup. Explicit settings (`metricsDir`, `blockedIps.file`,
25
+ `monitorAuthDir`, `secrets_dir`) still win, and a `blocked-ips` file at the old place keeps being used.
26
+ - **The deployer renames the deployed app.** On every deploy it writes its project name into the
27
+ deployed `package.json` and `package-lock.json` `"name"`. Your repository is not changed. If your code
28
+ reads `package.json` `"name"` at runtime, it now gets the deployer's project name.
29
+ - **Project names are validated.** A project config whose `name` is not lowercase letters, digits,
30
+ `.`, `_` and `-` (starting with a letter or digit, up to 100 characters) is ignored by the deployer,
31
+ with an error in its log. Run `npx bmfk migrate-configs` to list such configs before upgrading the
32
+ deployer.
33
+ - **`bundle` needs its tools installed in the project**: `npm i -D esbuild @babel/parser`. They are no
34
+ longer dependencies of the library (see Dependencies).
35
+
36
+ ### Added
37
+
38
+ - **Signed microservice calls.** Each service has its own Ed25519 key pair (`npx bmfk ms-key`). The
39
+ caller signs every request, and the host signs every answer, bound to that request. Hosts list their
40
+ callers in `clients` with an allow-list of `requests`. An operation id (`op`) is kept across retries,
41
+ so the host runs an operation once, and reusing an `op` for a different request is refused.
42
+ `MicroserviceHost.currentCall()` tells a handler who is calling. Signed calls go over https only
43
+ (plain http only to localhost), and errors are returned without stack traces.
44
+ - **Request tracing.** Every request gets a trace id. It is in the response, in `req.traceId`, in every
45
+ log line written while handling the request, in the incoming and outgoing request logs, and in signed
46
+ microservice calls, where the host takes over the caller's id. An incoming `X-Request-Id` is accepted
47
+ only from a trusted proxy. `Trace` is exported.
48
+ - **Monitor: trace ids.** The Log, Net log and Outgoing journals have a TRACE column and search by
49
+ trace id. The detail view links to the same trace in the other journals. Monitor UI 1.0.30.
50
+ - **Metrics history survives restarts and deploys**, on by default. Only the live process writes it:
51
+ a blue-green standby and pm2 workers other than instance 0 keep counting in memory only. A slot that
52
+ becomes live first loads what the other slot wrote. `metricsDir: false` keeps metrics in memory.
53
+ - **Threats survive restarts and deploys**: `/var/bmfk/<project>/threats.json`, saved every minute and
54
+ on shutdown, by the live process only. It holds addresses, user agents and URLs, never request bodies.
55
+ - **`omitDev` in a project config**: install with `npm ci --omit=dev`, so devDependencies never reach
56
+ the server. Off by default. Check first that `npm start` and `npm run migrate` need nothing from
57
+ devDependencies.
58
+ - **`bmfk` CLI.** The command is now `bmfk`. `badmfck` still works, so existing scripts need no change.
59
+ - **Clearer deploy output**: one line per step with its duration, and the build's own output shown
60
+ only when the build fails.
61
+ - **Test suite**: `npm test` (node:test), 81 tests.
62
+
63
+ ### Changed
64
+
65
+ - `resultModel` on an endpoint is documented as what it is: documentation only. It does not validate
66
+ or filter the response.
67
+ - Deployer health checks (liveness, readiness) keep retrying explicitly, since `Http` no longer does it
68
+ by default.
69
+
70
+ ### Fixed
71
+
72
+ - Validation: `$__X_min` / `$__X_max` were never applied, and a bound of 0 was ignored (see above).
73
+ - v1 microservice calls: the payload is decrypted before the replay-cache lookup.
74
+
75
+ ### Deprecated
76
+
77
+ - Microservice `securityKey` (v1, shared AES key): still accepted while services move to signed calls.
78
+ It will be removed.
79
+ - Microservice `password`: never used. Remove it from configs.
80
+
81
+ ### Dependencies
82
+
83
+ - `npm audit`: 0 vulnerabilities. `undici` ^7.30.2.
84
+ - `esbuild` and `@babel/parser` are optional peer dependencies now, loaded only by `bundle`. Before,
85
+ every project and every server installed them, esbuild with a platform binary of about 10 MB.
86
+ - `@types/mysql` removed.