@ai-ecoverse/slicc-browsers 1.45.0 → 1.47.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/README.md +8 -7
- package/catalog.json +7 -2
- package/engine/engine-wasm.mjs +1 -1
- package/engine/engine.wasm +0 -0
- package/fixture-server.mjs +1 -1
- package/guard-driver.mjs +1 -0
- package/guard-runner.mjs +39 -2
- package/guard-vectors.json +1764 -229
- package/package.json +4 -4
- package/protected-parent-iframes.mjs +551 -567
- package/protected.json +210 -87
- package/protected.mjs +31 -7
- package/schema/catalog.schema.json +22 -2
- package/schema/guard-vectors.schema.json +18 -1
- package/schema/protected.schema.json +2 -2
package/engine/engine.wasm
CHANGED
|
Binary file
|
package/fixture-server.mjs
CHANGED
|
@@ -138,7 +138,7 @@ function route(req, url, send, html, redirects) {
|
|
|
138
138
|
const marker = p.get('n') ?? '';
|
|
139
139
|
return html(
|
|
140
140
|
'oopif-srcdoc',
|
|
141
|
-
`<p>oopif-srcdoc ${escape(marker)}</p><iframe sandbox="allow-scripts allow-forms" srcdoc="${escape(`<!doctype html><title>srcdoc</title><p>ordinary srcdoc ${marker}</p>`)}"></iframe>`
|
|
141
|
+
`<p>oopif-srcdoc ${escape(marker)}</p><iframe${p.has('sandbox') ? ' sandbox="allow-scripts allow-forms"' : ''} srcdoc="${escape(`<!doctype html><title>srcdoc</title><p>ordinary srcdoc ${marker}</p>`)}"></iframe>`
|
|
142
142
|
);
|
|
143
143
|
},
|
|
144
144
|
'/held': () =>
|
package/guard-driver.mjs
CHANGED
package/guard-runner.mjs
CHANGED
|
@@ -397,6 +397,16 @@ const callNames = (check) =>
|
|
|
397
397
|
].filter((name) => typeof name === 'string');
|
|
398
398
|
const storageLeg = (step, capabilities) =>
|
|
399
399
|
`${step.as ?? step.cdp}: ${step.cdp} ran on the ${browserStorageStep(step, capabilities) ? 'browser' : 'page'} session`;
|
|
400
|
+
const dotted = (domain) => `.${domain.replace(/^\.+/, '')}`;
|
|
401
|
+
const domainStates = (check) =>
|
|
402
|
+
!check || typeof check !== 'object'
|
|
403
|
+
? []
|
|
404
|
+
: [
|
|
405
|
+
...(check.state?.domain ? [check.state] : []),
|
|
406
|
+
...[...(check.all ?? []), ...(check.any ?? []), ...(check.not ? [check.not] : [])].flatMap(
|
|
407
|
+
domainStates
|
|
408
|
+
),
|
|
409
|
+
];
|
|
400
410
|
const stateCheck = (check) =>
|
|
401
411
|
check?.state ||
|
|
402
412
|
[...(check?.all ?? []), ...(check?.any ?? []), ...(check?.not ? [check.not] : [])]
|
|
@@ -647,7 +657,11 @@ class Execution {
|
|
|
647
657
|
if (!spec || !this.reader) return;
|
|
648
658
|
const state = expand(spec, this.vars);
|
|
649
659
|
await this.reader.send('Storage.setCookies', {
|
|
650
|
-
cookies: [
|
|
660
|
+
cookies: [
|
|
661
|
+
state.domain
|
|
662
|
+
? { name: state.cookie, value: state.value, domain: dotted(state.domain), path: '/' }
|
|
663
|
+
: { name: state.cookie, value: state.value, url: state.origin },
|
|
664
|
+
],
|
|
651
665
|
...(this.vars.context ? { browserContextId: this.vars.context } : {}),
|
|
652
666
|
});
|
|
653
667
|
if (!state.storage) return;
|
|
@@ -685,7 +699,9 @@ class Execution {
|
|
|
685
699
|
const cookie = cookies.find(
|
|
686
700
|
(entry) =>
|
|
687
701
|
entry.name === state.cookie &&
|
|
688
|
-
|
|
702
|
+
(state.domain
|
|
703
|
+
? entry.domain === dotted(state.domain)
|
|
704
|
+
: entry.domain.replace(/^\./, '') === new URL(state.origin).hostname)
|
|
689
705
|
);
|
|
690
706
|
if (cookie?.value !== state.value) return false;
|
|
691
707
|
if (!state.storage) return true;
|
|
@@ -1543,6 +1559,7 @@ class Execution {
|
|
|
1543
1559
|
protectedOrigin: this.vars.target,
|
|
1544
1560
|
cross: this.options.targets?.cross,
|
|
1545
1561
|
ordinary: this.vars.ordinary,
|
|
1562
|
+
browserSession: supported(['browserSession'], this.options.capabilities),
|
|
1546
1563
|
mode: step.protectedParentIframes,
|
|
1547
1564
|
tag: this.vars.tag,
|
|
1548
1565
|
internalSessions: this.internalSessions,
|
|
@@ -2891,7 +2908,25 @@ class Execution {
|
|
|
2891
2908
|
}
|
|
2892
2909
|
}
|
|
2893
2910
|
|
|
2911
|
+
async cleanupDomainCookies() {
|
|
2912
|
+
if (!this.reader || this.vars.context) return;
|
|
2913
|
+
const cookies = [
|
|
2914
|
+
...domainStates(this.vector.liveCheck),
|
|
2915
|
+
...Object.values(this.vector.observe ?? {}).flatMap((o) => domainStates(o.check)),
|
|
2916
|
+
]
|
|
2917
|
+
.map((state) => expand(state, this.vars))
|
|
2918
|
+
.map((state) => ({
|
|
2919
|
+
name: state.cookie,
|
|
2920
|
+
value: '',
|
|
2921
|
+
domain: dotted(state.domain),
|
|
2922
|
+
path: '/',
|
|
2923
|
+
expires: 1,
|
|
2924
|
+
}));
|
|
2925
|
+
if (cookies.length) await outcome(this.reader.send('Storage.setCookies', { cookies }));
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2894
2928
|
async cleanupLeg() {
|
|
2929
|
+
await this.cleanupDomainCookies();
|
|
2895
2930
|
if (this.discovering)
|
|
2896
2931
|
await this.answered(this.client.send('Target.setDiscoverTargets', { discover: false }));
|
|
2897
2932
|
if (this.watch)
|
|
@@ -3077,6 +3112,8 @@ function variables(targets, target, side, slot, index) {
|
|
|
3077
3112
|
vars.protectedTarget = targets[target];
|
|
3078
3113
|
vars.target = side === 'control' ? vars.plain : targets[target];
|
|
3079
3114
|
vars.targetHost = new URL(vars.target).hostname;
|
|
3115
|
+
vars.targetParent =
|
|
3116
|
+
side === 'control' ? vars.targetHost : vars.targetHost.slice(vars.targetHost.indexOf('.') + 1);
|
|
3080
3117
|
vars.idp = ['idp', 'idp-stg'].includes(target)
|
|
3081
3118
|
? targets[target]
|
|
3082
3119
|
: (targets.idp ?? targets[target]);
|