@egen-civitas/esm-embed-testing 0.1.0 → 0.3.0
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/CHANGELOG.md +28 -0
- package/README.md +4 -4
- package/bin/egen-embed-check.mjs +33 -0
- package/dist/check.d.ts +18 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +319 -0
- package/dist/conformance.js +78 -85
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/server.d.ts +0 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +14 -11
- package/dist/test-host.d.ts +6 -10
- package/dist/test-host.d.ts.map +1 -1
- package/dist/test-host.js +24 -41
- package/package.json +9 -4
- package/src/check.ts +77 -0
- package/src/conformance.ts +28 -28
- package/src/index.ts +1 -0
- package/src/server.ts +8 -10
- package/src/test-host.ts +22 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @egen-civitas/esm-embed-testing
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 36eb684: **Changement incompatible : le SDK est recentré sur ce dont le Core est lui-même la source.** Retrait des capacités `session`, `permissions`, `theme` et `api` (identité, droits, thème et appels API viennent de Keycloak, des backends et du service de thèmes ; le Core ne les relaie pas, ce qui supprime une classe entière de failles). Retrait de `pickFields`, des chemins d'API, de `createFetchApiProvider`, des hooks `useEgenSession`/`useEgenTheme`, et de la session dans le pont 1.1. Une demande de capacité retirée est rejetée avec la raison et la voie à suivre (`REMOVED_CAPABILITIES`).
|
|
8
|
+
|
|
9
|
+
Ajout de la capacité `extensions` (découverte des extensions d'un slot, grants `discover`/`contribute` par slot) et des contributions déclaratives `extensions[]` du manifeste (composants d'une app embarquée injectés dans les slots du Core), avec validation (`iconUrl` même origine, 4 Ko de meta) et `allowedContributions`. Hooks React `useEgenLocale`, `useEgenTenant`, `useEgenExtensions`.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [36eb684]
|
|
14
|
+
- @egen-civitas/esm-embed-protocol@0.3.0
|
|
15
|
+
- @egen-civitas/esm-embed-client@0.2.0
|
|
16
|
+
- @egen-civitas/esm-embed-host@0.3.0
|
|
17
|
+
|
|
18
|
+
## 0.2.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- 18cec62: Sécurité : `api.fetch` avec `path` est désormais **deny-by-default** (liste `paths` obligatoire dans le grant, normalisation anti-contournement : `..`, `%2e`, `//`…) pour qu'une app embarquée ne puisse pas appeler tout l'API du Core avec la session de l'utilisateur ; `negotiateCapabilities` ignore les entrées malformées ; tests de fuzz déterministes. Outillage : `egen-embed-check` (manifeste, capacités, `frame-ancestors`).
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [18cec62]
|
|
27
|
+
- @egen-civitas/esm-embed-protocol@0.2.0
|
|
28
|
+
- @egen-civitas/esm-embed-host@0.2.0
|
|
29
|
+
- @egen-civitas/esm-embed-client@0.1.1
|
|
30
|
+
|
|
3
31
|
## 0.1.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -11,14 +11,14 @@ import { connectToEgen } from '@egen-civitas/esm-embed-client';
|
|
|
11
11
|
import { createTestHost } from '@egen-civitas/esm-embed-testing';
|
|
12
12
|
|
|
13
13
|
const sim = createTestHost({
|
|
14
|
-
|
|
14
|
+
locale: 'fr',
|
|
15
15
|
manifestCapabilities: { notifications: {} },
|
|
16
16
|
approved: { notifications: {} },
|
|
17
17
|
});
|
|
18
|
-
const egen = await connectToEgen({ ...sim.connectOptions, capabilities: ['
|
|
18
|
+
const egen = await connectToEgen({ ...sim.connectOptions, capabilities: ['locale', 'notifications'] });
|
|
19
19
|
await egen.notifications.show({ kind: 'success', title: 'OK' });
|
|
20
20
|
expect(sim.notifications).toEqual([{ kind: 'success', title: 'OK' }]);
|
|
21
|
-
sim.emit.
|
|
21
|
+
sim.emit.locale('en'); // le Core pousse un changement
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
`sim.calls` (journal des services sollicités), `sim.published`, `sim.tools` + `sim.invokeTool()` (agent IA), `sim.emit.*`.
|
|
@@ -38,4 +38,4 @@ npx egen-embed-sim --app http://localhost:3000 --manifest egen-app.json
|
|
|
38
38
|
# → déclarez dans l'app : hostOrigins: ['http://127.0.0.1:4100']
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
Page avec votre app dans une iframe, l'hôte EGEN réel (`esm-embed-host`), des boutons (
|
|
41
|
+
Page avec votre app dans une iframe, l'hôte EGEN réel (`esm-embed-host`), des boutons (langue, événement, extensions) et le journal de tous les échanges. Par défaut les capacités demandées par le manifeste sont approuvées ; `--strict` n'approuve que les capacités « par défaut ».
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { checkEmbedApp, hasErrors } from '../dist/check.js';
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const opt = (n) => {
|
|
7
|
+
const i = args.indexOf(n);
|
|
8
|
+
return i === -1 ? undefined : args[i + 1];
|
|
9
|
+
};
|
|
10
|
+
if (args.includes('--help') || !opt('--manifest')) {
|
|
11
|
+
console.log(`egen-embed-check — vérifie une app embarquée (manifeste, capacités, intégrabilité en iframe)
|
|
12
|
+
|
|
13
|
+
Usage : egen-embed-check --manifest egen-app.json [--shell https://egen.exemple.org] [--probe] [--allow-localhost]
|
|
14
|
+
|
|
15
|
+
--shell origine du Shell EGEN (contrôle CSP frame-ancestors)
|
|
16
|
+
--probe interroge l'URL de l'app (en-têtes X-Frame-Options / CSP)
|
|
17
|
+
--allow-localhost tolère http://localhost (développement)
|
|
18
|
+
|
|
19
|
+
Code de sortie : 1 si au moins une erreur.`);
|
|
20
|
+
process.exit(opt('--manifest') ? 0 : 1);
|
|
21
|
+
}
|
|
22
|
+
let manifest;
|
|
23
|
+
try {
|
|
24
|
+
manifest = JSON.parse(await readFile(opt('--manifest'), 'utf8'));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
console.error(`✗ manifeste illisible : ${e.message}`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
const issues = await checkEmbedApp({ manifest, shellOrigin: opt('--shell'), probe: args.includes('--probe'), allowInsecureLocalhost: args.includes('--allow-localhost') });
|
|
30
|
+
const sym = { error: '✗', warn: '!', info: 'i' };
|
|
31
|
+
for (const i of issues) console.log(`${sym[i.level]} ${i.message}`);
|
|
32
|
+
if (!issues.length) console.log('✔ aucune remarque');
|
|
33
|
+
process.exit(hasErrors(issues) ? 1 : 0);
|
package/dist/check.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface CheckIssue {
|
|
2
|
+
level: 'error' | 'warn' | 'info';
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
export interface CheckOptions {
|
|
6
|
+
/** Manifeste `egen-app.json` déjà lu. */
|
|
7
|
+
manifest: unknown;
|
|
8
|
+
/** Origine du Shell EGEN (ex. `https://egen.exemple.org`) : active le contrôle d'intégration en iframe. */
|
|
9
|
+
shellOrigin?: string;
|
|
10
|
+
/** Interroge réellement l'URL de l'app (en-têtes `frame-ancestors`, `X-Frame-Options`). */
|
|
11
|
+
probe?: boolean;
|
|
12
|
+
allowInsecureLocalhost?: boolean;
|
|
13
|
+
fetchImpl?: typeof fetch;
|
|
14
|
+
}
|
|
15
|
+
/** Vérificateur d'app embarquée (`egen-embed-check`) : manifeste, hygiène des capacités demandées, intégrabilité en iframe. */
|
|
16
|
+
export declare function checkEmbedApp(o: CheckOptions): Promise<CheckIssue[]>;
|
|
17
|
+
export declare const hasErrors: (issues: CheckIssue[]) => boolean;
|
|
18
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,OAAO,CAAC;IAClB,2GAA2G;IAC3G,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAED,+HAA+H;AAC/H,wBAAsB,aAAa,CAAC,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAuD1E;AAED,eAAO,MAAM,SAAS,GAAI,QAAQ,UAAU,EAAE,YAA4C,CAAC"}
|
package/dist/check.js
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
|
+
}
|
|
9
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
10
|
+
try {
|
|
11
|
+
var info = gen[key](arg);
|
|
12
|
+
var value = info.value;
|
|
13
|
+
} catch (error) {
|
|
14
|
+
reject(error);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (info.done) {
|
|
18
|
+
resolve(value);
|
|
19
|
+
} else {
|
|
20
|
+
Promise.resolve(value).then(_next, _throw);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function _async_to_generator(fn) {
|
|
24
|
+
return function() {
|
|
25
|
+
var self = this, args = arguments;
|
|
26
|
+
return new Promise(function(resolve, reject) {
|
|
27
|
+
var gen = fn.apply(self, args);
|
|
28
|
+
function _next(value) {
|
|
29
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
30
|
+
}
|
|
31
|
+
function _throw(err) {
|
|
32
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
33
|
+
}
|
|
34
|
+
_next(undefined);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function _iterable_to_array(iter) {
|
|
39
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
40
|
+
}
|
|
41
|
+
function _non_iterable_spread() {
|
|
42
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
43
|
+
}
|
|
44
|
+
function _to_consumable_array(arr) {
|
|
45
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
46
|
+
}
|
|
47
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
48
|
+
if (!o) return;
|
|
49
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
50
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
51
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
52
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
53
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
54
|
+
}
|
|
55
|
+
function _ts_generator(thisArg, body) {
|
|
56
|
+
var f, y, t, _ = {
|
|
57
|
+
label: 0,
|
|
58
|
+
sent: function() {
|
|
59
|
+
if (t[0] & 1) throw t[1];
|
|
60
|
+
return t[1];
|
|
61
|
+
},
|
|
62
|
+
trys: [],
|
|
63
|
+
ops: []
|
|
64
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
65
|
+
return d(g, "next", {
|
|
66
|
+
value: verb(0)
|
|
67
|
+
}), d(g, "throw", {
|
|
68
|
+
value: verb(1)
|
|
69
|
+
}), d(g, "return", {
|
|
70
|
+
value: verb(2)
|
|
71
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
72
|
+
value: function() {
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
}), g;
|
|
76
|
+
function verb(n) {
|
|
77
|
+
return function(v) {
|
|
78
|
+
return step([
|
|
79
|
+
n,
|
|
80
|
+
v
|
|
81
|
+
]);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function step(op) {
|
|
85
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
86
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
87
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
88
|
+
if (y = 0, t) op = [
|
|
89
|
+
op[0] & 2,
|
|
90
|
+
t.value
|
|
91
|
+
];
|
|
92
|
+
switch(op[0]){
|
|
93
|
+
case 0:
|
|
94
|
+
case 1:
|
|
95
|
+
t = op;
|
|
96
|
+
break;
|
|
97
|
+
case 4:
|
|
98
|
+
_.label++;
|
|
99
|
+
return {
|
|
100
|
+
value: op[1],
|
|
101
|
+
done: false
|
|
102
|
+
};
|
|
103
|
+
case 5:
|
|
104
|
+
_.label++;
|
|
105
|
+
y = op[1];
|
|
106
|
+
op = [
|
|
107
|
+
0
|
|
108
|
+
];
|
|
109
|
+
continue;
|
|
110
|
+
case 7:
|
|
111
|
+
op = _.ops.pop();
|
|
112
|
+
_.trys.pop();
|
|
113
|
+
continue;
|
|
114
|
+
default:
|
|
115
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
116
|
+
_ = 0;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
120
|
+
_.label = op[1];
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
124
|
+
_.label = t[1];
|
|
125
|
+
t = op;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
if (t && _.label < t[2]) {
|
|
129
|
+
_.label = t[2];
|
|
130
|
+
_.ops.push(op);
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
if (t[2]) _.ops.pop();
|
|
134
|
+
_.trys.pop();
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
op = body.call(thisArg, _);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
op = [
|
|
140
|
+
6,
|
|
141
|
+
e
|
|
142
|
+
];
|
|
143
|
+
y = 0;
|
|
144
|
+
} finally{
|
|
145
|
+
f = t = 0;
|
|
146
|
+
}
|
|
147
|
+
if (op[0] & 5) throw op[1];
|
|
148
|
+
return {
|
|
149
|
+
value: op[0] ? op[1] : void 0,
|
|
150
|
+
done: true
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
import { CAPABILITIES, patternCovers, validateManifest } from '@egen-civitas/esm-embed-protocol';
|
|
155
|
+
/** Vérificateur d'app embarquée (`egen-embed-check`) : manifeste, hygiène des capacités demandées, intégrabilité en iframe. */ export function checkEmbedApp(o) {
|
|
156
|
+
return _async_to_generator(function() {
|
|
157
|
+
var _m_extensions, _m_extensions1, _caps_events, _caps_aitools, _caps_extensions, issues, add, r, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _$e, m, caps, needApproval, pub, own, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, p, tools, slots, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _$e1, discover, _o_fetchImpl, f, _res_headers_get, _exec_, _exec, res, xfo, csp, fa, tokens, e;
|
|
158
|
+
return _ts_generator(this, function(_state) {
|
|
159
|
+
switch(_state.label){
|
|
160
|
+
case 0:
|
|
161
|
+
issues = [];
|
|
162
|
+
add = function add(level, message) {
|
|
163
|
+
return issues.push({
|
|
164
|
+
level: level,
|
|
165
|
+
message: message
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
r = validateManifest(o.manifest, {
|
|
169
|
+
allowInsecureLocalhost: o.allowInsecureLocalhost
|
|
170
|
+
});
|
|
171
|
+
if (!r.ok) {
|
|
172
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
173
|
+
try {
|
|
174
|
+
for(_iterator = r.errors[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
175
|
+
_$e = _step.value;
|
|
176
|
+
add('error', _$e);
|
|
177
|
+
}
|
|
178
|
+
} catch (err) {
|
|
179
|
+
_didIteratorError = true;
|
|
180
|
+
_iteratorError = err;
|
|
181
|
+
} finally{
|
|
182
|
+
try {
|
|
183
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
184
|
+
_iterator.return();
|
|
185
|
+
}
|
|
186
|
+
} finally{
|
|
187
|
+
if (_didIteratorError) {
|
|
188
|
+
throw _iteratorError;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return [
|
|
193
|
+
2,
|
|
194
|
+
issues
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
m = r.manifest;
|
|
198
|
+
caps = m.capabilities;
|
|
199
|
+
needApproval = Object.keys(caps).filter(function(id) {
|
|
200
|
+
return !CAPABILITIES[id].defaultGrant;
|
|
201
|
+
});
|
|
202
|
+
if (needApproval.length) add('info', "Capacit\xe9s \xe0 faire approuver par l'op\xe9rateur (grants) : ".concat(needApproval.join(', ')));
|
|
203
|
+
pub = (_caps_events = caps.events) === null || _caps_events === void 0 ? void 0 : _caps_events.publish;
|
|
204
|
+
if (Array.isArray(pub)) {
|
|
205
|
+
own = "app.".concat(m.route, ".*");
|
|
206
|
+
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
207
|
+
try {
|
|
208
|
+
for(_iterator1 = pub[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
209
|
+
p = _step1.value;
|
|
210
|
+
if (p === '*' || /^\*/.test(String(p))) add('error', "events.publish : le motif \xab ".concat(p, " \xbb n'est pas support\xe9 (nommer le pr\xe9fixe, ex. ").concat(own, ")"));
|
|
211
|
+
else if (!patternCovers(own, String(p).replace(/\.\*$/, '.x'))) add('warn', "events.publish : \xab ".concat(p, " \xbb sort de l'espace conseill\xe9 ").concat(own));
|
|
212
|
+
}
|
|
213
|
+
} catch (err) {
|
|
214
|
+
_didIteratorError1 = true;
|
|
215
|
+
_iteratorError1 = err;
|
|
216
|
+
} finally{
|
|
217
|
+
try {
|
|
218
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
219
|
+
_iterator1.return();
|
|
220
|
+
}
|
|
221
|
+
} finally{
|
|
222
|
+
if (_didIteratorError1) {
|
|
223
|
+
throw _iteratorError1;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
tools = (_caps_aitools = caps['ai-tools']) === null || _caps_aitools === void 0 ? void 0 : _caps_aitools.tools;
|
|
229
|
+
if (Array.isArray(tools) && tools.some(function(t) {
|
|
230
|
+
return !String(t).includes('.');
|
|
231
|
+
})) add('warn', 'ai-tools.tools : préférer des noms d’outils préfixés (ex. studio.apply) pour éviter les collisions');
|
|
232
|
+
slots = _to_consumable_array(new Set(((_m_extensions = m.extensions) !== null && _m_extensions !== void 0 ? _m_extensions : []).map(function(e) {
|
|
233
|
+
return e.slot;
|
|
234
|
+
})));
|
|
235
|
+
if (slots.length) add('info', "Contributions d'extension : l'op\xe9rateur doit approuver les slots (extensions.contribute) : ".concat(slots.join(', ')));
|
|
236
|
+
_iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
237
|
+
try {
|
|
238
|
+
for(_iterator2 = ((_m_extensions1 = m.extensions) !== null && _m_extensions1 !== void 0 ? _m_extensions1 : [])[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
239
|
+
_$e1 = _step2.value;
|
|
240
|
+
if (_$e1.view) add('info', "Extension \xab ".concat(_$e1.name, " \xbb : la vue ").concat(_$e1.view, " sera affich\xe9e dans une iframe du Core (frame-ancestors \xe0 autoriser pour le Shell, hauteur via navigation.resize)"));
|
|
241
|
+
}
|
|
242
|
+
} catch (err) {
|
|
243
|
+
_didIteratorError2 = true;
|
|
244
|
+
_iteratorError2 = err;
|
|
245
|
+
} finally{
|
|
246
|
+
try {
|
|
247
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
248
|
+
_iterator2.return();
|
|
249
|
+
}
|
|
250
|
+
} finally{
|
|
251
|
+
if (_didIteratorError2) {
|
|
252
|
+
throw _iteratorError2;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
discover = (_caps_extensions = caps.extensions) === null || _caps_extensions === void 0 ? void 0 : _caps_extensions.discover;
|
|
257
|
+
if (Array.isArray(discover) && discover.some(function(s) {
|
|
258
|
+
return s === '*';
|
|
259
|
+
})) add('error', "extensions.discover : le motif « * » n'est pas supporté (nommer les slots)");
|
|
260
|
+
if (m.technology === 'nextjs' && m.navigation.mode === 'none') add('info', 'Next.js avec navigation « none » : l’URL du Core ne reflétera pas la page courante (partage de lien, F5)');
|
|
261
|
+
if (!o.probe) return [
|
|
262
|
+
3,
|
|
263
|
+
4
|
|
264
|
+
];
|
|
265
|
+
f = (_o_fetchImpl = o.fetchImpl) !== null && _o_fetchImpl !== void 0 ? _o_fetchImpl : fetch;
|
|
266
|
+
_state.label = 1;
|
|
267
|
+
case 1:
|
|
268
|
+
_state.trys.push([
|
|
269
|
+
1,
|
|
270
|
+
3,
|
|
271
|
+
,
|
|
272
|
+
4
|
|
273
|
+
]);
|
|
274
|
+
return [
|
|
275
|
+
4,
|
|
276
|
+
f(m.url, {
|
|
277
|
+
redirect: 'manual',
|
|
278
|
+
signal: AbortSignal.timeout(10000)
|
|
279
|
+
})
|
|
280
|
+
];
|
|
281
|
+
case 2:
|
|
282
|
+
res = _state.sent();
|
|
283
|
+
if (res.status >= 400) add('warn', "L'URL de l'app r\xe9pond HTTP ".concat(res.status));
|
|
284
|
+
if (res.status >= 300 && res.status < 400) add('info', "L'URL de l'app redirige (HTTP ".concat(res.status, ") : v\xe9rifier que la cible reste dans la m\xeame origine"));
|
|
285
|
+
xfo = res.headers.get('x-frame-options');
|
|
286
|
+
csp = (_res_headers_get = res.headers.get('content-security-policy')) !== null && _res_headers_get !== void 0 ? _res_headers_get : '';
|
|
287
|
+
fa = (_exec = /frame-ancestors\s+([^;]*)/i.exec(csp)) === null || _exec === void 0 ? void 0 : (_exec_ = _exec[1]) === null || _exec_ === void 0 ? void 0 : _exec_.trim();
|
|
288
|
+
if (xfo && /deny|sameorigin/i.test(xfo) && !fa) add('error', "X-Frame-Options: ".concat(xfo, " interdit l'int\xe9gration en iframe par le Shell (utiliser CSP frame-ancestors)"));
|
|
289
|
+
else if (fa !== undefined) {
|
|
290
|
+
tokens = fa.split(/\s+/);
|
|
291
|
+
if (o.shellOrigin && !tokens.includes('*') && !tokens.includes(o.shellOrigin)) add('error', "CSP frame-ancestors (".concat(fa, ") n'autorise pas le Shell ").concat(o.shellOrigin));
|
|
292
|
+
if (tokens.includes('*')) add('warn', 'CSP frame-ancestors « * » : n’importe quel site peut intégrer l’app (clickjacking) ; nommer l’origine du Shell');
|
|
293
|
+
if (tokens.includes("'none'")) add('error', "CSP frame-ancestors 'none' : intégration impossible");
|
|
294
|
+
} else add('warn', 'Aucune restriction frame-ancestors : l’app peut être intégrée par n’importe quel site (clickjacking) ; limiter à l’origine du Shell');
|
|
295
|
+
return [
|
|
296
|
+
3,
|
|
297
|
+
4
|
|
298
|
+
];
|
|
299
|
+
case 3:
|
|
300
|
+
e = _state.sent();
|
|
301
|
+
add('warn', "URL de l'app injoignable (".concat(e.message, ")"));
|
|
302
|
+
return [
|
|
303
|
+
3,
|
|
304
|
+
4
|
|
305
|
+
];
|
|
306
|
+
case 4:
|
|
307
|
+
return [
|
|
308
|
+
2,
|
|
309
|
+
issues
|
|
310
|
+
];
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
})();
|
|
314
|
+
}
|
|
315
|
+
export var hasErrors = function hasErrors(issues) {
|
|
316
|
+
return issues.some(function(i) {
|
|
317
|
+
return i.level === 'error';
|
|
318
|
+
});
|
|
319
|
+
};
|