iobroker.eos-admin 7.9.98 → 7.9.100

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 (57) hide show
  1. package/INSTALL_TEST_V7.9.100.md +11 -0
  2. package/MERGE_UPDATE_README_V7.9.100.md +5 -0
  3. package/NEXOWATT_EOS_BUILD_INFO.json +20 -20
  4. package/PUBLISH_STABLE_V7.9.100.md +15 -0
  5. package/README.md +6 -16
  6. package/README_STABILITY_V7.9.100.md +3 -0
  7. package/RELEASE_ACCEPTANCE_V7.9.100.md +11 -0
  8. package/RELEASE_NOTES_V7.9.100.md +11 -0
  9. package/adminWww/assets/Intro-DkwRiz1n-v84.js +2 -2
  10. package/adminWww/assets/bootstrap-COulQZax-v84.js +2 -2
  11. package/adminWww/css/eos-auto-update.css +4 -0
  12. package/adminWww/css/eos-ems-overview.css +3 -5
  13. package/adminWww/css/nexowatt-native-shell.css +26 -112
  14. package/adminWww/index.html +21 -18
  15. package/adminWww/js/eos-account-management.js +19 -28
  16. package/adminWww/js/eos-assistant.js +1 -1
  17. package/adminWww/js/eos-auto-update.js +78 -0
  18. package/adminWww/js/eos-ems-overview.js +2 -3
  19. package/adminWww/js/eos-release-watch.js +77 -0
  20. package/adminWww/js/eos-role-bootstrap.js +11 -8
  21. package/adminWww/js/eos-role-ui.js +2 -2
  22. package/adminWww/js/nexowatt-native-shell.js +1 -1
  23. package/adminWww/static/js/nexowatt-stable-login.js +3 -3
  24. package/adminWww/static/js/{nexowatt-stable-v98.js → nexowatt-stable-v100.js} +2 -2
  25. package/build/lib/eosAutoUpdate.js +43 -0
  26. package/build/lib/eosPassword.js +62 -0
  27. package/build/lib/eosRequestSecurity.js +31 -0
  28. package/build/lib/web.js +194 -151
  29. package/build/main.js +2 -1
  30. package/io-package.json +7 -11
  31. package/package.json +23 -13
  32. package/src/lib/eosAutoUpdate.ts +320 -0
  33. package/tools/nexowatt-account-management-selftest.cjs +19 -15
  34. package/tools/nexowatt-apply-ems-overview.cjs +2 -4
  35. package/tools/nexowatt-auto-update-selftest.cjs +34 -0
  36. package/tools/nexowatt-cache-update-selftest.cjs +12 -0
  37. package/tools/nexowatt-clean-legacy-runtime.cjs +1 -1
  38. package/tools/nexowatt-ems-overview-selftest.cjs +1 -1
  39. package/tools/nexowatt-login-layout-selftest.cjs +11 -11
  40. package/tools/nexowatt-merge-update-selftest.cjs +1 -1
  41. package/tools/nexowatt-modern-ui-selftest.cjs +2 -2
  42. package/tools/nexowatt-password-write-selftest.cjs +42 -44
  43. package/tools/nexowatt-request-security-selftest.cjs +11 -0
  44. package/tools/nexowatt-runtime-cleanup-selftest.cjs +6 -6
  45. package/tools/nexowatt-stable-v100-selftest.cjs +27 -0
  46. package/tools/nexowatt-sync-release-version.cjs +1 -42
  47. package/tools/nexowatt-ui-overview-runtime-selftest.cjs +3 -1
  48. package/tools/nexowatt-validate-package.cjs +23 -23
  49. package/tools/nexowatt-version-sync-selftest.cjs +1 -18
  50. package/INSTALL_TEST_V7.9.98.md +0 -39
  51. package/MERGE_UPDATE_README_V7.9.98.md +0 -29
  52. package/PUBLISH_STABLE_V7.9.98.md +0 -33
  53. package/README_STABILITY_V7.9.98.md +0 -22
  54. package/RELEASE_ACCEPTANCE_V7.9.98.md +0 -48
  55. package/RELEASE_NOTES_V7.9.98.md +0 -32
  56. package/tools/nexowatt-account-password-flow-selftest.cjs +0 -186
  57. package/tools/nexowatt-stable-v98-selftest.cjs +0 -14
@@ -1,186 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- const assert = require('node:assert/strict');
5
- const fs = require('node:fs');
6
- const path = require('node:path');
7
- const vm = require('node:vm');
8
-
9
- const root = path.resolve(__dirname, '..');
10
- const built = fs.readFileSync(path.join(root, 'build/lib/web.js'), 'utf8');
11
- const accountUi = fs.readFileSync(path.join(root, 'adminWww/js/eos-account-management.js'), 'utf8');
12
- const firstLoginUi = fs.readFileSync(path.join(root, 'adminWww/js/eos-role-bootstrap.js'), 'utf8');
13
-
14
- function methodSlice(startMarker, endMarker) {
15
- const start = built.indexOf(startMarker);
16
- const end = built.indexOf(endMarker, start + startMarker.length);
17
- assert(start >= 0 && end > start, `method block not found: ${startMarker}`);
18
- return built.slice(start, end);
19
- }
20
-
21
- const methods = [
22
- methodSlice(' normalizeEosUserId(value) {', ' normalizeEosAdapterName(value) {'),
23
- methodSlice(' async readEosCurrentUser(req) {', ' getEosConfiguredRoleGroups(...keys) {'),
24
- methodSlice(' async getEosRequestAccess(req) {', ' getEosRoleCapabilities(role) {'),
25
- methodSlice(' validateEosFirstLoginPassword(password, passwordRepeat, userId) {', ' getEosPasswordUserName(userId) {'),
26
- methodSlice(' getEosPasswordUserName(userId) {', ' async destroyEosRequestSessions(req) {'),
27
- methodSlice(' async saveEosFirstLoginPassword(req, res) {', ' isEosPasswordlessFirstLoginEnabled() {'),
28
- methodSlice(' async resetEosAccountPassword(req, res) {', ' async getEosHistoryInstances() {'),
29
- methodSlice(' isEosSameOriginWrite(req) {', ' async saveEosBasicSettings(req, res) {'),
30
- ].join('\n');
31
-
32
- const sandbox = { module: { exports: null }, URL, Set, console, EOS_PASSWORD_SERVICE_USER: 'system.user.admin' };
33
- vm.runInNewContext(`module.exports = class Harness {\n${methods}\n}`, sandbox);
34
- const Harness = sandbox.module.exports;
35
-
36
- function responseMock() {
37
- return {
38
- statusCode: 200,
39
- payload: null,
40
- headers: {},
41
- clearedCookies: [],
42
- setHeader(name, value) { this.headers[String(name).toLowerCase()] = value; },
43
- status(code) { this.statusCode = code; return this; },
44
- json(value) { this.payload = value; return this; },
45
- clearCookie(name) { this.clearedCookies.push(name); },
46
- };
47
- }
48
-
49
- function requestMock(body = {}, headers = {}) {
50
- return {
51
- body,
52
- headers: {
53
- host: '192.168.10.124:8081',
54
- origin: 'http://192.168.10.124:8081',
55
- 'sec-fetch-site': 'same-origin',
56
- ...headers,
57
- },
58
- query: {},
59
- socket: { remoteAddress: '192.168.10.50' },
60
- };
61
- }
62
-
63
- async function resetScenario(requesterRole, targetRole, targetGroups) {
64
- const harness = new Harness();
65
- const writes = [];
66
- const metadata = {};
67
- harness.getEosRequestAccess = async () => ({ userId: requesterRole === 'admin' ? 'system.user.admin' : 'system.user.installer', role: requesterRole });
68
- harness.normalizeEosUserId = value => String(value || '').startsWith('system.user.') ? String(value) : `system.user.${value}`;
69
- harness.getEosAccessForUserId = async () => ({ role: targetRole, groups: targetGroups });
70
- harness.getEosInstallerGroups = () => ['system.group.installer', 'system.group.installateur'];
71
- harness.getEosEndUserGroups = () => ['system.group.endkunde', 'system.group.user'];
72
- harness.adapter = {
73
- setPasswordAsync: async (user, password) => writes.push([`system.user.${user}`, password]),
74
- checkPasswordAsync: async (user, password) => [password === 'nexowatt', `system.user.${user}`],
75
- getForeignObjectAsync: async id => ({ _id: id, common: { enabled: true, password: '$hash' }, native: { keep: true, nexowattEosAccount: {} } }),
76
- extendForeignObjectAsync: async (id, patch) => {
77
- metadata.id = id;
78
- metadata.native = patch.native;
79
- },
80
- log: { warn: () => undefined, info: () => undefined },
81
- };
82
- harness.invalidateEosPasswordClaimsForUser = () => undefined;
83
- const res = responseMock();
84
- await harness.resetEosAccountPassword(
85
- requestMock({ user: targetRole === 'installer' ? 'system.user.installer-target' : 'system.user.user' }, { 'x-nexowatt-eos-account-reset': '1' }),
86
- res,
87
- );
88
- return { res, writes, metadata };
89
- }
90
-
91
- (async () => {
92
- // Authenticated request identities are normalized to the real ioBroker user object id.
93
- const accessHarness = new Harness();
94
- accessHarness.getEosAccessForUserId = async userId => ({ userId, role: userId === 'system.user.admin' ? 'admin' : 'enduser' });
95
- const directAdmin = await accessHarness.getEosRequestAccess({ user: 'admin' });
96
- assert.equal(directAdmin.userId, 'system.user.admin');
97
- assert.equal(directAdmin.role, 'admin');
98
- const objectAdmin = await accessHarness.getEosRequestAccess({ user: { id: 'system.user.admin' } });
99
- assert.equal(objectAdmin.userId, 'system.user.admin');
100
- assert.equal(objectAdmin.role, 'admin');
101
-
102
- // Admin/Service can reset an explicitly managed End User and Installer account.
103
- const adminEndUser = await resetScenario('admin', 'enduser', ['system.group.endkunde']);
104
- assert.equal(adminEndUser.res.statusCode, 200);
105
- assert.deepEqual(adminEndUser.writes, [['system.user.user', 'nexowatt']]);
106
- assert.equal(adminEndUser.metadata.native.nexowattEosAccount.forcePasswordChange, true);
107
- assert.equal(adminEndUser.metadata.native.nexowattEosAccount.passwordResetMode, 'initial-password');
108
- assert.equal(adminEndUser.metadata.native.nexowattPasswordChangeRequired, true);
109
-
110
- const adminInstaller = await resetScenario('admin', 'installer', ['system.group.installer']);
111
- assert.equal(adminInstaller.res.statusCode, 200);
112
- assert.deepEqual(adminInstaller.writes, [['system.user.installer-target', 'nexowatt']]);
113
-
114
- // Installer may never reset another installer account.
115
- const installerDenied = await resetScenario('installer', 'installer', ['system.group.installer']);
116
- assert.equal(installerDenied.res.statusCode, 403);
117
- assert.equal(installerDenied.res.payload.error, 'permissionError');
118
- assert.equal(installerDenied.writes.length, 0);
119
-
120
- // First-login password save must write the real account and clear every force-change flag.
121
- const harness = new Harness();
122
- const passwordWrites = [];
123
- let metadata;
124
- let sessionsDestroyed = false;
125
- harness.getEosRequestAccess = async () => ({ userId: 'system.user.user', role: 'enduser' });
126
- harness.getEosFirstLoginPasswordState = async () => ({ required: true, initialized: false, minLength: 10, version: 1 });
127
- harness.getEosFirstLoginPasswordMinLength = () => 10;
128
- harness.destroyEosRequestSessions = async () => { sessionsDestroyed = true; };
129
- harness.adapter = {
130
- setPasswordAsync: async (user, password) => passwordWrites.push([`system.user.${user}`, password]),
131
- checkPasswordAsync: async (user, password) => [password === 'NexoWatt2025!', `system.user.${user}`],
132
- getForeignObjectAsync: async id => ({ _id: id, common: { enabled: true, password: '$hash' }, native: { nexowattEosAccount: {} } }),
133
- extendForeignObjectAsync: async (id, patch) => { metadata = { id, native: patch.native }; },
134
- log: { info: () => undefined },
135
- };
136
- const acceptedPassword = harness.validateEosFirstLoginPassword(
137
- 'NexoWatt2025!',
138
- 'NexoWatt2025!',
139
- 'system.user.user',
140
- );
141
- assert.equal(acceptedPassword.valid, true);
142
- assert.equal(acceptedPassword.password, 'NexoWatt2025!');
143
- const saveRes = responseMock();
144
- await harness.saveEosFirstLoginPassword(
145
- requestMock(
146
- { password: 'NexoWatt2025!', passwordRepeat: 'NexoWatt2025!' },
147
- { 'x-nexowatt-eos-first-login': '1' },
148
- ),
149
- saveRes,
150
- );
151
- assert.equal(saveRes.statusCode, 200);
152
- assert.equal(saveRes.payload.success, true);
153
- assert.equal(saveRes.payload.logoutRequired, true);
154
- assert.deepEqual(passwordWrites, [['system.user.user', 'NexoWatt2025!']]);
155
- assert.equal(metadata.native.nexowattEosAccount.passwordInitialized, true);
156
- assert.equal(metadata.native.nexowattEosAccount.forcePasswordChange, false);
157
- assert.equal(metadata.native.nexowattPasswordChangeRequired, false);
158
- assert.equal(metadata.native.eosFirstLoginRequired, false);
159
- assert.equal(sessionsDestroyed, true);
160
- assert.deepEqual(saveRes.clearedCookies.sort(), ['access_token', 'connect.sid', 'refresh_token'].sort());
161
-
162
- // Same-origin logic must support direct access and a reverse proxy without accepting cross-site writes.
163
- const originHarness = new Harness();
164
- assert.equal(originHarness.isEosSameOriginWrite(requestMock()), true);
165
- assert.equal(originHarness.isEosSameOriginWrite(requestMock({}, {
166
- host: '127.0.0.1:8081',
167
- origin: 'https://eos.example.test',
168
- 'x-forwarded-host': 'eos.example.test',
169
- 'sec-fetch-site': 'same-origin',
170
- })), true);
171
- assert.equal(originHarness.isEosSameOriginWrite(requestMock({}, {
172
- origin: 'https://attacker.example',
173
- 'sec-fetch-site': 'cross-site',
174
- })), false);
175
-
176
- // Browser writes must preserve the authenticated session cookie.
177
- assert.match(accountUi, /nexowatt\/account\/reset/);
178
- assert.match(accountUi, /method:\s*'POST',\s*credentials:\s*'include'/);
179
- assert.match(firstLoginUi, /nexowatt\/account\/first-password/);
180
- assert.match(firstLoginUi, /method:\s*'POST',\s*credentials:\s*'include'/);
181
-
182
- console.log('[NexoWatt EOS account password flow] OK: Admin/Installer permissions, initial password reset, personal password save, session and origin checks verified.');
183
- })().catch(error => {
184
- console.error(error && error.stack ? error.stack : error);
185
- process.exit(1);
186
- });
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
- const fs=require('node:fs');const path=require('node:path');const root=path.resolve(__dirname,'..');const read=rel=>fs.readFileSync(path.join(root,rel),'utf8');const must=(ok,msg)=>{if(!ok){console.error(`[NexoWatt EOS stable v98] ${msg}`);process.exit(1)}};
4
- const pkg=JSON.parse(read('package.json')),io=JSON.parse(read('io-package.json')),info=JSON.parse(read('NEXOWATT_EOS_BUILD_INFO.json')),css=read('adminWww/css/nexowatt-native-shell.css'),stable=read('adminWww/static/js/nexowatt-stable-v98.js'),login=read('adminWww/static/js/nexowatt-stable-login.js'),index=read('adminWww/index.html'),web=read('src/lib/web.ts'),built=read('build/lib/web.js'),account=read('adminWww/js/eos-account-management.js'),bootstrap=read('adminWww/assets/bootstrap-COulQZax-v84.js'),ems=read('adminWww/js/eos-ems-overview.js');
5
- must(pkg.version==='7.9.98'&&io.version==='7.9.98'&&io.common.version==='7.9.98'&&info.version==='7.9.98','version drift');
6
- must(info.shellCacheVersion===98&&info.shellCacheTag==='98','shell cache not v98');
7
- must(css.includes('overflow-y: auto !important')&&css.includes('scrollbar-color: rgba(0, 229, 138'),'cockpit vertical scrollbar missing');
8
- must(css.includes('.MuiInputLabel-root { display: none !important; }')&&bootstrap.includes('I18n.t("enterLogin")+" *"'),'clean login field contract missing');
9
- must(stable.includes("VERSION = 'v98-scroll-login-password-write'")&&!login.includes('data-nw-login-card'),'stable runtime incorrect');
10
- must(index.includes('nexowatt-stable-v98.js?v=98')&&index.includes('nexowatt-native-shell.css?v=98'),'v98 assets not loaded');
11
- for(const code of [web,built])for(const marker of ['getEosPasswordUserName','setPasswordAsync(userName, password','checkPasswordAsync(userName, password','passwordVerificationFailed','updateEosAccountMetadata','extendForeignObjectAsync'])must(code.includes(marker),`password marker missing: ${marker}`);
12
- must(account.includes('Startpasswort „nexowatt“')&&account.includes('credentials: \'include\''),'reset UI does not describe/use stable initial password flow');
13
- must(ems.includes("REQUIRED_UI_VERSION = '0.8.198'")&&ems.includes('readUiAdapterInfo'),'working EMS diagnosis was lost');
14
- console.log('[NexoWatt EOS stable v98] OK');