BlueGit

ict rusty-teams

refactor(session): one MSAL cache unseal helper for token fetch and sign-in check

- crates/session/assets/unseal.js holds the decryption of sealed MSAL entries
- fetch.js and the sign-in readiness script insert it instead of keeping their own copies

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-27 · 3 days ago

Hash
024e3bbed2b56f4192889575ecd553e592dd175f
Parent
c5f9d259
6 files changed +52 −59
crates/browser/src/browser.rs +1 −1
@@ -308,7 +308,7 @@ impl Browser {
308 308 if tab.parked {
309 309 return false;
310 310 }
311 let expression = crate::sign_in_ready::PAGE_EXPRESSION;
311 let expression = crate::sign_in_ready::PAGE_EXPRESSION.as_str();
312 312 if let Some(bidi) = &self.inner.bidi {
313 313 let evaluate = tokio::time::timeout(
314 314 self.inner.timeouts.probe,
@@ -308,7 +308,7 @@ impl Browser {
308 if tab.parked {
308 if tab.parked {
309 return false;
309 return false;
310 }
310 }
311 let expression = crate::sign_in_ready::PAGE_EXPRESSION;
311 let expression = crate::sign_in_ready::PAGE_EXPRESSION.as_str();
312 if let Some(bidi) = &self.inner.bidi {
312 if let Some(bidi) = &self.inner.bidi {
313 let evaluate = tokio::time::timeout(
313 let evaluate = tokio::time::timeout(
314 self.inner.timeouts.probe,
314 self.inner.timeouts.probe,
crates/browser/src/sign_in_ready.rs +8 −23
@@ -5,12 +5,17 @@
5 5 //! encryption cookie. Merely decrypting sealed entries is not enough either once the encryption
6 6 //! cookie persists across restarts, because an expired session still unseals its old entries.
7 7
8 use std::sync::LazyLock;
9
8 10 use serde_json::Value;
9 11
10 12 /// Page script. Returns `{opened, freshAccess}`. `opened` counts sealed entries decrypted with
11 13 /// the `msal.cache.encryption` cookie. `freshAccess` is a bearer access token whose `expiresOn`
12 14 /// is still in the future, in the clear or among the opened entries.
13 pub(crate) const PAGE_EXPRESSION: &str = r#"(async () => {
15 pub(crate) static PAGE_EXPRESSION: LazyLock<String> =
16 LazyLock::new(|| PAGE_TEMPLATE.replace("__UNSEAL__", session::UNSEAL_SCRIPT));
17
18 const PAGE_TEMPLATE: &str = r#"(async () => {
14 19 const sealed = [];
15 20 const plain = [];
16 21 for (let index = 0; index < localStorage.length; index++) {
@@ -21,28 +26,8 @@ pub(crate) const PAGE_EXPRESSION: &str = r#"(async () => {
21 26 if (entry.id && entry.nonce && entry.data) sealed.push([key, entry]);
22 27 else plain.push(entry);
23 28 }
24 const openedEntries = [];
25 const cookie = document.cookie.split(';').map((part) => part.trim()).find((part) => part.startsWith('msal.cache.encryption='));
26 let sealing = null;
27 try { sealing = cookie && JSON.parse(decodeURIComponent(cookie.slice(cookie.indexOf('=') + 1))); } catch (error) {}
28 if (sealing && sealing.key && sealing.id && sealed.length) {
29 const bytes = (text) => Uint8Array.from(atob(text.replace(/-/g, '+').replace(/_/g, '/').padEnd(Math.ceil(text.length / 4) * 4, '=')), (character) => character.charCodeAt(0));
30 const base = await crypto.subtle.importKey('raw', bytes(sealing.key), 'HKDF', false, ['deriveKey']);
31 for (const [key, entry] of sealed) {
32 if (entry.id !== sealing.id) continue;
33 const contexts = [...(String(key).match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi) || []), ''];
34 for (const context of new Set(contexts)) {
35 try {
36 const derived = await crypto.subtle.deriveKey(
37 {name: 'HKDF', salt: bytes(entry.nonce), hash: 'SHA-256', info: new TextEncoder().encode(context)},
38 base, {name: 'AES-GCM', length: 256}, false, ['decrypt']);
39 const data = await crypto.subtle.decrypt({name: 'AES-GCM', iv: new Uint8Array(12)}, derived, bytes(entry.data));
40 openedEntries.push(JSON.parse(new TextDecoder().decode(data)));
41 break;
42 } catch (error) {}
43 }
44 }
45 }
29 const unsealEntries = __UNSEAL__;
30 const openedEntries = (await unsealEntries(sealed, new Map())).map(([key, entry]) => entry);
46 31 const now = Date.now();
47 32 const fresh = (entry) => entry && entry.credentialType === 'AccessToken' && (!entry.tokenType || entry.tokenType === 'Bearer') && Number(entry.expiresOn) * 1000 > now && typeof entry.secret === 'string' && entry.secret.length > 0;
48 33 return {opened: openedEntries.length, freshAccess: plain.some(fresh) || openedEntries.some(fresh)};
@@ -5,12 +5,17 @@
5//! encryption cookie. Merely decrypting sealed entries is not enough either once the encryption
5//! encryption cookie. Merely decrypting sealed entries is not enough either once the encryption
6//! cookie persists across restarts, because an expired session still unseals its old entries.
6//! cookie persists across restarts, because an expired session still unseals its old entries.
7
7
8use std::sync::LazyLock;
9
8use serde_json::Value;
10use serde_json::Value;
9
11
10/// Page script. Returns `{opened, freshAccess}`. `opened` counts sealed entries decrypted with
12/// Page script. Returns `{opened, freshAccess}`. `opened` counts sealed entries decrypted with
11/// the `msal.cache.encryption` cookie. `freshAccess` is a bearer access token whose `expiresOn`
13/// the `msal.cache.encryption` cookie. `freshAccess` is a bearer access token whose `expiresOn`
12/// is still in the future, in the clear or among the opened entries.
14/// is still in the future, in the clear or among the opened entries.
13pub(crate) const PAGE_EXPRESSION: &str = r#"(async () => {
15pub(crate) static PAGE_EXPRESSION: LazyLock<String> =
16 LazyLock::new(|| PAGE_TEMPLATE.replace("__UNSEAL__", session::UNSEAL_SCRIPT));
17
18const PAGE_TEMPLATE: &str = r#"(async () => {
14 const sealed = [];
19 const sealed = [];
15 const plain = [];
20 const plain = [];
16 for (let index = 0; index < localStorage.length; index++) {
21 for (let index = 0; index < localStorage.length; index++) {
@@ -21,28 +26,8 @@ pub(crate) const PAGE_EXPRESSION: &str = r#"(async () => {
21 if (entry.id && entry.nonce && entry.data) sealed.push([key, entry]);
26 if (entry.id && entry.nonce && entry.data) sealed.push([key, entry]);
22 else plain.push(entry);
27 else plain.push(entry);
23 }
28 }
24 const openedEntries = [];
29 const unsealEntries = __UNSEAL__;
25 const cookie = document.cookie.split(';').map((part) => part.trim()).find((part) => part.startsWith('msal.cache.encryption='));
30 const openedEntries = (await unsealEntries(sealed, new Map())).map(([key, entry]) => entry);
26 let sealing = null;
27 try { sealing = cookie && JSON.parse(decodeURIComponent(cookie.slice(cookie.indexOf('=') + 1))); } catch (error) {}
28 if (sealing && sealing.key && sealing.id && sealed.length) {
29 const bytes = (text) => Uint8Array.from(atob(text.replace(/-/g, '+').replace(/_/g, '/').padEnd(Math.ceil(text.length / 4) * 4, '=')), (character) => character.charCodeAt(0));
30 const base = await crypto.subtle.importKey('raw', bytes(sealing.key), 'HKDF', false, ['deriveKey']);
31 for (const [key, entry] of sealed) {
32 if (entry.id !== sealing.id) continue;
33 const contexts = [...(String(key).match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi) || []), ''];
34 for (const context of new Set(contexts)) {
35 try {
36 const derived = await crypto.subtle.deriveKey(
37 {name: 'HKDF', salt: bytes(entry.nonce), hash: 'SHA-256', info: new TextEncoder().encode(context)},
38 base, {name: 'AES-GCM', length: 256}, false, ['decrypt']);
39 const data = await crypto.subtle.decrypt({name: 'AES-GCM', iv: new Uint8Array(12)}, derived, bytes(entry.data));
40 openedEntries.push(JSON.parse(new TextDecoder().decode(data)));
41 break;
42 } catch (error) {}
43 }
44 }
45 }
46 const now = Date.now();
31 const now = Date.now();
47 const fresh = (entry) => entry && entry.credentialType === 'AccessToken' && (!entry.tokenType || entry.tokenType === 'Bearer') && Number(entry.expiresOn) * 1000 > now && typeof entry.secret === 'string' && entry.secret.length > 0;
32 const fresh = (entry) => entry && entry.credentialType === 'AccessToken' && (!entry.tokenType || entry.tokenType === 'Bearer') && Number(entry.expiresOn) * 1000 > now && typeof entry.secret === 'string' && entry.secret.length > 0;
48 return {opened: openedEntries.length, freshAccess: plain.some(fresh) || openedEntries.some(fresh)};
33 return {opened: openedEntries.length, freshAccess: plain.some(fresh) || openedEntries.some(fresh)};
crates/session/assets/fetch.js +6 −31
@@ -19,39 +19,14 @@
19 19 else take(key, entry);
20 20 }
21 21 const plain = entries.length;
22 // Newer MSAL.js seals its localStorage cache: AES-GCM under a key from the msal.cache.encryption session cookie.
23 const unseal = async () => {
24 const cookie = document.cookie.split(';').map((part) => part.trim()).find((part) => part.startsWith('msal.cache.encryption='));
25 let sealing = null;
26 try { sealing = cookie && JSON.parse(decodeURIComponent(cookie.slice(cookie.indexOf('=') + 1))); } catch (error) {}
27 if (!sealing || !sealing.key || !sealing.id) return;
28 const bytes = (text) => Uint8Array.from(atob(text.replace(/-/g, '+').replace(/_/g, '/').padEnd(Math.ceil(text.length / 4) * 4, '=')),
29 (character) => character.charCodeAt(0));
22 if (sealed.length) {
23 const unsealEntries = __UNSEAL__;
30 24 const memo = (window.__rustyTeamsUnsealed = window.__rustyTeamsUnsealed || new Map());
31 const base = await crypto.subtle.importKey('raw', bytes(sealing.key), 'HKDF', false, ['deriveKey']);
32 for (const [key, entry] of sealed) {
33 if (entry.id !== sealing.id) continue;
34 if (!memo.has(entry.nonce)) {
35 // MSAL binds an entry to the client id in its key, or to an empty context when the key has none.
36 const contexts = [...(key.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi) || []), ''];
37 for (const context of new Set(contexts)) {
38 try {
39 const derived = await crypto.subtle.deriveKey(
40 {name: 'HKDF', salt: bytes(entry.nonce), hash: 'SHA-256', info: new TextEncoder().encode(context)},
41 base, {name: 'AES-GCM', length: 256}, false, ['decrypt']);
42 const data = await crypto.subtle.decrypt({name: 'AES-GCM', iv: new Uint8Array(12)}, derived, bytes(entry.data));
43 memo.set(entry.nonce, JSON.parse(new TextDecoder().decode(data)));
44 break;
45 } catch (error) {}
46 }
47 }
48 if (memo.has(entry.nonce)) {
49 take(key, memo.get(entry.nonce));
50 opened++;
51 }
25 for (const [key, entry] of await unsealEntries(sealed, memo)) {
26 take(key, entry);
27 opened++;
52 28 }
53 };
54 if (sealed.length) await unseal();
29 }
55 30 const ownAccount = (entry) => !activeHome || entry.homeAccountId === activeHome;
56 31 const homeTenant = (entry) => (entry.homeAccountId || '').split('.')[1];
57 32 // Without a tenant the account's home tenant; a guest tenant is reached with the same account's refresh token.
@@ -19,39 +19,14 @@
19 else take(key, entry);
19 else take(key, entry);
20 }
20 }
21 const plain = entries.length;
21 const plain = entries.length;
22 // Newer MSAL.js seals its localStorage cache: AES-GCM under a key from the msal.cache.encryption session cookie.
22 if (sealed.length) {
23 const unseal = async () => {
23 const unsealEntries = __UNSEAL__;
24 const cookie = document.cookie.split(';').map((part) => part.trim()).find((part) => part.startsWith('msal.cache.encryption='));
25 let sealing = null;
26 try { sealing = cookie && JSON.parse(decodeURIComponent(cookie.slice(cookie.indexOf('=') + 1))); } catch (error) {}
27 if (!sealing || !sealing.key || !sealing.id) return;
28 const bytes = (text) => Uint8Array.from(atob(text.replace(/-/g, '+').replace(/_/g, '/').padEnd(Math.ceil(text.length / 4) * 4, '=')),
29 (character) => character.charCodeAt(0));
30 const memo = (window.__rustyTeamsUnsealed = window.__rustyTeamsUnsealed || new Map());
24 const memo = (window.__rustyTeamsUnsealed = window.__rustyTeamsUnsealed || new Map());
31 const base = await crypto.subtle.importKey('raw', bytes(sealing.key), 'HKDF', false, ['deriveKey']);
25 for (const [key, entry] of await unsealEntries(sealed, memo)) {
32 for (const [key, entry] of sealed) {
26 take(key, entry);
33 if (entry.id !== sealing.id) continue;
27 opened++;
34 if (!memo.has(entry.nonce)) {
35 // MSAL binds an entry to the client id in its key, or to an empty context when the key has none.
36 const contexts = [...(key.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi) || []), ''];
37 for (const context of new Set(contexts)) {
38 try {
39 const derived = await crypto.subtle.deriveKey(
40 {name: 'HKDF', salt: bytes(entry.nonce), hash: 'SHA-256', info: new TextEncoder().encode(context)},
41 base, {name: 'AES-GCM', length: 256}, false, ['decrypt']);
42 const data = await crypto.subtle.decrypt({name: 'AES-GCM', iv: new Uint8Array(12)}, derived, bytes(entry.data));
43 memo.set(entry.nonce, JSON.parse(new TextDecoder().decode(data)));
44 break;
45 } catch (error) {}
46 }
47 }
48 if (memo.has(entry.nonce)) {
49 take(key, memo.get(entry.nonce));
50 opened++;
51 }
52 }
28 }
53 };
29 }
54 if (sealed.length) await unseal();
55 const ownAccount = (entry) => !activeHome || entry.homeAccountId === activeHome;
30 const ownAccount = (entry) => !activeHome || entry.homeAccountId === activeHome;
56 const homeTenant = (entry) => (entry.homeAccountId || '').split('.')[1];
31 const homeTenant = (entry) => (entry.homeAccountId || '').split('.')[1];
57 // Without a tenant the account's home tenant; a guest tenant is reached with the same account's refresh token.
32 // Without a tenant the account's home tenant; a guest tenant is reached with the same account's refresh token.
crates/session/assets/unseal.js added +31 −0
@@ -0,0 +1,31 @@
1 // Newer MSAL.js seals its localStorage cache: AES-GCM under a key from the msal.cache.encryption session cookie.
2 // Answers [key, entry] for every sealed entry it could open. `memo` keeps opened entries by nonce.
3 async (sealed, memo) => {
4 const opened = [];
5 const cookie = document.cookie.split(';').map((part) => part.trim()).find((part) => part.startsWith('msal.cache.encryption='));
6 let sealing = null;
7 try { sealing = cookie && JSON.parse(decodeURIComponent(cookie.slice(cookie.indexOf('=') + 1))); } catch (error) {}
8 if (!sealing || !sealing.key || !sealing.id || !sealed.length) return opened;
9 const bytes = (text) => Uint8Array.from(atob(text.replace(/-/g, '+').replace(/_/g, '/').padEnd(Math.ceil(text.length / 4) * 4, '=')),
10 (character) => character.charCodeAt(0));
11 const base = await crypto.subtle.importKey('raw', bytes(sealing.key), 'HKDF', false, ['deriveKey']);
12 for (const [key, entry] of sealed) {
13 if (entry.id !== sealing.id) continue;
14 if (!memo.has(entry.nonce)) {
15 // MSAL binds an entry to the client id in its key, or to an empty context when the key has none.
16 const contexts = [...(String(key).match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi) || []), ''];
17 for (const context of new Set(contexts)) {
18 try {
19 const derived = await crypto.subtle.deriveKey(
20 {name: 'HKDF', salt: bytes(entry.nonce), hash: 'SHA-256', info: new TextEncoder().encode(context)},
21 base, {name: 'AES-GCM', length: 256}, false, ['decrypt']);
22 const data = await crypto.subtle.decrypt({name: 'AES-GCM', iv: new Uint8Array(12)}, derived, bytes(entry.data));
23 memo.set(entry.nonce, JSON.parse(new TextDecoder().decode(data)));
24 break;
25 } catch (error) {}
26 }
27 }
28 if (memo.has(entry.nonce)) opened.push([key, memo.get(entry.nonce)]);
29 }
30 return opened;
31 }
@@ -0,0 +1,31 @@
1// Newer MSAL.js seals its localStorage cache: AES-GCM under a key from the msal.cache.encryption session cookie.
2// Answers [key, entry] for every sealed entry it could open. `memo` keeps opened entries by nonce.
3async (sealed, memo) => {
4 const opened = [];
5 const cookie = document.cookie.split(';').map((part) => part.trim()).find((part) => part.startsWith('msal.cache.encryption='));
6 let sealing = null;
7 try { sealing = cookie && JSON.parse(decodeURIComponent(cookie.slice(cookie.indexOf('=') + 1))); } catch (error) {}
8 if (!sealing || !sealing.key || !sealing.id || !sealed.length) return opened;
9 const bytes = (text) => Uint8Array.from(atob(text.replace(/-/g, '+').replace(/_/g, '/').padEnd(Math.ceil(text.length / 4) * 4, '=')),
10 (character) => character.charCodeAt(0));
11 const base = await crypto.subtle.importKey('raw', bytes(sealing.key), 'HKDF', false, ['deriveKey']);
12 for (const [key, entry] of sealed) {
13 if (entry.id !== sealing.id) continue;
14 if (!memo.has(entry.nonce)) {
15 // MSAL binds an entry to the client id in its key, or to an empty context when the key has none.
16 const contexts = [...(String(key).match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi) || []), ''];
17 for (const context of new Set(contexts)) {
18 try {
19 const derived = await crypto.subtle.deriveKey(
20 {name: 'HKDF', salt: bytes(entry.nonce), hash: 'SHA-256', info: new TextEncoder().encode(context)},
21 base, {name: 'AES-GCM', length: 256}, false, ['decrypt']);
22 const data = await crypto.subtle.decrypt({name: 'AES-GCM', iv: new Uint8Array(12)}, derived, bytes(entry.data));
23 memo.set(entry.nonce, JSON.parse(new TextDecoder().decode(data)));
24 break;
25 } catch (error) {}
26 }
27 }
28 if (memo.has(entry.nonce)) opened.push([key, memo.get(entry.nonce)]);
29 }
30 return opened;
31}
crates/session/src/lib.rs +1 −1
@@ -18,5 +18,5 @@ pub use request::{
18 18 ApiResponse, AugloopExchange, AugloopStage, BodyToken, Method, Request, SignalrExchange,
19 19 };
20 20 pub use scope::{GRAPH, IC3, NestedApp, PRESENCE, SPACES, Scope};
21 pub use session::{DEFAULT_ENDPOINT, Session, SessionConfig, TabHold};
21 pub use session::{DEFAULT_ENDPOINT, Session, SessionConfig, TabHold, UNSEAL_SCRIPT};
22 22 pub use transport::{BoxFuture, CdpTransport, Diagnosis, OpenedTab, Transport};
@@ -18,5 +18,5 @@ pub use request::{
18 ApiResponse, AugloopExchange, AugloopStage, BodyToken, Method, Request, SignalrExchange,
18 ApiResponse, AugloopExchange, AugloopStage, BodyToken, Method, Request, SignalrExchange,
19};
19};
20pub use scope::{GRAPH, IC3, NestedApp, PRESENCE, SPACES, Scope};
20pub use scope::{GRAPH, IC3, NestedApp, PRESENCE, SPACES, Scope};
21pub use session::{DEFAULT_ENDPOINT, Session, SessionConfig, TabHold};
21pub use session::{DEFAULT_ENDPOINT, Session, SessionConfig, TabHold, UNSEAL_SCRIPT};
22pub use transport::{BoxFuture, CdpTransport, Diagnosis, OpenedTab, Transport};
22pub use transport::{BoxFuture, CdpTransport, Diagnosis, OpenedTab, Transport};
crates/session/src/session.rs +5 −3
@@ -1,6 +1,6 @@
1 1 use std::collections::{HashMap, HashSet};
2 use std::sync::Arc;
3 2 use std::sync::atomic::{AtomicBool, Ordering};
3 use std::sync::{Arc, LazyLock};
4 4 use std::time::Duration;
5 5
6 6 use serde_json::{Value, json};
@@ -16,7 +16,9 @@ use crate::scope::Scope;
16 16 use crate::transport::{CdpTransport, Transport};
17 17
18 18 pub const DEFAULT_ENDPOINT: &str = "http://127.0.0.1:9222";
19 pub(crate) const FETCH_SCRIPT: &str = include_str!("../assets/fetch.js");
19 pub const UNSEAL_SCRIPT: &str = include_str!("../assets/unseal.js");
20 pub(crate) static FETCH_SCRIPT: LazyLock<String> =
21 LazyLock::new(|| include_str!("../assets/fetch.js").replace("__UNSEAL__", UNSEAL_SCRIPT));
20 22 pub(crate) const NOT_GRANTED_PREFIX: &str = "the app is not granted";
21 23 const MAX_DOWNLOAD_BYTES: u64 = 60 * 1024 * 1024;
22 24 const DEFAULT_CONCURRENCY: usize = 6;
@@ -278,7 +280,7 @@ impl Session {
278 280 search: &mut TokenSearch,
279 281 ) -> Result<Option<Vec<ApiResponse>>> {
280 282 let payload = self.payload(requests, scope);
281 let expression = format!("({FETCH_SCRIPT})({payload})");
283 let expression = format!("({})({payload})", FETCH_SCRIPT.as_str());
282 284 let has_write = requests.iter().any(|request| request.method != Method::Get);
283 285 for app in App::ALL {
284 286 let outcome = match self.evaluate_in(app, &expression).await {
@@ -1,6 +1,6 @@
1use std::collections::{HashMap, HashSet};
1use std::collections::{HashMap, HashSet};
2use std::sync::Arc;
3use std::sync::atomic::{AtomicBool, Ordering};
2use std::sync::atomic::{AtomicBool, Ordering};
3use std::sync::{Arc, LazyLock};
4use std::time::Duration;
4use std::time::Duration;
5
5
6use serde_json::{Value, json};
6use serde_json::{Value, json};
@@ -16,7 +16,9 @@ use crate::scope::Scope;
16use crate::transport::{CdpTransport, Transport};
16use crate::transport::{CdpTransport, Transport};
17
17
18pub const DEFAULT_ENDPOINT: &str = "http://127.0.0.1:9222";
18pub const DEFAULT_ENDPOINT: &str = "http://127.0.0.1:9222";
19pub(crate) const FETCH_SCRIPT: &str = include_str!("../assets/fetch.js");
19pub const UNSEAL_SCRIPT: &str = include_str!("../assets/unseal.js");
20pub(crate) static FETCH_SCRIPT: LazyLock<String> =
21 LazyLock::new(|| include_str!("../assets/fetch.js").replace("__UNSEAL__", UNSEAL_SCRIPT));
20pub(crate) const NOT_GRANTED_PREFIX: &str = "the app is not granted";
22pub(crate) const NOT_GRANTED_PREFIX: &str = "the app is not granted";
21const MAX_DOWNLOAD_BYTES: u64 = 60 * 1024 * 1024;
23const MAX_DOWNLOAD_BYTES: u64 = 60 * 1024 * 1024;
22const DEFAULT_CONCURRENCY: usize = 6;
24const DEFAULT_CONCURRENCY: usize = 6;
@@ -278,7 +280,7 @@ impl Session {
278 search: &mut TokenSearch,
280 search: &mut TokenSearch,
279 ) -> Result<Option<Vec<ApiResponse>>> {
281 ) -> Result<Option<Vec<ApiResponse>>> {
280 let payload = self.payload(requests, scope);
282 let payload = self.payload(requests, scope);
281 let expression = format!("({FETCH_SCRIPT})({payload})");
283 let expression = format!("({})({payload})", FETCH_SCRIPT.as_str());
282 let has_write = requests.iter().any(|request| request.method != Method::Get);
284 let has_write = requests.iter().any(|request| request.method != Method::Get);
283 for app in App::ALL {
285 for app in App::ALL {
284 let outcome = match self.evaluate_in(app, &expression).await {
286 let outcome = match self.evaluate_in(app, &expression).await {