Open-source AI browser agent for Chrome and Firefox (monorepo) ðŸ§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
fix(security, skills): fail closed on strict secret hydration and record default skill removals
Emre Sokulludcd3830ee2dd
diff --git a/src/chrome/src/background.js b/src/chrome/src/background.jsindex 385375ab0..663e78a2d 100644--- a/src/chrome/src/background.js+++ b/src/chrome/src/background.js@@ -191,6 +191,7 @@ Promise.all([console.warn('[WebBrain] Apocalypse Mode startup work could not be restored:', error);});const agent = new Agent(providerManager);+agent.strictSecretMode = true;agent.setStandaloneOfflineRagService(createOffscreenOfflineRetrievalService());const ALWAYS_ALLOW_API_MUTATIONS_KEY = 'alwaysAllowApiMutations';const alwaysAllowApiMutationsReady = chrome.storage.local@@ -243,6 +244,7 @@ const scheduler = new ScheduledJobManager({loadProviders: async () => {await customSkillsReady;await alwaysAllowApiMutationsReady;+ await strictSecretModeReady;if (providerManager.providers.size === 0) await providerManager.load();},sendUpdate: (tabId, type, data) => {@@ -566,8 +568,8 @@ async function loadImageBudget() {const imageBudgetReady = loadImageBudget().catch(() => {});async function loadStrictSecretMode() {- const stored = await chrome.storage.local.get('strictSecretMode');- agent.strictSecretMode = stored.strictSecretMode !== false;+ const stored = await chrome.storage.local.get('strictSecretMode').catch(() => ({}));+ agent.strictSecretMode = stored?.strictSecretMode !== false;}const strictSecretModeReady = loadStrictSecretMode().catch(() => {});diff --git a/src/chrome/src/ui/settings.js b/src/chrome/src/ui/settings.jsindex 9a69581b2..2a16dd7e0 100644--- a/src/chrome/src/ui/settings.js+++ b/src/chrome/src/ui/settings.js@@ -1163,7 +1163,7 @@ async function saveCustomSkills(nextSkills, opts = {}) {const update = { [CUSTOM_SKILLS_STORAGE_KEY]: customSkills };const removedSkill = opts.removedSkill;const installedSkill = opts.installedSkill;- const removedDefault = removedSkill?.sourceType === 'built-in' && DEFAULT_SKILL_IDS.has(removedSkill.id);+ const removedDefault = (removedSkill?.sourceType === 'built-in' || DEFAULT_SKILL_IDS.has(removedSkill?.id)) && DEFAULT_SKILL_IDS.has(removedSkill?.id);const installedDefault = installedSkill?.sourceType === 'built-in' && DEFAULT_SKILL_IDS.has(installedSkill.id);if (removedDefault || installedDefault) {const stored = await chrome.storage.local.get(DEFAULT_SKILLS_REMOVED_STORAGE_KEY);diff --git a/src/firefox/src/background.js b/src/firefox/src/background.jsindex e3c059a57..bc73b5ff9 100644--- a/src/firefox/src/background.js+++ b/src/firefox/src/background.js@@ -140,6 +140,7 @@ Promise.all([console.warn('[WebBrain] Apocalypse Mode schedules could not be restored:', error);});const agent = new Agent(providerManager);+agent.strictSecretMode = true;const ALWAYS_ALLOW_API_MUTATIONS_KEY = 'alwaysAllowApiMutations';const alwaysAllowApiMutationsReady = browser.storage.local.get({ [ALWAYS_ALLOW_API_MUTATIONS_KEY]: true })@@ -179,6 +180,7 @@ const scheduler = new ScheduledJobManager({loadProviders: async () => {await customSkillsReady;await alwaysAllowApiMutationsReady;+ await strictSecretModeReady;if (providerManager.providers.size === 0) await providerManager.load();},sendUpdate: (tabId, type, data) => {@@ -448,8 +450,8 @@ async function loadResearchEscalation() {const researchEscalationReady = loadResearchEscalation().catch(() => {});async function loadStrictSecretMode() {- const stored = await browser.storage.local.get('strictSecretMode');- agent.strictSecretMode = stored.strictSecretMode !== false;+ const stored = await browser.storage.local.get('strictSecretMode').catch(() => ({}));+ agent.strictSecretMode = stored?.strictSecretMode !== false;}const strictSecretModeReady = loadStrictSecretMode().catch(() => {});diff --git a/src/firefox/src/ui/settings.js b/src/firefox/src/ui/settings.jsindex fdb06b187..3e9e3c970 100644--- a/src/firefox/src/ui/settings.js+++ b/src/firefox/src/ui/settings.js@@ -925,7 +925,7 @@ async function saveCustomSkills(nextSkills, opts = {}) {const update = { [CUSTOM_SKILLS_STORAGE_KEY]: customSkills };const removedSkill = opts.removedSkill;const installedSkill = opts.installedSkill;- const removedDefault = removedSkill?.sourceType === 'built-in' && DEFAULT_SKILL_IDS.has(removedSkill.id);+ const removedDefault = (removedSkill?.sourceType === 'built-in' || DEFAULT_SKILL_IDS.has(removedSkill?.id)) && DEFAULT_SKILL_IDS.has(removedSkill.id);const installedDefault = installedSkill?.sourceType === 'built-in' && DEFAULT_SKILL_IDS.has(installedSkill.id);if (removedDefault || installedDefault) {const stored = await browser.storage.local.get(DEFAULT_SKILLS_REMOVED_STORAGE_KEY);