@ai-ecoverse/slicc-browsers 1.45.0 → 1.46.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 +6 -6
- package/catalog.json +7 -2
- package/engine/engine-wasm.mjs +1 -1
- package/engine/engine.wasm +0 -0
- package/guard-driver.mjs +1 -0
- package/guard-runner.mjs +38 -2
- package/guard-vectors.json +366 -87
- package/package.json +4 -4
- package/protected.json +210 -87
- package/protected.mjs +31 -7
- package/schema/catalog.schema.json +22 -2
- package/schema/guard-vectors.schema.json +11 -1
- package/schema/protected.schema.json +2 -2
package/engine/engine.wasm
CHANGED
|
Binary file
|
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;
|
|
@@ -2891,7 +2907,25 @@ class Execution {
|
|
|
2891
2907
|
}
|
|
2892
2908
|
}
|
|
2893
2909
|
|
|
2910
|
+
async cleanupDomainCookies() {
|
|
2911
|
+
if (!this.reader || this.vars.context) return;
|
|
2912
|
+
const cookies = [
|
|
2913
|
+
...domainStates(this.vector.liveCheck),
|
|
2914
|
+
...Object.values(this.vector.observe ?? {}).flatMap((o) => domainStates(o.check)),
|
|
2915
|
+
]
|
|
2916
|
+
.map((state) => expand(state, this.vars))
|
|
2917
|
+
.map((state) => ({
|
|
2918
|
+
name: state.cookie,
|
|
2919
|
+
value: '',
|
|
2920
|
+
domain: dotted(state.domain),
|
|
2921
|
+
path: '/',
|
|
2922
|
+
expires: 1,
|
|
2923
|
+
}));
|
|
2924
|
+
if (cookies.length) await outcome(this.reader.send('Storage.setCookies', { cookies }));
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2894
2927
|
async cleanupLeg() {
|
|
2928
|
+
await this.cleanupDomainCookies();
|
|
2895
2929
|
if (this.discovering)
|
|
2896
2930
|
await this.answered(this.client.send('Target.setDiscoverTargets', { discover: false }));
|
|
2897
2931
|
if (this.watch)
|
|
@@ -3077,6 +3111,8 @@ function variables(targets, target, side, slot, index) {
|
|
|
3077
3111
|
vars.protectedTarget = targets[target];
|
|
3078
3112
|
vars.target = side === 'control' ? vars.plain : targets[target];
|
|
3079
3113
|
vars.targetHost = new URL(vars.target).hostname;
|
|
3114
|
+
vars.targetParent =
|
|
3115
|
+
side === 'control' ? vars.targetHost : vars.targetHost.slice(vars.targetHost.indexOf('.') + 1);
|
|
3080
3116
|
vars.idp = ['idp', 'idp-stg'].includes(target)
|
|
3081
3117
|
? targets[target]
|
|
3082
3118
|
: (targets.idp ?? targets[target]);
|