iobroker.eos-admin 8.0.0 → 8.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 (159) hide show
  1. package/NEXOWATT_EOS_BUILD_INFO.json +7 -6
  2. package/NEXOWATT_EOS_PREBUILT_MANIFEST.json +133 -51
  3. package/START_HERE_8.0.1.md +36 -0
  4. package/adminWww/.vite/manifest.json +39 -39
  5. package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +107 -107
  6. package/adminWww/assets/{AdapterUpdateDialog-B3y8RL_5.js → AdapterUpdateDialog-D3y2bGHM.js} +1 -1
  7. package/adminWww/assets/{Adapters-BDxfhfGe.js → Adapters-WMGNQt7g.js} +1 -1
  8. package/adminWww/assets/{ConfigManager-CFuOc_kb.js → ConfigManager-BMdQoiCg.js} +1 -1
  9. package/adminWww/assets/{Enums-CSzSzWm7.js → Enums-CHm2sGa-.js} +1 -1
  10. package/adminWww/assets/{Fields-DnckPMA8.js → Fields-Df7Llf6U.js} +1 -1
  11. package/adminWww/assets/{Files-CwUHx0pF.js → Files-Bwbw17Fb.js} +1 -1
  12. package/adminWww/assets/{Hosts-QkyuASJy.js → Hosts-BR0g-Wxo.js} +1 -1
  13. package/adminWww/assets/{Instances-BaWBemTT.js → Instances-BKydFSdw.js} +1 -1
  14. package/adminWww/assets/{Intro-DsfrPrWv.js → Intro-Dt2GzmtW.js} +1 -1
  15. package/adminWww/assets/{Logs-Cngy2Opt.js → Logs-hbcdBDN3.js} +1 -1
  16. package/adminWww/assets/{Objects-DY8KS7zK.js → Objects-HPx0yuOk.js} +1 -1
  17. package/adminWww/assets/{Overview-WwP6FjK-.js → Overview-CDvnM655.js} +1 -1
  18. package/adminWww/assets/{State-vP1o2BCL.js → State-Cc-tyuqB.js} +1 -1
  19. package/adminWww/assets/{UsedResources-CMTzFOX3.js → UsedResources-BIdU7UPm.js} +1 -1
  20. package/adminWww/assets/{Users-BjTGOjzL.js → Users-BruHA-yU.js} +1 -1
  21. package/adminWww/assets/{bootstrap-Bs4TZ7iA.js → bootstrap-D-7xcwTc.js} +3 -3
  22. package/adminWww/assets/{hostInit-2xIZYDSq.js → hostInit-huY-0clu.js} +1 -1
  23. package/adminWww/assets/{icons-material-BLgrEUSv.js → icons-material-Bu1f45BT.js} +1 -1
  24. package/adminWww/assets/{index-BZifaJHi.js → index-D8vmzGp8.js} +2 -2
  25. package/adminWww/assets/{installSVGRenderer-Pe6-VnD2.js → installSVGRenderer-BkdptYag.js} +1 -1
  26. package/adminWww/assets/{mf-entry-bootstrap-0-a6a54377.js → mf-entry-bootstrap-0-f6098d8b.js} +2 -2
  27. package/adminWww/index.html +21 -21
  28. package/adminWww/mf-manifest.json +1 -1
  29. package/adminWww/mf-stats.json +1 -1
  30. package/adminWww/{remoteEntry-eos-8.0.0.js → remoteEntry-eos-8.0.1.js} +1 -1
  31. package/adminWww/remoteEntry.js +1 -1
  32. package/build/lib/eosSessionSecurity.js +12 -4
  33. package/build/lib/eosSessionSecurity.js.map +1 -1
  34. package/build/lib/vendor/webserver/LICENSE +21 -0
  35. package/build/lib/vendor/webserver/README.md +506 -0
  36. package/build/lib/vendor/webserver/build/index.d.ts +9 -0
  37. package/build/lib/vendor/webserver/build/index.js +42 -0
  38. package/build/lib/vendor/webserver/build/index.js.map +1 -0
  39. package/build/lib/vendor/webserver/build/lib/acmeChallenge.d.ts +65 -0
  40. package/build/lib/vendor/webserver/build/lib/acmeChallenge.js +149 -0
  41. package/build/lib/vendor/webserver/build/lib/acmeChallenge.js.map +1 -0
  42. package/build/lib/vendor/webserver/build/lib/certificateManager.d.ts +60 -0
  43. package/build/lib/vendor/webserver/build/lib/certificateManager.js +128 -0
  44. package/build/lib/vendor/webserver/build/lib/certificateManager.js.map +1 -0
  45. package/build/lib/vendor/webserver/build/lib/http2Compat.d.ts +21 -0
  46. package/build/lib/vendor/webserver/build/lib/http2Compat.js +109 -0
  47. package/build/lib/vendor/webserver/build/lib/http2Compat.js.map +1 -0
  48. package/build/lib/vendor/webserver/build/lib/oauth2-authcode.d.ts +167 -0
  49. package/build/lib/vendor/webserver/build/lib/oauth2-authcode.js +619 -0
  50. package/build/lib/vendor/webserver/build/lib/oauth2-authcode.js.map +1 -0
  51. package/build/lib/vendor/webserver/build/lib/oauth2-clients.d.ts +92 -0
  52. package/build/lib/vendor/webserver/build/lib/oauth2-clients.js +230 -0
  53. package/build/lib/vendor/webserver/build/lib/oauth2-clients.js.map +1 -0
  54. package/build/lib/vendor/webserver/build/lib/oauth2-model.d.ts +84 -0
  55. package/build/lib/vendor/webserver/build/lib/oauth2-model.js +388 -0
  56. package/build/lib/vendor/webserver/build/lib/oauth2-model.js.map +1 -0
  57. package/build/lib/vendor/webserver/build/lib/oauth2.d.ts +75 -0
  58. package/build/lib/vendor/webserver/build/lib/oauth2.js +625 -0
  59. package/build/lib/vendor/webserver/build/lib/oauth2.js.map +1 -0
  60. package/build/lib/vendor/webserver/build/lib/securityChecker.d.ts +6 -0
  61. package/build/lib/vendor/webserver/build/lib/securityChecker.js +96 -0
  62. package/build/lib/vendor/webserver/build/lib/securityChecker.js.map +1 -0
  63. package/build/lib/vendor/webserver/build/lib/usedResources.d.ts +62 -0
  64. package/build/lib/vendor/webserver/build/lib/usedResources.js +231 -0
  65. package/build/lib/vendor/webserver/build/lib/usedResources.js.map +1 -0
  66. package/build/lib/vendor/webserver/build/lib/utils.d.ts +35 -0
  67. package/build/lib/vendor/webserver/build/lib/utils.js +110 -0
  68. package/build/lib/vendor/webserver/build/lib/utils.js.map +1 -0
  69. package/build/lib/vendor/webserver/build/lib/webServer.d.ts +164 -0
  70. package/build/lib/vendor/webserver/build/lib/webServer.js +454 -0
  71. package/build/lib/vendor/webserver/build/lib/webServer.js.map +1 -0
  72. package/build/lib/vendor/webserver/package.json +63 -0
  73. package/build/lib/web.js +1 -1
  74. package/build/lib/web.js.map +1 -1
  75. package/docs/ADMIN8_MIGRATION_8.0.0_DE.md +2 -0
  76. package/docs/cra/CRA_IEC_GAP_ANALYSIS_2026-09-30.md +5 -0
  77. package/docs/security/admin8-2026-11-04/development-1.log +3 -3
  78. package/docs/security/admin8-2026-11-04/development-2.log +248 -233
  79. package/docs/security/admin8-2026-11-05/copy-update/evidence-sha256.json +0 -5
  80. package/docs/security/admin8-2026-11-05/login-fix/BACKEND_DIAGNOSE_DE.md +48 -0
  81. package/docs/security/admin8-2026-11-05/login-fix/REPORT_DE.md +47 -0
  82. package/docs/security/admin8-2026-11-05/login-fix/REVIEW_DE.md +7 -0
  83. package/docs/security/admin8-2026-11-05/login-fix/controller-adapter-api.ts.txt +122 -0
  84. package/docs/security/admin8-2026-11-05/login-fix/controller-file-view.ts.txt +75 -0
  85. package/docs/security/admin8-2026-11-05/login-fix/controller-redis-view.ts.txt +471 -0
  86. package/docs/security/admin8-2026-11-05/login-fix/dependency/LICENSE-webserver-3.4.0 +21 -0
  87. package/docs/security/admin8-2026-11-05/login-fix/dependency/REPORT_DE.md +41 -0
  88. package/docs/security/admin8-2026-11-05/login-fix/dependency/evidence-sha256.json +116 -0
  89. package/docs/security/admin8-2026-11-05/login-fix/dependency/http-consumer-check.cjs +58 -0
  90. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/README_DE.md +9 -0
  91. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/REJECTED-webserver-3.4.0-eos-oauth.provenance.json +263 -0
  92. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/REJECTED-webserver-3.4.0-eos-oauth.tgz +0 -0
  93. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/admission.log +16 -0
  94. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-audit-stderr.log +1 -0
  95. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-audit.json +22 -0
  96. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-fixture-1.0.0.tgz +0 -0
  97. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-fixture-package.json +11 -0
  98. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-npm10-package-lock.json +387 -0
  99. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/consumer-npm11-package-lock.json +387 -0
  100. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/evidence-sha256.json +85 -0
  101. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/http-consumer-npm10-node22.json +11 -0
  102. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/http-consumer-npm11-node24.json +11 -0
  103. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/local-tests.json +38 -0
  104. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/tests-node22.log +168 -0
  105. package/docs/security/admin8-2026-11-05/login-fix/dependency/rejected-file-dependency/tests-node24.log +36 -0
  106. package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests-node22.log +224 -0
  107. package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests-node24.log +42 -0
  108. package/docs/security/admin8-2026-11-05/login-fix/dependency/source-vendor-tests.json +31 -0
  109. package/docs/security/admin8-2026-11-05/login-fix/dependency/webserver-3.4.0-upstream.tgz +0 -0
  110. package/docs/security/admin8-2026-11-05/login-fix/eos-session-8.0.0.js.txt +385 -0
  111. package/docs/security/admin8-2026-11-05/login-fix/evidence-sha256.json +59 -0
  112. package/docs/security/admin8-2026-11-05/login-fix/path-budget.json +6 -0
  113. package/docs/security/admin8-2026-11-05/login-fix/provenance.json +51 -0
  114. package/docs/security/admin8-2026-11-05/login-fix/release/admission.log +21 -0
  115. package/docs/security/admin8-2026-11-05/login-fix/release/archive-scan.json +13 -0
  116. package/docs/security/admin8-2026-11-05/login-fix/release/artifacts.log +6 -0
  117. package/docs/security/admin8-2026-11-05/login-fix/release/backend-build.log +5 -0
  118. package/docs/security/admin8-2026-11-05/login-fix/release/consumer-package-lock.json +3258 -0
  119. package/docs/security/admin8-2026-11-05/login-fix/release/copy-update-journal.json +165 -0
  120. package/docs/security/admin8-2026-11-05/login-fix/release/development.log +365 -0
  121. package/docs/security/admin8-2026-11-05/login-fix/release/frontend-build.log +149 -0
  122. package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-audit.json +22 -0
  123. package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-audit.stderr +2 -0
  124. package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-final-install-node22.log +9 -0
  125. package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node22.json +15 -0
  126. package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node22.stderr +2 -0
  127. package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node24.json +15 -0
  128. package/docs/security/admin8-2026-11-05/login-fix/release/full-consumer-http-node24.stderr +0 -0
  129. package/docs/security/admin8-2026-11-05/login-fix/release/inventory.log +8 -0
  130. package/docs/security/admin8-2026-11-05/login-fix/release/npm-pack-final.json +7809 -0
  131. package/docs/security/admin8-2026-11-05/login-fix/release/npm-pack-final.stderr +6 -0
  132. package/docs/security/admin8-2026-11-05/login-fix/release/overlay-final-publish-node22.json +10213 -0
  133. package/docs/security/admin8-2026-11-05/login-fix/release/overlay-final-publish-node22.stderr +282 -0
  134. package/docs/security/admin8-2026-11-05/login-fix/release/pipeline.json +72 -0
  135. package/docs/security/admin8-2026-11-05/login-fix/release/seal.log +6 -0
  136. package/docs/security/admin8-2026-11-05/login-fix/release/vendor-final-review-node24.log +18 -0
  137. package/docs/security/admin8-2026-11-05/login-fix/reproduce.cjs +79 -0
  138. package/docs/security/admin8-2026-11-05/login-fix/reproduction.json +80 -0
  139. package/docs/security/admin8-2026-11-05/login-fix/upstream-LICENSE.txt +22 -0
  140. package/docs/security/admin8-2026-11-05/login-fix/validation.json +85 -0
  141. package/docs/third-party/admin8/NOTICE-PROVENANCE.json +3 -3
  142. package/io-package.json +9 -10
  143. package/package.json +9 -4
  144. package/release-manifests/admin8-development-validation.json +114 -31
  145. package/reports/security/artifact-inventory.json +462 -227
  146. package/reports/security/inventory-summary.json +39 -17
  147. package/reports/security/sbom-backend-lock.cdx.json +108 -111
  148. package/reports/security/sbom-frontend-lock.cdx.json +5 -5
  149. package/reports/security/source-runtime-manifest.json +455 -65
  150. package/tools/nexowatt-artifact-inventory.cjs +8 -1
  151. package/tools/nexowatt-installer-ems-selftest.cjs +1 -1
  152. package/tools/nexowatt-lock-provenance-check.cjs +8 -3
  153. package/tools/nexowatt-repair-lock-metadata.cjs +3 -3
  154. package/tools/nexowatt-security-inventory.cjs +22 -1
  155. package/tools/nexowatt-user-area-selftest.cjs +1 -1
  156. package/tools/nexowatt-v7109-clean-core-selftest.cjs +1 -1
  157. package/tools/nexowatt-vendored-webserver.cjs +69 -0
  158. package/tools/vendor/eos-retired-release-files.json +73 -1
  159. package/tools/vendor/webserver-3.4.0-source.provenance.json +244 -0
@@ -0,0 +1,92 @@
1
+ /** Client metadata as sent by a client to the registration endpoint (RFC 7591 §2). */
2
+ export interface OAuth2ClientMetadata {
3
+ /** Human-readable name, shown to the user on the consent page. */
4
+ client_name?: string;
5
+ /** Allowed callback URIs. Compared byte-for-byte at the authorization endpoint. */
6
+ redirect_uris: string[];
7
+ grant_types?: string[];
8
+ response_types?: string[];
9
+ token_endpoint_auth_method?: string;
10
+ scope?: string;
11
+ client_uri?: string;
12
+ logo_uri?: string;
13
+ software_id?: string;
14
+ software_version?: string;
15
+ }
16
+ /** A registered OAuth2 client as stored by {@link OAuth2ClientStore}. */
17
+ export interface OAuth2Client extends OAuth2ClientMetadata {
18
+ client_id: string;
19
+ /** Issue time in **seconds** since the epoch (RFC 7591 uses seconds, not milliseconds). */
20
+ client_id_issued_at: number;
21
+ grant_types: string[];
22
+ response_types: string[];
23
+ /** We only support public clients with PKCE; there are no client secrets to protect. */
24
+ token_endpoint_auth_method: 'none';
25
+ /** True when the client registered itself dynamically instead of being configured by hand. */
26
+ dynamic: boolean;
27
+ }
28
+ /** Error carrying an RFC 7591 §3.2.2 error code, so the registration endpoint can report it verbatim. */
29
+ export declare class ClientRegistrationError extends Error {
30
+ /** RFC 7591 error code, e.g. `invalid_redirect_uri` or `invalid_client_metadata`. */
31
+ readonly code: 'invalid_redirect_uri' | 'invalid_client_metadata';
32
+ constructor(code: 'invalid_redirect_uri' | 'invalid_client_metadata', message: string);
33
+ }
34
+ /**
35
+ * Persistent store for OAuth2 clients.
36
+ *
37
+ * Clients must survive an adapter restart, so they are kept as ioBroker objects under
38
+ * `<adapter.namespace>.oauth.clients.<client_id>` rather than in the (expiring) session storage.
39
+ * Lookups are cached in memory; the cache is only ever filled from the objects database, so a
40
+ * client registered by another instance is still found after a cache miss.
41
+ */
42
+ export declare class OAuth2ClientStore {
43
+ private readonly adapter;
44
+ private readonly maxClients;
45
+ private readonly cache;
46
+ /**
47
+ * @param adapter ioBroker adapter used for object access and logging
48
+ * @param options Options
49
+ * @param options.maxClients Maximum number of stored clients before the oldest dynamic ones are pruned
50
+ */
51
+ constructor(adapter: ioBroker.Adapter, options?: {
52
+ maxClients?: number;
53
+ });
54
+ /** Object ID prefix under which all clients of this instance live. */
55
+ private get folder();
56
+ /**
57
+ * Look up a client by its ID.
58
+ *
59
+ * @param clientId The `client_id` to resolve
60
+ * @returns The stored client, or `null` when it is unknown
61
+ */
62
+ get(clientId: string): Promise<OAuth2Client | null>;
63
+ /** List all stored clients, oldest registration first. */
64
+ list(): Promise<OAuth2Client[]>;
65
+ /**
66
+ * Register a new client from the metadata a client sent to the registration endpoint.
67
+ *
68
+ * The parameter is deliberately typed as partial: it carries unvalidated data straight off the
69
+ * network, and every field is checked here before anything is stored.
70
+ *
71
+ * @param metadata Client metadata (RFC 7591 §2)
72
+ * @param options Options
73
+ * @param options.dynamic Whether this registration came in via the dynamic registration endpoint
74
+ * @returns The stored client, including the generated `client_id`
75
+ * @throws ClientRegistrationError when the metadata is not acceptable
76
+ */
77
+ register(metadata: Partial<OAuth2ClientMetadata>, options?: {
78
+ dynamic?: boolean;
79
+ }): Promise<OAuth2Client>;
80
+ /**
81
+ * Remove a client. Already issued access tokens stay valid until they expire.
82
+ *
83
+ * @param clientId The `client_id` to remove
84
+ */
85
+ delete(clientId: string): Promise<void>;
86
+ /**
87
+ * Drop the oldest dynamically registered clients once the store grew past its limit. Without this
88
+ * every re-added connector would leave a record behind forever. Clients registered by hand are
89
+ * never pruned.
90
+ */
91
+ private prune;
92
+ }
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuth2ClientStore = exports.ClientRegistrationError = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ /**
6
+ * Hosts for which a plain `http:` redirect URI is acceptable. Native apps receive their callback on
7
+ * an ephemeral loopback port (RFC 8252 §7.3), so requiring TLS there would be pointless.
8
+ */
9
+ const LOOPBACK_HOSTS = ['127.0.0.1', '::1', '[::1]', 'localhost'];
10
+ /** URI schemes that must never be accepted as a redirect target — they execute in the browser. */
11
+ const FORBIDDEN_SCHEMES = ['javascript:', 'data:', 'vbscript:', 'file:', 'blob:'];
12
+ /** How many clients we keep before the oldest dynamically registered ones are pruned. */
13
+ const DEFAULT_MAX_CLIENTS = 100;
14
+ /** Error carrying an RFC 7591 §3.2.2 error code, so the registration endpoint can report it verbatim. */
15
+ class ClientRegistrationError extends Error {
16
+ constructor(code, message) {
17
+ super(message);
18
+ this.code = code;
19
+ this.name = 'ClientRegistrationError';
20
+ }
21
+ }
22
+ exports.ClientRegistrationError = ClientRegistrationError;
23
+ /**
24
+ * Validate a single redirect URI.
25
+ *
26
+ * Accepted are `https:` URIs, `http:` URIs pointing at the loopback interface, and private-use
27
+ * schemes such as `myapp://callback` used by native applications. Fragments are forbidden because
28
+ * the authorization response appends its own query parameters.
29
+ *
30
+ * @param uri The redirect URI to check
31
+ * @returns An error description, or `null` when the URI is acceptable
32
+ */
33
+ function checkRedirectUri(uri) {
34
+ if (typeof uri !== 'string' || !uri) {
35
+ return 'redirect_uris must contain non-empty strings';
36
+ }
37
+ let parsed;
38
+ try {
39
+ parsed = new URL(uri);
40
+ }
41
+ catch (_a) {
42
+ return `"${uri}" is not an absolute URI`;
43
+ }
44
+ if (parsed.hash) {
45
+ return `"${uri}" must not contain a fragment`;
46
+ }
47
+ const scheme = parsed.protocol.toLowerCase();
48
+ if (FORBIDDEN_SCHEMES.includes(scheme)) {
49
+ return `"${uri}" uses a forbidden scheme`;
50
+ }
51
+ if (scheme === 'http:') {
52
+ // `URL` keeps IPv6 hosts in brackets, so compare against both spellings.
53
+ if (!LOOPBACK_HOSTS.includes(parsed.hostname.toLowerCase())) {
54
+ return `"${uri}" must use https: — plain http: is only allowed for loopback addresses`;
55
+ }
56
+ }
57
+ return null;
58
+ }
59
+ /**
60
+ * Persistent store for OAuth2 clients.
61
+ *
62
+ * Clients must survive an adapter restart, so they are kept as ioBroker objects under
63
+ * `<adapter.namespace>.oauth.clients.<client_id>` rather than in the (expiring) session storage.
64
+ * Lookups are cached in memory; the cache is only ever filled from the objects database, so a
65
+ * client registered by another instance is still found after a cache miss.
66
+ */
67
+ class OAuth2ClientStore {
68
+ /**
69
+ * @param adapter ioBroker adapter used for object access and logging
70
+ * @param options Options
71
+ * @param options.maxClients Maximum number of stored clients before the oldest dynamic ones are pruned
72
+ */
73
+ constructor(adapter, options) {
74
+ this.cache = new Map();
75
+ this.adapter = adapter;
76
+ this.maxClients = (options === null || options === void 0 ? void 0 : options.maxClients) || DEFAULT_MAX_CLIENTS;
77
+ }
78
+ /** Object ID prefix under which all clients of this instance live. */
79
+ get folder() {
80
+ return `${this.adapter.namespace}.oauth.clients`;
81
+ }
82
+ /**
83
+ * Look up a client by its ID.
84
+ *
85
+ * @param clientId The `client_id` to resolve
86
+ * @returns The stored client, or `null` when it is unknown
87
+ */
88
+ async get(clientId) {
89
+ var _a;
90
+ if (!clientId || !/^[a-zA-Z0-9_-]+$/.test(clientId)) {
91
+ // Reject anything that could escape the object ID namespace before touching the database.
92
+ return null;
93
+ }
94
+ const cached = this.cache.get(clientId);
95
+ if (cached) {
96
+ return cached;
97
+ }
98
+ const obj = await this.adapter.getForeignObjectAsync(`${this.folder}.${clientId}`);
99
+ const client = (_a = obj === null || obj === void 0 ? void 0 : obj.native) === null || _a === void 0 ? void 0 : _a.client;
100
+ if (!client) {
101
+ return null;
102
+ }
103
+ this.cache.set(clientId, client);
104
+ return client;
105
+ }
106
+ /** List all stored clients, oldest registration first. */
107
+ async list() {
108
+ var _a, _b;
109
+ // Query by ID range instead of by object view: the range query does not depend on a view for
110
+ // the `config` object type existing in the objects database.
111
+ const res = await this.adapter.getObjectListAsync({
112
+ startkey: `${this.folder}.`,
113
+ endkey: `${this.folder}.香`,
114
+ });
115
+ const clients = [];
116
+ for (const row of (res === null || res === void 0 ? void 0 : res.rows) || []) {
117
+ const client = (_b = (_a = row.value) === null || _a === void 0 ? void 0 : _a.native) === null || _b === void 0 ? void 0 : _b.client;
118
+ if (client === null || client === void 0 ? void 0 : client.client_id) {
119
+ clients.push(client);
120
+ }
121
+ }
122
+ return clients.sort((a, b) => a.client_id_issued_at - b.client_id_issued_at);
123
+ }
124
+ /**
125
+ * Register a new client from the metadata a client sent to the registration endpoint.
126
+ *
127
+ * The parameter is deliberately typed as partial: it carries unvalidated data straight off the
128
+ * network, and every field is checked here before anything is stored.
129
+ *
130
+ * @param metadata Client metadata (RFC 7591 §2)
131
+ * @param options Options
132
+ * @param options.dynamic Whether this registration came in via the dynamic registration endpoint
133
+ * @returns The stored client, including the generated `client_id`
134
+ * @throws ClientRegistrationError when the metadata is not acceptable
135
+ */
136
+ async register(metadata, options) {
137
+ var _a, _b;
138
+ const redirectUris = metadata === null || metadata === void 0 ? void 0 : metadata.redirect_uris;
139
+ if (!Array.isArray(redirectUris) || !redirectUris.length) {
140
+ throw new ClientRegistrationError('invalid_redirect_uri', 'redirect_uris must be a non-empty array');
141
+ }
142
+ if (redirectUris.length > 10) {
143
+ throw new ClientRegistrationError('invalid_redirect_uri', 'redirect_uris must not contain more than 10 entries');
144
+ }
145
+ for (const uri of redirectUris) {
146
+ const error = checkRedirectUri(uri);
147
+ if (error) {
148
+ throw new ClientRegistrationError('invalid_redirect_uri', error);
149
+ }
150
+ }
151
+ // We are a public-client-only authorization server: PKCE replaces the client secret, so any
152
+ // other authentication method would be a promise we do not keep.
153
+ const authMethod = metadata.token_endpoint_auth_method || 'none';
154
+ if (authMethod !== 'none') {
155
+ throw new ClientRegistrationError('invalid_client_metadata', `token_endpoint_auth_method "${authMethod}" is not supported, only "none" (public client with PKCE)`);
156
+ }
157
+ const grantTypes = ((_a = metadata.grant_types) === null || _a === void 0 ? void 0 : _a.length)
158
+ ? metadata.grant_types
159
+ : ['authorization_code', 'refresh_token'];
160
+ const unsupported = grantTypes.filter(g => g !== 'authorization_code' && g !== 'refresh_token');
161
+ if (unsupported.length) {
162
+ throw new ClientRegistrationError('invalid_client_metadata', `unsupported grant_types: ${unsupported.join(', ')}`);
163
+ }
164
+ const responseTypes = ((_b = metadata.response_types) === null || _b === void 0 ? void 0 : _b.length) ? metadata.response_types : ['code'];
165
+ if (responseTypes.some(t => t !== 'code')) {
166
+ throw new ClientRegistrationError('invalid_client_metadata', 'only the "code" response type is supported');
167
+ }
168
+ const client = {
169
+ client_id: (0, node_crypto_1.randomBytes)(16).toString('hex'),
170
+ client_id_issued_at: Math.floor(Date.now() / 1000),
171
+ client_name: typeof metadata.client_name === 'string' ? metadata.client_name.slice(0, 200) : undefined,
172
+ redirect_uris: redirectUris,
173
+ grant_types: grantTypes,
174
+ response_types: responseTypes,
175
+ token_endpoint_auth_method: 'none',
176
+ scope: typeof metadata.scope === 'string' ? metadata.scope.slice(0, 500) : undefined,
177
+ client_uri: typeof metadata.client_uri === 'string' ? metadata.client_uri : undefined,
178
+ logo_uri: typeof metadata.logo_uri === 'string' ? metadata.logo_uri : undefined,
179
+ software_id: typeof metadata.software_id === 'string' ? metadata.software_id : undefined,
180
+ software_version: typeof metadata.software_version === 'string' ? metadata.software_version : undefined,
181
+ dynamic: (options === null || options === void 0 ? void 0 : options.dynamic) !== false,
182
+ };
183
+ await this.adapter.setForeignObjectAsync(`${this.folder}.${client.client_id}`, {
184
+ type: 'config',
185
+ common: {
186
+ name: client.client_name || client.client_id,
187
+ },
188
+ native: { client },
189
+ });
190
+ this.cache.set(client.client_id, client);
191
+ await this.prune();
192
+ return client;
193
+ }
194
+ /**
195
+ * Remove a client. Already issued access tokens stay valid until they expire.
196
+ *
197
+ * @param clientId The `client_id` to remove
198
+ */
199
+ async delete(clientId) {
200
+ if (!clientId || !/^[a-zA-Z0-9_-]+$/.test(clientId)) {
201
+ return;
202
+ }
203
+ this.cache.delete(clientId);
204
+ try {
205
+ await this.adapter.delForeignObjectAsync(`${this.folder}.${clientId}`);
206
+ }
207
+ catch (e) {
208
+ this.adapter.log.warn(`Cannot delete OAuth2 client "${clientId}": ${e.message}`);
209
+ }
210
+ }
211
+ /**
212
+ * Drop the oldest dynamically registered clients once the store grew past its limit. Without this
213
+ * every re-added connector would leave a record behind forever. Clients registered by hand are
214
+ * never pruned.
215
+ */
216
+ async prune() {
217
+ const clients = await this.list();
218
+ if (clients.length <= this.maxClients) {
219
+ return;
220
+ }
221
+ const removable = clients.filter(c => c.dynamic);
222
+ const excess = clients.length - this.maxClients;
223
+ for (const client of removable.slice(0, excess)) {
224
+ this.adapter.log.warn(`Removing oldest dynamically registered OAuth2 client "${client.client_name || client.client_id}" — the limit of ${this.maxClients} clients was reached`);
225
+ await this.delete(client.client_id);
226
+ }
227
+ }
228
+ }
229
+ exports.OAuth2ClientStore = OAuth2ClientStore;
230
+ //# sourceMappingURL=oauth2-clients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth2-clients.js","sourceRoot":"","sources":["../../src/lib/oauth2-clients.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAE1C;;;GAGG;AACH,MAAM,cAA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C,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;QAChD,KAAK,MAAM,MAAM,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;YAC9C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CACjB,yDAAyD,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,SAAS,oBAAoB,IAAI,CAAC,UAAU,sBAAsB,CAC3J,CAAC;YACF,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC;IACL,CAAC;CACJ;AA/LD,8CA+LC"}
@@ -0,0 +1,84 @@
1
+ import { type Client, type Falsey, type RefreshTokenModel, type Token, type PartialToken, type User, type RefreshToken, type Scope } from 'oauth2-server';
2
+ import type { NextFunction, Request, Response } from 'express';
3
+ /** Extra properties bound to a token beyond the user it belongs to. */
4
+ export interface TokenBinding {
5
+ /** ID of the OAuth2 client the token is issued to */
6
+ clientId?: string;
7
+ /** Resource the token is valid for (RFC 8707) */
8
+ aud?: string;
9
+ /** Granted scope */
10
+ scope?: string;
11
+ }
12
+ export declare class OAuth2Model implements RefreshTokenModel {
13
+ private readonly accessTokenLifetime;
14
+ private readonly refreshTokenLifetime;
15
+ private readonly noBasicAuth;
16
+ private adapter;
17
+ private bruteForce;
18
+ /**
19
+ * Create an OAuth2model
20
+ *
21
+ * @param adapter ioBroker adapter
22
+ * @param options Options
23
+ * @param options.accessLifetime Access token expiration in seconds
24
+ * @param options.refreshLifeTime Refresh token expiration in seconds
25
+ * @param options.noBasicAuth Do not allow basic authentication
26
+ */
27
+ constructor(adapter: ioBroker.Adapter, options?: {
28
+ accessLifetime?: number;
29
+ refreshLifeTime?: number;
30
+ noBasicAuth?: boolean;
31
+ });
32
+ getAccessToken: (bearerToken: string) => Promise<Token | Falsey>;
33
+ /**
34
+ * Read the stored record of an access token, including the client and resource it is bound to.
35
+ * Resource servers use this to verify that a token was actually issued for them.
36
+ *
37
+ * @param bearerToken The access token to look up
38
+ */
39
+ getTokenInfo: (bearerToken: string) => Promise<ioBroker.Session | null>;
40
+ /**
41
+ * Get client.
42
+ */
43
+ getClient: (_clientId: string, _clientSecret: string) => Promise<Client | Falsey>;
44
+ authorize: (req: Request, res: Response, next: NextFunction) => Promise<void>;
45
+ /**
46
+ * Issue a fresh access/refresh token pair for a user.
47
+ *
48
+ * @param userName The ioBroker user name (without the `system.user.` prefix)
49
+ * @param binding Optional client/resource binding for tokens issued through the authorization code grant
50
+ */
51
+ generateTokens: (userName: string, binding?: TokenBinding) => Promise<Token>;
52
+ /**
53
+ * Get refresh token.
54
+ */
55
+ getRefreshToken: (bearerToken: string) => Promise<RefreshToken | Falsey>;
56
+ /**
57
+ * Get user.
58
+ */
59
+ getUser: (username: string, password: string) => Promise<User | Falsey>;
60
+ /**
61
+ * Save token.
62
+ */
63
+ saveToken: (token: PartialToken, client: Client, user: User) => Promise<Token | Falsey>;
64
+ /**
65
+ * Revoke an access or refresh token together with its counterpart.
66
+ *
67
+ * {@link revokeToken} can only drop the side it was handed, but both sessions store the full pair,
68
+ * so a single token value is enough to invalidate the whole grant — which is what RFC 7009
69
+ * revocation and "disconnect this app" need.
70
+ *
71
+ * @param token Either the access or the refresh token
72
+ * @returns Whether a matching token was found
73
+ */
74
+ revokeTokenPair: (token: string) => Promise<boolean>;
75
+ revokeToken: (token: RefreshToken | Token) => Promise<boolean>;
76
+ verifyScope: (_token: Token, _scope: Scope) => Promise<boolean>;
77
+ /**
78
+ * Issue a new access token for internal usage.
79
+ * E.g., node-red needs to access objects for Select ID dialog
80
+ *
81
+ * @param obj Message object
82
+ */
83
+ processMessage(obj: ioBroker.Message): boolean;
84
+ }