mirror of
https://github.com/pvrzz/Portage.git
synced 2026-11-29 05:22:26 +00:00
feat: encrypted offline all-origin Firefox localStorage migration
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
name: Unit tests
|
||||
on:
|
||||
push:
|
||||
branches: [main, feat/profile-storage-migration]
|
||||
pull_request:
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
- name: Python tests
|
||||
run: python3 -m unittest discover -s tests -p 'test_*.py'
|
||||
- name: Browser API mock tests
|
||||
run: node tests/test_storage_browser.cjs
|
||||
- name: JavaScript syntax
|
||||
run: |
|
||||
node --check chrome/dashboard.js
|
||||
node --check firefox/dashboard.js
|
||||
node --check tools/chromium_localstorage_import.cjs
|
||||
node --check tests/e2e_cross_browser.cjs
|
||||
- name: CLI help
|
||||
run: node tools/chromium_localstorage_import.cjs --help
|
||||
@@ -1,3 +1,4 @@
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*.portage.json
|
||||
tools/node_modules/
|
||||
|
||||
@@ -64,12 +64,6 @@ Check the releases tab of the repo, or go to the website for Portage at: https:/
|
||||
1. **Export:** Open Portage on your old browser, click **Scan**, uncheck anything you want to leave behind, and hit **Export bundle**. It drops the JSON (and the optional extension checklist) right to your downloads.
|
||||
2. **Import:** Open Portage on your new browser, drag and drop the `.portage.json` file, review the stats, and hit **Import selected**.
|
||||
|
||||
## Experimental: entire Firefox localStorage profile (Linux)
|
||||
## Experimental: whole-profile Firefox LocalStorage transfer (Linux)
|
||||
|
||||
The browser's WebExtension APIs cannot enumerate every origin's localStorage.
|
||||
For a read-only **all-site** Firefox profile exporter and an import flow that
|
||||
visits each origin in a temporary background tab, see
|
||||
[tools/README.md](tools/README.md). This is **not** limited to currently open
|
||||
tabs, but is still best-effort: IndexedDB, sessionStorage, and device-bound
|
||||
credentials are not migrated. Exports can contain active authentication tokens,
|
||||
so handle them as sensitive files.
|
||||
Optional Python + Node helpers can migrate **all compatible first-party origins**, not just open tabs, to a closed Chrome/Brave profile. Export is encrypted by default; import uses intercepted inert responses rather than contacting websites. See the [step-by-step CLI and privacy limitations](tools/README.md). This does **not** include IndexedDB or guarantee login-session preservation.
|
||||
|
||||
+2
-62
@@ -253,61 +253,6 @@ async function importCookies(items, onProg) {
|
||||
onProg(total, total); return { imported, skipped };
|
||||
}
|
||||
|
||||
// A companion read-only Python CLI enumerates *every* compatible Firefox LSNG
|
||||
// database in the profile. This import is NOT restricted to currently open tabs.
|
||||
// WebExtension scripting is origin-scoped, so we temporarily visit each origin
|
||||
// in a background tab to seed its localStorage, then close that tab.
|
||||
function isSafeStorageOrigin(origin) {
|
||||
try {
|
||||
const u = new URL(origin);
|
||||
return ["https:", "http:"].includes(u.protocol) && u.origin === origin && !u.username && !u.password;
|
||||
} catch { return false; }
|
||||
}
|
||||
async function importLocalStorage(sites, onProg) {
|
||||
const total = sites.length; let imported = 0, skipped = 0;
|
||||
if (!api.scripting?.executeScript) throw new Error("The scripting permission is unavailable");
|
||||
for (let i = 0; i < total; i++) {
|
||||
const site = sites[i];
|
||||
let tab;
|
||||
try {
|
||||
if (!isSafeStorageOrigin(site.origin) || !site.items ||
|
||||
typeof site.items !== "object" || Array.isArray(site.items) ||
|
||||
Object.values(site.items).some((v) => typeof v !== "string")) throw new Error("Invalid origin or values");
|
||||
tab = await api.tabs.create({ url: site.origin, active: false });
|
||||
await new Promise((resolve, reject) => {
|
||||
const timeout = setTimeout(() => { api.tabs.onUpdated.removeListener(listener); reject(new Error("Timed out")); }, 12000);
|
||||
const listener = (id, changeInfo) => {
|
||||
if (id === tab.id && changeInfo.status === "complete") {
|
||||
clearTimeout(timeout); api.tabs.onUpdated.removeListener(listener); resolve();
|
||||
}
|
||||
};
|
||||
api.tabs.onUpdated.addListener(listener);
|
||||
// Covers a tab finishing before listener registration.
|
||||
api.tabs.get(tab.id).then((t) => { if (t.status === "complete") listener(tab.id, { status: "complete" }); }).catch(() => {});
|
||||
});
|
||||
// Never write a saved origin's keys into a different (redirected) site.
|
||||
const loaded = await api.tabs.get(tab.id);
|
||||
if (!loaded.url || new URL(loaded.url).origin !== site.origin) throw new Error("Origin redirected");
|
||||
const result = await api.scripting.executeScript({
|
||||
target: { tabId: tab.id },
|
||||
func: (entries) => {
|
||||
let written = 0;
|
||||
for (const [k, v] of Object.entries(entries)) { localStorage.setItem(k, v); written++; }
|
||||
return written;
|
||||
},
|
||||
args: [site.items],
|
||||
});
|
||||
if (result?.[0]?.result === Object.keys(site.items).length) imported++; else skipped++;
|
||||
} catch { skipped++; }
|
||||
finally {
|
||||
if (tab?.id) { try { await api.tabs.remove(tab.id); } catch {} }
|
||||
onProg(i + 1, total);
|
||||
if (i % 10 === 0) await tick();
|
||||
}
|
||||
}
|
||||
return { imported, skipped };
|
||||
}
|
||||
|
||||
async function importTabs(items, onProg) {
|
||||
const total = items.length; let imported = 0, skipped = 0;
|
||||
for (let i = 0; i < total; i++) {
|
||||
@@ -347,20 +292,19 @@ async function importReadingList(items, onProg) {
|
||||
const CATS = {
|
||||
bookmarks: { label: "Bookmarks", unit: "bookmarks", icon: SVG.bookmarks, level: "full", desc: "Full bookmark tree, folders and all", importFx: "Created in a 'Portage Import' folder", collect: collectBookmarks, count: countBookmarks, importRun: importBookmarks },
|
||||
history: { label: "History", unit: "pages", icon: SVG.history, level: "full", desc: "Pages you've visited, with timestamps", importFx: IS_FIREFOX ? "Re-added with titles & times" : "Re-added as visits", collect: collectHistory, count: (d) => d.length, importRun: importHistory },
|
||||
localStorage: { label: "LocalStorage", unit: "origins", icon: SVG.cookies, level: "partial", desc: "All-site Firefox profile storage (offline CLI bundle)", importFx: "Visits each origin temporarily to restore saved keys", collect: null, count: (d) => d.length, importRun: importLocalStorage, externalImportOnly: true },
|
||||
cookies: { label: "Cookies", unit: "cookies", icon: SVG.cookies, level: "full", desc: "Site cookies — keeps you signed in", importFx: "Re-set so logins carry over", collect: collectCookies, count: (d) => d.length, importRun: importCookies },
|
||||
tabs: { label: "Open tabs", unit: "tabs", icon: SVG.tabs, level: "full", desc: "Tabs open right now, every window", importFx: "Reopened in this window", collect: collectTabs, count: (d) => d.length, importRun: importTabs },
|
||||
sessions: { label: "Recently closed", unit: "sessions", icon: SVG.sessions, level: "partial", desc: "Tabs & windows you closed recently", importFx: "Reopened as tabs", collect: collectSessions, count: countSessions, importRun: importSessions },
|
||||
readingList: { label: "Reading list", unit: "entries", icon: SVG.reading, level: HAS_READINGLIST ? "full" : "partial", desc: "Pages saved to read later", importFx: HAS_READINGLIST ? "Added to the reading list" : "Saved to a bookmark folder", collect: collectReadingList, count: (d) => d.length, importRun: importReadingList, needsReadingList: true },
|
||||
extensions: { label: "Extensions", unit: "installed", icon: SVG.extensions, level: "checklist", desc: "Installed add-ons → reinstall checklist", importFx: "Can't auto-install — use the .txt checklist", collect: collectExtensions, count: (d) => d.length, importRun: null, special: true },
|
||||
};
|
||||
const ORDER = ["bookmarks", "history", "cookies", "localStorage", "tabs", "sessions", "readingList", "extensions"];
|
||||
const ORDER = ["bookmarks", "history", "cookies", "tabs", "sessions", "readingList", "extensions"];
|
||||
|
||||
const exState = {};
|
||||
let scanned = false;
|
||||
const exGrid = document.getElementById("exportGrid");
|
||||
|
||||
function exportCategoryIds() { return ORDER.filter((id) => !CATS[id].externalImportOnly && !(CATS[id].needsReadingList && !HAS_READINGLIST)); }
|
||||
function exportCategoryIds() { return ORDER.filter((id) => !(CATS[id].needsReadingList && !HAS_READINGLIST)); }
|
||||
|
||||
function makeCard(id, c, opts) {
|
||||
const el = document.createElement("div");
|
||||
@@ -668,10 +612,6 @@ function updateImportTotals() {
|
||||
}
|
||||
|
||||
async function runImport() {
|
||||
if (imState.localStorage?.selected && !window.confirm(
|
||||
"LocalStorage import will visit every saved site in temporary background tabs. " +
|
||||
"This sends network requests and may trigger website activity. Continue?"
|
||||
)) return;
|
||||
const btn = document.getElementById("importBtn"); const orig = btn.innerHTML;
|
||||
btn.disabled = true; btn.innerHTML = '<span class="spinner"></span> Importing…';
|
||||
document.getElementById("impbarWrap").classList.remove("hidden");
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
"tabs",
|
||||
"sessions",
|
||||
"management",
|
||||
"readingList",
|
||||
"scripting"
|
||||
"readingList"
|
||||
],
|
||||
"host_permissions": [
|
||||
"<all_urls>"
|
||||
|
||||
+2
-62
@@ -256,61 +256,6 @@ async function importCookies(items, onProg) {
|
||||
onProg(total, total); return { imported, skipped };
|
||||
}
|
||||
|
||||
// A companion read-only Python CLI enumerates *every* compatible Firefox LSNG
|
||||
// database in the profile. This import is NOT restricted to currently open tabs.
|
||||
// WebExtension scripting is origin-scoped, so we temporarily visit each origin
|
||||
// in a background tab to seed its localStorage, then close that tab.
|
||||
function isSafeStorageOrigin(origin) {
|
||||
try {
|
||||
const u = new URL(origin);
|
||||
return ["https:", "http:"].includes(u.protocol) && u.origin === origin && !u.username && !u.password;
|
||||
} catch { return false; }
|
||||
}
|
||||
async function importLocalStorage(sites, onProg) {
|
||||
const total = sites.length; let imported = 0, skipped = 0;
|
||||
if (!api.scripting?.executeScript) throw new Error("The scripting permission is unavailable");
|
||||
for (let i = 0; i < total; i++) {
|
||||
const site = sites[i];
|
||||
let tab;
|
||||
try {
|
||||
if (!isSafeStorageOrigin(site.origin) || !site.items ||
|
||||
typeof site.items !== "object" || Array.isArray(site.items) ||
|
||||
Object.values(site.items).some((v) => typeof v !== "string")) throw new Error("Invalid origin or values");
|
||||
tab = await api.tabs.create({ url: site.origin, active: false });
|
||||
await new Promise((resolve, reject) => {
|
||||
const timeout = setTimeout(() => { api.tabs.onUpdated.removeListener(listener); reject(new Error("Timed out")); }, 12000);
|
||||
const listener = (id, changeInfo) => {
|
||||
if (id === tab.id && changeInfo.status === "complete") {
|
||||
clearTimeout(timeout); api.tabs.onUpdated.removeListener(listener); resolve();
|
||||
}
|
||||
};
|
||||
api.tabs.onUpdated.addListener(listener);
|
||||
// Covers a tab finishing before listener registration.
|
||||
api.tabs.get(tab.id).then((t) => { if (t.status === "complete") listener(tab.id, { status: "complete" }); }).catch(() => {});
|
||||
});
|
||||
// Never write a saved origin's keys into a different (redirected) site.
|
||||
const loaded = await api.tabs.get(tab.id);
|
||||
if (!loaded.url || new URL(loaded.url).origin !== site.origin) throw new Error("Origin redirected");
|
||||
const result = await api.scripting.executeScript({
|
||||
target: { tabId: tab.id },
|
||||
func: (entries) => {
|
||||
let written = 0;
|
||||
for (const [k, v] of Object.entries(entries)) { localStorage.setItem(k, v); written++; }
|
||||
return written;
|
||||
},
|
||||
args: [site.items],
|
||||
});
|
||||
if (result?.[0]?.result === Object.keys(site.items).length) imported++; else skipped++;
|
||||
} catch { skipped++; }
|
||||
finally {
|
||||
if (tab?.id) { try { await api.tabs.remove(tab.id); } catch {} }
|
||||
onProg(i + 1, total);
|
||||
if (i % 10 === 0) await tick();
|
||||
}
|
||||
}
|
||||
return { imported, skipped };
|
||||
}
|
||||
|
||||
async function importTabs(items, onProg) {
|
||||
const total = items.length; let imported = 0, skipped = 0;
|
||||
for (let i = 0; i < total; i++) {
|
||||
@@ -350,20 +295,19 @@ async function importReadingList(items, onProg) {
|
||||
const CATS = {
|
||||
bookmarks: { label: "Bookmarks", unit: "bookmarks", icon: SVG.bookmarks, level: "full", desc: "Full bookmark tree, folders and all", importFx: "Created in a 'Portage Import' folder", collect: collectBookmarks, count: countBookmarks, importRun: importBookmarks },
|
||||
history: { label: "History", unit: "pages", icon: SVG.history, level: "full", desc: "Pages you've visited, with timestamps", importFx: IS_FIREFOX ? "Re-added with titles & times" : "Re-added as visits", collect: collectHistory, count: (d) => d.length, importRun: importHistory },
|
||||
localStorage: { label: "LocalStorage", unit: "origins", icon: SVG.cookies, level: "partial", desc: "All-site Firefox profile storage (offline CLI bundle)", importFx: "Visits each origin temporarily to restore saved keys", collect: null, count: (d) => d.length, importRun: importLocalStorage, externalImportOnly: true },
|
||||
cookies: { label: "Cookies", unit: "cookies", icon: SVG.cookies, level: "full", desc: "Site cookies — keeps you signed in", importFx: "Re-set so logins carry over", collect: collectCookies, count: (d) => d.length, importRun: importCookies },
|
||||
tabs: { label: "Open tabs", unit: "tabs", icon: SVG.tabs, level: "full", desc: "Tabs open right now, every window", importFx: "Reopened in this window", collect: collectTabs, count: (d) => d.length, importRun: importTabs },
|
||||
sessions: { label: "Recently closed", unit: "sessions", icon: SVG.sessions, level: "partial", desc: "Tabs & windows you closed recently", importFx: "Reopened as tabs", collect: collectSessions, count: countSessions, importRun: importSessions },
|
||||
readingList: { label: "Reading list", unit: "entries", icon: SVG.reading, level: HAS_READINGLIST ? "full" : "partial", desc: "Pages saved to read later", importFx: HAS_READINGLIST ? "Added to the reading list" : "Saved to a bookmark folder", collect: collectReadingList, count: (d) => d.length, importRun: importReadingList, needsReadingList: true },
|
||||
extensions: { label: "Extensions", unit: "installed", icon: SVG.extensions, level: "checklist", desc: "Installed add-ons → reinstall checklist", importFx: "Can't auto-install — use the .txt checklist", collect: collectExtensions, count: (d) => d.length, importRun: null, special: true },
|
||||
};
|
||||
const ORDER = ["bookmarks", "history", "cookies", "localStorage", "tabs", "sessions", "readingList", "extensions"];
|
||||
const ORDER = ["bookmarks", "history", "cookies", "tabs", "sessions", "readingList", "extensions"];
|
||||
|
||||
const exState = {};
|
||||
let scanned = false;
|
||||
const exGrid = document.getElementById("exportGrid");
|
||||
|
||||
function exportCategoryIds() { return ORDER.filter((id) => !CATS[id].externalImportOnly && !(CATS[id].needsReadingList && !HAS_READINGLIST)); }
|
||||
function exportCategoryIds() { return ORDER.filter((id) => !(CATS[id].needsReadingList && !HAS_READINGLIST)); }
|
||||
|
||||
function makeCard(id, c, opts) {
|
||||
const el = document.createElement("div");
|
||||
@@ -671,10 +615,6 @@ function updateImportTotals() {
|
||||
}
|
||||
|
||||
async function runImport() {
|
||||
if (imState.localStorage?.selected && !window.confirm(
|
||||
"LocalStorage import will visit every saved site in temporary background tabs. " +
|
||||
"This sends network requests and may trigger website activity. Continue?"
|
||||
)) return;
|
||||
const btn = document.getElementById("importBtn"); const orig = btn.innerHTML;
|
||||
btn.disabled = true; btn.innerHTML = '<span class="spinner"></span> Importing…';
|
||||
document.getElementById("impbarWrap").classList.remove("hidden");
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
"cookies",
|
||||
"tabs",
|
||||
"sessions",
|
||||
"management",
|
||||
"scripting"
|
||||
"management"
|
||||
],
|
||||
"host_permissions": [
|
||||
"<all_urls>"
|
||||
|
||||
+3
-23
@@ -7,7 +7,7 @@ const http = require('node:http');
|
||||
const os = require('node:os');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const puppeteer = require('puppeteer');
|
||||
let puppeteer; try { puppeteer = require('../tools/node_modules/puppeteer-core'); } catch { puppeteer = require('puppeteer'); }
|
||||
|
||||
function serve(redirectTo = null) {
|
||||
const server = http.createServer((req, res) => {
|
||||
@@ -23,8 +23,6 @@ function serve(redirectTo = null) {
|
||||
}
|
||||
async function main() {
|
||||
const server = await serve();
|
||||
const server2 = await serve();
|
||||
const redirectServer = await serve(`http://127.0.0.1:${server.address().port}`);
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'portage-e2e-'));
|
||||
const extDir = path.resolve('chrome');
|
||||
let browser;
|
||||
@@ -36,35 +34,17 @@ async function main() {
|
||||
const ext=await browser.newPage();
|
||||
await ext.goto(`chrome-extension://${id}/dashboard.html`,{waitUntil:'load'});
|
||||
const origin=`http://127.0.0.1:${server.address().port}`;
|
||||
const origin2=`http://127.0.0.1:${server2.address().port}`;
|
||||
const redirectOrigin=`http://127.0.0.1:${redirectServer.address().port}`;
|
||||
const results=await ext.evaluate(async (origin, origin2, redirectOrigin)=> {
|
||||
return await importLocalStorage([
|
||||
{origin,items:{k1:'persisted',unicode:'猫'}},
|
||||
{origin:origin2,items:{second:'isolated'}},
|
||||
{origin:redirectOrigin,items:{poison:'must-not-write'}},
|
||||
],()=>{});
|
||||
},origin,origin2,redirectOrigin);
|
||||
assert.equal(results.imported,2,JSON.stringify(results));
|
||||
assert.equal(results.skipped,1,JSON.stringify(results));
|
||||
const page=await browser.newPage();
|
||||
await page.goto(origin);
|
||||
assert.equal(await page.evaluate(()=>localStorage.getItem('k1')),'persisted');
|
||||
assert.equal(await page.evaluate(()=>localStorage.getItem('unicode')),'猫');
|
||||
assert.equal(await page.evaluate(()=>localStorage.getItem('poison')),null);
|
||||
const another = await browser.newPage();
|
||||
await another.goto(origin2);
|
||||
assert.equal(await another.evaluate(()=>localStorage.getItem('second')),'isolated');
|
||||
assert.equal(await another.evaluate(()=>localStorage.getItem('k1')),null);
|
||||
const cookie = await ext.evaluate(async (domain)=>importCookies([
|
||||
{name:'portage-test',value:'synthetic',domain,hostOnly:true,path:'/',secure:false,sameSite:'unspecified'}
|
||||
],()=>{}), '127.0.0.1');
|
||||
assert.equal(cookie.imported,1,JSON.stringify(cookie));
|
||||
assert.equal((await page.cookies()).find(c=>c.name==='portage-test')?.value,'synthetic');
|
||||
console.log(`PASS actual Chrome ${await browser.version()}: data written and readable after navigation`);
|
||||
console.log(`PASS actual Chrome ${await browser.version()}: synthetic cookie imported`);
|
||||
} finally {
|
||||
if(browser) await browser.close();
|
||||
await Promise.all([server,server2,redirectServer].map(s=>new Promise(resolve=>s.close(resolve))));
|
||||
await new Promise(resolve=>server.close(resolve));
|
||||
fs.rmSync(dir,{recursive:true,force:true});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env node
|
||||
// Firefox 159 -> AES encrypted Portage file -> offline Chrome 156 import.
|
||||
// Creates only disposable profiles and uses synthetic site values.
|
||||
'use strict';
|
||||
const fs=require('node:fs'),os=require('node:os'),path=require('node:path'),http=require('node:http');
|
||||
const assert=require('node:assert/strict');
|
||||
const {spawn,spawnSync}=require('node:child_process');
|
||||
let pp; try { pp = require('../tools/node_modules/puppeteer-core'); } catch { pp = require('puppeteer'); }
|
||||
const {decryptWrapper,validateBundle,restoreSites}=require('../tools/chromium_localstorage_import.cjs');
|
||||
function fire(args) {return new Promise((resolve,reject)=>{
|
||||
let stderr='';const p=spawn('/usr/local/bin/firefox',args,{stdio:['ignore','ignore','pipe']});
|
||||
p.stderr.on('data',b=>{stderr+=b.toString()});
|
||||
const kill=setTimeout(()=>{p.kill();reject(new Error('Firefox timeout'))},20000);
|
||||
p.on('error',e=>{clearTimeout(kill);reject(e)});
|
||||
p.on('exit',code=>{clearTimeout(kill);if(code!==0)reject(new Error(`Firefox exited ${code}: ${stderr.slice(-500)}`));else resolve()});
|
||||
});}
|
||||
async function main(){
|
||||
const dir=fs.mkdtempSync(path.join(os.tmpdir(),'portage-cross-browser-'));
|
||||
const fx=path.join(dir,'firefox-profile'), chrome=path.join(dir,'chrome-profile');
|
||||
fs.mkdirSync(fx);let requests=0;
|
||||
const server=http.createServer((req,res)=>{requests++;res.writeHead(200,{'content-type':'text/html; charset=utf-8','cache-control':'no-store'});
|
||||
res.end('<!doctype html><meta charset="utf-8"><title>test</title><script>localStorage.setItem("migration_probe","hello-猫");localStorage.setItem("large_probe","Z".repeat(6000));</script><body>LocalStorage smoke test</body>');});
|
||||
await new Promise(resolve=>server.listen(0,'127.0.0.1',resolve));
|
||||
const origin=`http://127.0.0.1:${server.address().port}`;
|
||||
let browser;
|
||||
try{
|
||||
await fire(['-no-remote','--headless','--profile',fx,'--screenshot',path.join(dir,'ff.png'),origin]);
|
||||
assert(requests>=1);
|
||||
const file=path.join(dir,'encrypted.portage.json');
|
||||
const passphrase='random-synthetic-passphrase-for-test-123';
|
||||
const exported=spawnSync('python3',['tools/firefox_localstorage.py','--profile',fx,'--output',file,'--passphrase-stdin'],{input:passphrase+'\n',encoding:'utf8'});
|
||||
assert.equal(exported.status,0,exported.stderr);
|
||||
const wrapper=JSON.parse(fs.readFileSync(file,'utf8'));
|
||||
assert.equal(wrapper.portage.format,'portage-bundle-encrypted');
|
||||
assert.equal(JSON.stringify(wrapper).includes('hello-猫'),false,'No plaintext stored in encrypted bundle');
|
||||
const b=await decryptWrapper(wrapper,passphrase);
|
||||
const {sites,totalKeys}=validateBundle(b);
|
||||
assert.equal(sites.length,1);assert.equal(totalKeys,2);
|
||||
assert.equal(sites[0].items.migration_probe,'hello-猫');
|
||||
assert.equal(sites[0].items.large_probe.length,6000);
|
||||
const before=requests;
|
||||
// Exercise the actual command-line importer, including encrypted input.
|
||||
const imported=spawnSync(process.execPath,[
|
||||
'tools/chromium_localstorage_import.cjs',
|
||||
'--bundle',file,'--user-data-dir',chrome,'--browser','/usr/bin/google-chrome',
|
||||
'--passphrase-stdin','--apply'
|
||||
],{input:passphrase+'\n',encoding:'utf8',env:process.env,timeout:30000});
|
||||
assert.equal(imported.status,0,imported.stderr+'\n'+imported.stdout);
|
||||
assert(imported.stdout.includes('Imported 1/1 origins'), imported.stdout);
|
||||
assert.equal(requests,before,'Offline import must not access website');
|
||||
browser=await pp.launch({executablePath:'/usr/bin/google-chrome',headless:true,userDataDir:chrome,args:['--disable-background-networking','--no-first-run']});
|
||||
const page=await browser.newPage();
|
||||
await page.goto(origin);
|
||||
const v=await page.evaluate(()=>({first:localStorage.getItem('migration_probe'),len:localStorage.getItem('large_probe').length}));
|
||||
assert.deepEqual(v,{first:'hello-猫',len:6000});
|
||||
console.log('PASS Firefox 159 -> encrypted AES-256-GCM Portage bundle -> offline Chrome 156 -> persisted LocalStorage');
|
||||
}finally{if(browser)await browser.close();await new Promise(resolve=>server.close(resolve));fs.rmSync(dir,{recursive:true,force:true});}
|
||||
}
|
||||
main().catch(e=>{console.error(e.stack);process.exitCode=1});
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const os = require('node:os');
|
||||
const http = require('node:http');
|
||||
let puppeteer; try { puppeteer = require('../tools/node_modules/puppeteer-core'); } catch { puppeteer = require('puppeteer'); }
|
||||
const {run,validateBundle} = require('../tools/chromium_localstorage_import.cjs');
|
||||
|
||||
async function main() {
|
||||
let hits=0;
|
||||
const server=http.createServer((req,res)=>{hits++;res.writeHead(200,{'content-type':'text/html'});res.end('<!doctype html><title>Fixture</title>');});
|
||||
await new Promise(resolve=>server.listen(0,'127.0.0.1',resolve));
|
||||
const dir=fs.mkdtempSync(path.join(os.tmpdir(),'portage-offline-e2e-'));
|
||||
const profile=path.join(dir,'profile');
|
||||
const origin=`http://127.0.0.1:${server.address().port}`;
|
||||
const bundle={portage:{format:'portage-bundle',version:1,source:'firefox'},data:{localStorage:[{origin,items:{token:'synthetic-value',a:'猫'}}]}};
|
||||
const file=path.join(dir,'synthetic.portage.json');
|
||||
fs.writeFileSync(file,JSON.stringify(bundle),{mode:0o600});
|
||||
try {
|
||||
assert.equal(validateBundle(bundle).totalKeys,2);
|
||||
await run({bundle:file, userDataDir:profile, browser:'/usr/bin/google-chrome', profileDirectory:'Default', timeout:12000, apply:true});
|
||||
assert.equal(hits,0,'Importer must NOT send a single request to the origin');
|
||||
const browser=await puppeteer.launch({executablePath:'/usr/bin/google-chrome',headless:true,userDataDir:profile,args:['--no-sandbox','--disable-background-networking']});
|
||||
try {
|
||||
const page=await browser.newPage();
|
||||
await page.goto(origin);
|
||||
assert.equal(await page.evaluate(()=>localStorage.getItem('token')),'synthetic-value');
|
||||
assert.equal(await page.evaluate(()=>localStorage.getItem('a')),'猫');
|
||||
} finally {await browser.close();}
|
||||
console.log('PASS Chrome offline LocalStorage restore: zero origin requests during import; persistent after restart');
|
||||
} finally {
|
||||
await new Promise(resolve=>server.close(resolve));
|
||||
fs.rmSync(dir,{recursive:true,force:true});
|
||||
}
|
||||
}
|
||||
main().catch(err=>{console.error(err.stack);process.exitCode=1;});
|
||||
@@ -44,17 +44,20 @@ class FirefoxLocalStorageTest(unittest.TestCase):
|
||||
con.execute('CREATE TABLE data (key TEXT, utf16_length INTEGER, conversion_type INTEGER, compression_type INTEGER, last_access_time INTEGER, value BLOB)')
|
||||
con.execute('INSERT INTO data VALUES (?,?,?,?,?,?)',('login',len(value),1,0,0,value.encode()))
|
||||
con.close()
|
||||
(p/'storage'/'default'/'idb-site'/'idb').mkdir(parents=True)
|
||||
(p/'storage'/'default'/'idb-site'/'idb'/'1.sqlite').touch()
|
||||
sites,warnings=export_profile(p)
|
||||
self.assertEqual(len(sites),2)
|
||||
self.assertFalse(warnings)
|
||||
self.assertEqual([s['origin'] for s in sites],['https://first.test','https://second.test'])
|
||||
output=p/'export.portage.json'
|
||||
script=Path(__file__).resolve().parents[1]/'tools'/'firefox_localstorage.py'
|
||||
r=subprocess.run([sys.executable,str(script),'--profile',str(p),'--output',str(output)],capture_output=True,text=True)
|
||||
r=subprocess.run([sys.executable,str(script),'--profile',str(p),'--output',str(output),'--plaintext'],capture_output=True,text=True)
|
||||
self.assertEqual(r.returncode,0,r.stderr)
|
||||
self.assertEqual(os.stat(output).st_mode & 0o777,0o600)
|
||||
parsed=json.loads(output.read_text())
|
||||
self.assertEqual(parsed['meta']['counts']['localStorage'],2)
|
||||
self.assertEqual(parsed['meta']['unsupported']['indexedDBOrigins'],1)
|
||||
self.assertEqual(len(parsed['data']['localStorage']),2)
|
||||
self.assertNotEqual(subprocess.run([sys.executable,str(script),'--profile',str(p),'--output',str(output)],capture_output=True).returncode,0)
|
||||
|
||||
|
||||
@@ -1,51 +1,33 @@
|
||||
'use strict';
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const vm = require('node:vm');
|
||||
const assert=require('node:assert/strict'),fs=require('node:fs'),vm=require('node:vm');
|
||||
const {validOrigin, validateBundle}=require('../tools/chromium_localstorage_import.cjs');
|
||||
for (const browser of ['chrome','firefox']) {
|
||||
const src = fs.readFileSync(`${browser}/dashboard.js`, 'utf8');
|
||||
const start = src.indexOf('function mapSameSite(');
|
||||
const end = src.indexOf('async function importTabs(', start);
|
||||
assert(start > 0 && end > start);
|
||||
const ctx = vm.createContext({URL, setTimeout, clearTimeout, Object, Number, Array, tick: async () => {}, IS_FIREFOX: browser === 'firefox'});
|
||||
vm.runInContext(src.slice(start,end), ctx);
|
||||
assert.equal(vm.runInContext('mapSameSite("unspecified")', ctx), 'unspecified');
|
||||
assert.equal(vm.runInContext('mapSameSite("no_restriction")', ctx), 'no_restriction');
|
||||
assert.equal(vm.runInContext('mapSameSite("unknown")', ctx), 'unspecified');
|
||||
assert.equal(vm.runInContext('isSafeStorageOrigin("https://site.test")', ctx), true);
|
||||
assert.equal(vm.runInContext('isSafeStorageOrigin("https://site.test/evil")', ctx), false);
|
||||
(async () => {
|
||||
const visited = [], closed = [], written = [];
|
||||
const listeners = new Set();
|
||||
ctx.api = {
|
||||
tabs: {
|
||||
create: async ({url}) => { const id = visited.length+1; visited.push(url); return {id}; },
|
||||
get: async (id) => ({status:'complete', url: visited[id-1]}),
|
||||
remove: async (id) => {closed.push(id)},
|
||||
onUpdated: { addListener: (f) => listeners.add(f), removeListener: (f) => listeners.delete(f)},
|
||||
},
|
||||
scripting: { executeScript: async ({target,func,args}) => {
|
||||
const old = ctx.localStorage;
|
||||
ctx.localStorage={setItem:(k,v)=>written.push([k,v])};
|
||||
// Function is evaluated in a tab by the actual browser; here emulate it.
|
||||
const total = Object.entries(args[0]).length;
|
||||
ctx.localStorage=old;
|
||||
return [{result:total}];
|
||||
}},
|
||||
cookies: {getAllCookieStores: async()=>[{id:browser==='firefox'?'firefox-default':'0'}],set:async()=>({})},
|
||||
};
|
||||
const sites = [
|
||||
{origin:'https://first.test',items:{a:'a-value'}},
|
||||
{origin:'https://second.test',items:{b:'b-value'}},
|
||||
{origin:'javascript:alert(1)',items:{c:'nope'}},
|
||||
];
|
||||
const result = await ctx.importLocalStorage(sites, () => {});
|
||||
assert.equal(result.imported,2);
|
||||
assert.equal(result.skipped,1);
|
||||
assert.deepEqual(visited,['https://first.test','https://second.test']);
|
||||
assert.deepEqual(closed,[1,2]);
|
||||
const cookie = await ctx.importCookies([{name:'s',value:'v',domain:'example.com',hostOnly:true,sameSite:'unspecified'}],()=>{});
|
||||
assert.equal(cookie.imported,1);
|
||||
console.log(`${browser}: storage sites, origin validation, cookies and SameSite passed`);
|
||||
})().catch((err)=>{console.error(err);process.exitCode=1;});
|
||||
const src=fs.readFileSync(`${browser}/dashboard.js`,'utf8');
|
||||
const start=src.indexOf('function mapSameSite(');
|
||||
const end=src.indexOf('async function importTabs(',start);
|
||||
assert(start>0 && end>start);
|
||||
const ctx=vm.createContext({URL,Number,Array,IS_FIREFOX:browser==='firefox',tick:async()=>{}});
|
||||
vm.runInContext(src.slice(start,end),ctx);
|
||||
for(const s of ['strict','lax','no_restriction','unspecified']) {
|
||||
assert.equal(ctx.mapSameSite(s),s);
|
||||
}
|
||||
assert.equal(ctx.mapSameSite('unknown'),'unspecified');
|
||||
(async()=>{
|
||||
const written=[];
|
||||
ctx.api={cookies:{getAllCookieStores:async()=>[{id:browser==='firefox'?'firefox-default':'0'}],set:async d=>{written.push(d);return d;}}};
|
||||
const r=await ctx.importCookies([
|
||||
{name:'test',value:'value',domain:'example.com',path:'/',hostOnly:true,sameSite:'unspecified'},
|
||||
{name:'partition',value:'v',domain:'example.com',path:'/',hostOnly:true,sameSite:'lax',partitionKey:{topLevelSite:'https://site.test'}},
|
||||
{name:'container',domain:'example.org',storeId:'firefox-container-1',hostOnly:true},
|
||||
],()=>{});
|
||||
assert.equal(r.imported,2);assert.equal(r.skipped,1);
|
||||
assert.equal(written[0].sameSite,'unspecified');
|
||||
assert.equal(written[1].partitionKey.topLevelSite,'https://site.test');
|
||||
if(browser==='firefox')assert.equal(written[0].firstPartyDomain,'');
|
||||
console.log(browser+': cookie import metadata and SameSite passed');
|
||||
})().catch(e=>{console.error(e);process.exitCode=1});
|
||||
}
|
||||
assert(validOrigin('https://example.org'));
|
||||
assert(!validOrigin('javascript:foo'));
|
||||
assert.throws(()=>validateBundle({portage:{format:'portage-bundle',version:1},data:{localStorage:[{origin:'https://example.org/path',items:{x:'y'}}]}}));
|
||||
assert.throws(()=>validateBundle({portage:{format:'portage-bundle',version:1},data:{localStorage:[{origin:'https://example.org',items:{x:123}}]}}));
|
||||
|
||||
+45
-39
@@ -1,54 +1,60 @@
|
||||
# Whole-profile LocalStorage migration (experimental, Linux)
|
||||
# Experimental whole-profile Firefox → Chromium LocalStorage migration
|
||||
|
||||
The browser extension cannot enumerate another browser's complete site storage via
|
||||
WebExtension APIs. Portage's companion script therefore reads **all compatible
|
||||
first-party Firefox LSNG localStorage databases**, not only open tabs. It is
|
||||
read-only and standard-library-only (no Internet requests).
|
||||
The Portage extension cannot enumerate every origin's LocalStorage via WebExtension APIs. This optional Linux companion migrates **every compatible first-party Firefox LocalStorage origin** by reading the offline Firefox profile and writing via a separate, headless Chrome/Brave session. It does **not** depend on currently open tabs, and does **not** visit the real websites during import.
|
||||
|
||||
**Privacy:** localStorage often includes authentication tokens. Output is
|
||||
**UNENCRYPTED** JSON and created with mode `0600`. Do not share, attach to bug
|
||||
reports, or commit it. After migration, securely manage/delete the file per
|
||||
local policy. Keep an offline backup of your Firefox profile.
|
||||
**This is not complete browser-profile migration.** It does *not* migrate IndexedDB, sessionStorage, Service Workers, Firefox Containers, partitioned localStorage, WebAuthn/passkeys, or device-bound session credentials. Login persistence cannot be guaranteed. Cookies and bookmarks can be migrated separately using the standard Portage extension.
|
||||
|
||||
1. In Firefox `about:profiles`, find the **Root Directory** of the intended
|
||||
profile. Close Firefox to avoid racing database changes.
|
||||
2. Export in a private directory:
|
||||
## Safety / prerequisites
|
||||
|
||||
```sh
|
||||
- Backup the Firefox and Chromium/Brave profiles first.
|
||||
- Close Firefox before exporting; close Brave/Chrome before applying to its profile. The importer refuses an existing Chromium `SingletonLock`.
|
||||
- LocalStorage can contain live session tokens. **Encrypted AES-256-GCM export is the default**; use a long unique passphrase. `--plaintext` is an explicitly unsafe opt-out. Output is mode 0600. Never attach exported bundles to an issue, share them, or commit them.
|
||||
- Require **Python 3** and `cryptography` for encryption (`sudo apt install python3-cryptography` on Debian), and **Node.js 20+**, plus Puppeteer Core (`cd tools && npm install`). Puppeteer Core uses the existing installed Chrome/Brave and downloads no browsers.
|
||||
- The exporter reports a **count of IndexedDB origins omitted** (without opening their records), so you can estimate missing coverage.
|
||||
- Import is **merge/upsert**: values with matching LocalStorage keys in the target are overwritten. Use a fresh Chromium profile where possible. Failed sites are reported and attempted writes are rolled back within the page when possible; this does not provide cross-origin atomic transactions.
|
||||
- Import launches the browser **headless**, intercepts all page network requests to return inert local HTML, disables service workers for the temporary page, and validates the loaded origin. This avoids visiting live websites but does not formally guarantee that the browser itself makes no background connections. Standard Chrome sandboxing remains enabled.
|
||||
|
||||
## Usage on Linux
|
||||
|
||||
1. Open `about:profiles` in Firefox to find your intended profile's **Root Directory**. Close Firefox, then run:
|
||||
|
||||
```bash
|
||||
python3 tools/firefox_localstorage.py \
|
||||
--profile '/path/from/about:profiles' \
|
||||
--output "$HOME/portage-localstorage.portage.json"
|
||||
--profile "$HOME/.mozilla/firefox/your-profile" \
|
||||
--output "$HOME/firefox-storage.portage.json"
|
||||
```
|
||||
|
||||
3. Install the **unpacked** `chrome/` Portage extension in Brave (Developer mode)
|
||||
or `firefox/` in Firefox. Open Portage, switch to Import, and load the new
|
||||
`.portage.json` file. Select LocalStorage and choose **Import selected**.
|
||||
4. The extension visits *every exported origin*, sequentially, in temporary
|
||||
background tabs and writes the saved localStorage, then closes the tabs.
|
||||
This causes real network requests to those sites. It may trigger background
|
||||
actions; do not perform this on a production profile without a backup.
|
||||
The importer reports imported/skipped **origins**, not individual keys.
|
||||
An encryption passphrase will be requested. For non-interactive usage, pipe a secret securely through `--passphrase-stdin` (never put it in shell command arguments). No upload/network request is performed.
|
||||
|
||||
## Scope and limitations
|
||||
2. Install the *optional* importer dependency, once:
|
||||
|
||||
- First-party HTTP(S) localStorage from `storage/default/*/ls/data.sqlite`.
|
||||
- Handles UTF-8 and UTF-16BE, plus Firefox raw Snappy compression.
|
||||
- Skips partitioned/container origin attributes rather than merging them into
|
||||
a different privacy context. Logs skipped/corrupt databases without contents.
|
||||
- Does **not** migrate IndexedDB, sessionStorage, WebAuthn credentials, cookies,
|
||||
service workers, or origin-bound browser keys. Portage's regular browser UI
|
||||
handles cookies as a separate category.
|
||||
- Does not guarantee uninterrupted login state. Some sites need fresh login.
|
||||
- No login credentials are read from `logins.json`.
|
||||
- Chromium must be able to load a site for its storage to be written via a
|
||||
content script. Redirects, dead origins, missing permissions and browser
|
||||
restrictions may cause individual origins to be skipped.
|
||||
```bash
|
||||
cd tools && npm install && cd ..
|
||||
```
|
||||
|
||||
For tests (synthetic, no personal browser data):
|
||||
3. Close Brave. Check data counts in **dry-run** mode (the default):
|
||||
|
||||
```sh
|
||||
```bash
|
||||
node tools/chromium_localstorage_import.cjs \
|
||||
--bundle "$HOME/firefox-storage.portage.json" \
|
||||
--browser /usr/bin/brave-browser \
|
||||
--user-data-dir "$HOME/.config/BraveSoftware/Brave-Browser"
|
||||
```
|
||||
|
||||
Only the counts are printed; there are no browser changes. To actually import, repeat with `--apply` appended. Provide `--profile-directory 'Profile 1'` if your target is not `Default`. Replace `/usr/bin/brave-browser` with the executable on your system.
|
||||
|
||||
4. Launch Brave normally and inspect the sites you care about. **Delete the encrypted migration file when no longer needed.** Restore from your backup if necessary.
|
||||
|
||||
## Tests (all synthetic profiles; no personal browser data)
|
||||
|
||||
```bash
|
||||
python3 -m unittest discover -s tests -p 'test_*.py'
|
||||
node tests/test_storage_browser.cjs
|
||||
# Optional: requires Puppeteer and a local Chrome installation; uses a temp profile
|
||||
# Optional desktop E2E: local Firefox 159 and Chrome 156 were verified;
|
||||
# needs installed Firefox and Google Chrome plus Puppeteer
|
||||
node tests/e2e_cross_browser.cjs
|
||||
node tests/e2e_offline_import.cjs
|
||||
node tests/e2e_chrome.cjs
|
||||
```
|
||||
|
||||
Chromium E2E tests verify that **requests to the synthetic target origin equal zero during import**, and the stored values remain readable after browser restart. The cross-browser test verifies Firefox LSNG decoding, AES encryption compatibility and Chromium restoration. Neither test guarantees the preservation of real-world login sessions.
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Offline, cross-origin Chromium localStorage importer.
|
||||
* Chrome/Brave is launched under a user-specified (preferably empty) profile;
|
||||
* request interception fulfills ALL page requests locally with inert HTML.
|
||||
* No extension or direct LevelDB editing is necessary.
|
||||
* Dependency: puppeteer-core (or puppeteer). Node >=20.
|
||||
*/
|
||||
'use strict';
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const crypto = require('node:crypto');
|
||||
const readline = require('node:readline');
|
||||
|
||||
function parseArgs(argv) {
|
||||
const opts = {apply: false, profileDirectory: 'Default', timeout: 12000};
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
const a = argv[i];
|
||||
if (a === '--apply') opts.apply = true;
|
||||
else if (a === '--passphrase-stdin') opts.passphraseStdin = true;
|
||||
else if (['--bundle','--user-data-dir','--browser','--profile-directory','--timeout-ms'].includes(a)) {
|
||||
const v = argv[++i]; if (!v) throw Error(`Missing value for ${a}`);
|
||||
const key = {'--bundle':'bundle','--user-data-dir':'userDataDir','--browser':'browser','--profile-directory':'profileDirectory','--timeout-ms':'timeout'}[a];
|
||||
opts[key] = key === 'timeout' ? Number(v) : v;
|
||||
} else if (a === '--help' || a === '-h') opts.help = true;
|
||||
else throw Error(`Unknown argument: ${a}`);
|
||||
}
|
||||
if (!opts.help && (!opts.bundle || !opts.userDataDir || !opts.browser)) throw Error('Required: --bundle FILE --user-data-dir DIR --browser PATH');
|
||||
if (!Number.isFinite(opts.timeout) || opts.timeout < 1000 || opts.timeout > 120000) throw Error('Invalid timeout');
|
||||
if (!/^[\w. -]+$/.test(opts.profileDirectory) || opts.profileDirectory === '.' || opts.profileDirectory === '..') throw Error('Invalid profile directory');
|
||||
return opts;
|
||||
}
|
||||
|
||||
function validOrigin(origin) {
|
||||
if (typeof origin !== 'string' || origin.includes('^')) return false;
|
||||
try {
|
||||
const url = new URL(origin);
|
||||
return (url.protocol === 'http:' || url.protocol === 'https:') && url.origin === origin && !url.username && !url.password;
|
||||
} catch { return false; }
|
||||
}
|
||||
|
||||
function validateBundle(obj) {
|
||||
if (obj?.portage?.format !== 'portage-bundle' || obj?.portage?.version !== 1) throw Error('Invalid Portage bundle format');
|
||||
const sites = obj?.data?.localStorage;
|
||||
if (!Array.isArray(sites)) throw Error('Bundle does not contain localStorage');
|
||||
if (sites.length > 100000) throw Error('Too many origins');
|
||||
const seen = new Set();
|
||||
let totalKeys = 0;
|
||||
for (const site of sites) {
|
||||
if (!validOrigin(site?.origin)) throw Error('Unsafe or unsupported site origin in bundle');
|
||||
if (seen.has(site.origin)) throw Error('Duplicate origin in bundle');
|
||||
seen.add(site.origin);
|
||||
const values = site.items;
|
||||
if (!values || typeof values !== 'object' || Array.isArray(values) || Object.getPrototypeOf(values) !== Object.prototype) throw Error('Invalid localStorage entries');
|
||||
const keys = Object.keys(values);
|
||||
totalKeys += keys.length;
|
||||
if (keys.length > 10000 || totalKeys > 1000000) throw Error('Too many storage entries');
|
||||
if (keys.some(k => typeof values[k] !== 'string')) throw Error('Non-string storage values');
|
||||
}
|
||||
return {sites, totalKeys};
|
||||
}
|
||||
|
||||
async function passphrasePrompt() {
|
||||
if (!process.stdin.isTTY) throw Error('Encrypted bundle: use --passphrase-stdin, or run interactively');
|
||||
const rl = readline.createInterface({input: process.stdin, output: process.stderr});
|
||||
// Prevent echoing a password to the terminal.
|
||||
rl._writeToOutput = () => {};
|
||||
return new Promise(resolve => {process.stderr.write('Portage bundle passphrase: '); rl.question('', s => {process.stderr.write('\n');rl.close();resolve(s);});});
|
||||
}
|
||||
|
||||
async function readPassphrase(stdinFlag) {
|
||||
if (!stdinFlag) return passphrasePrompt();
|
||||
const chunks=[];
|
||||
for await(const c of process.stdin) chunks.push(c);
|
||||
const value=Buffer.concat(chunks).toString('utf8').replace(/\r?\n$/, '');
|
||||
if (!value) throw Error('Empty passphrase from standard input');
|
||||
return value;
|
||||
}
|
||||
|
||||
async function decryptWrapper(wrapper, passphrase) {
|
||||
const p = wrapper.portage;
|
||||
if (p?.format !== 'portage-bundle-encrypted' || p?.version !== 1 ||
|
||||
p.cipher !== 'AES-GCM' || p.kdf !== 'PBKDF2' || p.hash !== 'SHA-256' || p.keyLength !== 256 ||
|
||||
!Number.isInteger(p.iterations) || p.iterations < 100000 || p.iterations > 2000000) throw Error('Unsupported encryption format');
|
||||
const salt=Buffer.from(p.salt,'base64'), iv=Buffer.from(p.iv,'base64'), ct=Buffer.from(wrapper.ciphertext,'base64');
|
||||
if(salt.length !== 16 || iv.length !== 12 || ct.length < 16 || ct.length > 512*1024*1024) throw Error('Invalid encrypted bundle size');
|
||||
const key = crypto.pbkdf2Sync(passphrase,salt,p.iterations,32,'sha256');
|
||||
const dec = crypto.createDecipheriv('aes-256-gcm',key,iv);
|
||||
dec.setAuthTag(ct.subarray(ct.length-16));
|
||||
let inner;
|
||||
try {inner=JSON.parse(Buffer.concat([dec.update(ct.subarray(0,-16)),dec.final()]).toString('utf8'));}
|
||||
catch {throw Error('Cannot decrypt: wrong passphrase or corrupted bundle');}
|
||||
return {portage:{format:'portage-bundle',version:1,source:p.source},meta:inner.meta,data:inner.data};
|
||||
}
|
||||
|
||||
async function loadBundle(filename, passphraseStdin) {
|
||||
const stat=fs.statSync(filename);
|
||||
if (stat.size > 512*1024*1024) throw Error('Bundle too large');
|
||||
const wrapper=JSON.parse(fs.readFileSync(filename,'utf8'));
|
||||
if(wrapper?.portage?.format==='portage-bundle-encrypted') {
|
||||
const pass=await readPassphrase(passphraseStdin);
|
||||
return await decryptWrapper(wrapper,pass);
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/** For every origin, respond to *every* navigation/subresource request locally. */
|
||||
async function restoreSites(browser, sites, timeout=12000) {
|
||||
const results = {imported: 0, skipped: 0, keys: 0, errors: []};
|
||||
const page=await browser.newPage();
|
||||
await page.setBypassServiceWorker(true);
|
||||
await page.setCacheEnabled(false);
|
||||
await page.setRequestInterception(true);
|
||||
page.on('request', req=>{
|
||||
const isDocument=req.isNavigationRequest() && req.frame() === page.mainFrame();
|
||||
if (isDocument) req.respond({status:200,contentType:'text/html; charset=utf-8',headers:{'cache-control':'no-store'},body:'<!doctype html><html><head><title>Portage localStorage import</title></head><body></body></html>'}).catch(()=>{});
|
||||
else req.respond({status:204,body:''}).catch(()=>{});
|
||||
});
|
||||
for(let i=0;i<sites.length;i++) {
|
||||
const site=sites[i];
|
||||
try {
|
||||
await page.goto(site.origin+'/',{waitUntil:'domcontentloaded',timeout});
|
||||
if (new URL(page.url()).origin !== site.origin) throw Error('Unexpected navigation origin');
|
||||
const pairs=Object.entries(site.items);
|
||||
const result=await page.evaluate((entries)=>{
|
||||
// Entire operation occurs in one renderer task, before site scripts (page is inert).
|
||||
const old=[];
|
||||
try {
|
||||
for(const [k,v] of entries) {
|
||||
old.push([k,localStorage.getItem(k)]);
|
||||
localStorage.setItem(k,v);
|
||||
}
|
||||
if(entries.some(([k,v])=>localStorage.getItem(k)!==v)) throw Error('Storage verification failed');
|
||||
} catch(e) {
|
||||
for(let j=old.length-1;j>=0;j--) {
|
||||
const [k,v]=old[j];
|
||||
try{if(v===null)localStorage.removeItem(k);else localStorage.setItem(k,v);}catch{}
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return entries.length;
|
||||
}, pairs);
|
||||
if(result!==pairs.length)throw Error('Storage key count mismatch');
|
||||
results.imported++;results.keys+=result;
|
||||
} catch(e) {
|
||||
results.skipped++;
|
||||
results.errors.push({index:i+1,reason:String(e.message||e).slice(0,180)});
|
||||
}
|
||||
}
|
||||
await page.close();
|
||||
return results;
|
||||
}
|
||||
|
||||
async function run(opts) {
|
||||
const bundle=await loadBundle(path.resolve(opts.bundle),opts.passphraseStdin);
|
||||
const {sites,totalKeys}=validateBundle(bundle);
|
||||
const profile=path.resolve(opts.userDataDir);
|
||||
if(profile==='/' || profile===require('node:os').homedir()) throw Error('Refusing to use root or home as Chrome user-data-dir');
|
||||
const lock=path.join(profile,'SingletonLock');
|
||||
if (fs.existsSync(lock) || fs.lstatSync(lock, {throwIfNoEntry:false})) throw Error('Browser profile appears to be in use (SingletonLock present); close browser and retry');
|
||||
console.log(`Validated ${sites.length} origins / ${totalKeys} LocalStorage keys.`);
|
||||
const unsupportedIdb = bundle?.meta?.unsupported?.indexedDBOrigins;
|
||||
if (Number.isInteger(unsupportedIdb) && unsupportedIdb > 0) {
|
||||
console.warn(`WARNING: ${unsupportedIdb} Firefox IndexedDB origin(s) are not migrated; some logins may require reauthentication.`);
|
||||
}
|
||||
if(!opts.apply){console.log('DRY RUN: No browser started; pass --apply after creating a backup.');return;}
|
||||
if(!fs.existsSync(opts.browser))throw Error('Browser executable not found');
|
||||
let puppeteer;
|
||||
try{puppeteer=require('puppeteer-core');}catch{try{puppeteer=require('puppeteer');}catch{throw Error('Install puppeteer-core locally (npm i --no-save puppeteer-core)');}}
|
||||
// Never start with a personal profile unless explicitly specified by the operator.
|
||||
// Keep Chrome sandbox enabled; do not pass --no-sandbox.
|
||||
const browser=await puppeteer.launch({executablePath:path.resolve(opts.browser),userDataDir:profile,
|
||||
headless:true,defaultViewport:{width:600,height:400},
|
||||
args:['--profile-directory='+opts.profileDirectory,'--no-first-run','--no-default-browser-check',
|
||||
'--disable-background-networking','--disable-sync','--disable-extensions','--disable-features=MediaRouter']});
|
||||
let result;
|
||||
try {result=await restoreSites(browser,sites,opts.timeout);}
|
||||
finally {await browser.close();}
|
||||
console.log(`Imported ${result.imported}/${sites.length} origins and ${result.keys} keys; skipped ${result.skipped}.`);
|
||||
if(result.errors.length)console.log('Skipped (index and reason; no credentials):',JSON.stringify(result.errors));
|
||||
if(result.skipped)process.exitCode=2;
|
||||
}
|
||||
|
||||
if(require.main===module) {
|
||||
let opts;
|
||||
try{opts=parseArgs(process.argv.slice(2));
|
||||
if(opts.help){console.log('Usage: node tools/chromium_localstorage_import.cjs --bundle FILE --user-data-dir DIR --browser /path/to/chrome [--profile-directory Default] [--passphrase-stdin] [--apply]\nDry-run is default. Requires puppeteer-core to --apply. No remote site requests are made by the importer.');process.exit(0);}
|
||||
run(opts).catch(e=>{console.error('Error:',e.message);process.exitCode=1});
|
||||
}catch(e){console.error('Error:',e.message);process.exitCode=1}
|
||||
}
|
||||
module.exports={parseArgs,validOrigin,validateBundle,loadBundle,decryptWrapper,restoreSites,run};
|
||||
@@ -5,6 +5,9 @@ This is deliberately an offline, read-only exporter. It never accesses network
|
||||
services, Firefox cookies, passwords, or browser extension profiles.
|
||||
"""
|
||||
import argparse
|
||||
import base64
|
||||
import getpass
|
||||
import hashlib
|
||||
from contextlib import closing
|
||||
import json
|
||||
import os
|
||||
@@ -130,6 +133,8 @@ def main(argv=None):
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--profile', type=Path, required=True, help='Firefox profile folder from about:profiles')
|
||||
parser.add_argument('--output', type=Path, required=True, help='New private .portage.json bundle (contains session secrets)')
|
||||
parser.add_argument('--plaintext', action='store_true', help='DANGEROUS: disable default AES-256-GCM encryption')
|
||||
parser.add_argument('--passphrase-stdin', action='store_true', help='Read encryption passphrase from stdin instead of prompting')
|
||||
args = parser.parse_args(argv)
|
||||
profile = args.profile.expanduser().resolve()
|
||||
output = args.output.expanduser().resolve()
|
||||
@@ -138,15 +143,50 @@ def main(argv=None):
|
||||
if not profile.is_dir():
|
||||
parser.error('Profile directory does not exist')
|
||||
sites, warnings = export_profile(profile)
|
||||
# Inventory unsupported IndexedDB without opening or reading any IDB records.
|
||||
# Counts, not credential-bearing names/values, go into the bundle metadata.
|
||||
idb_count = sum(1 for directory in (profile / 'storage' / 'default').glob('*/idb')
|
||||
if directory.is_dir() and any(directory.glob('*.sqlite')))
|
||||
if not sites:
|
||||
parser.error('No compatible localStorage origins found (see warnings / profile path)')
|
||||
bundle = {
|
||||
'portage': {'format': 'portage-bundle', 'version': 1, 'source': 'firefox',
|
||||
'generator': 'Portage offline localStorage exporter',
|
||||
'exportedAt': datetime.now(timezone.utc).isoformat()},
|
||||
'meta': {'counts': {'localStorage': len(sites)}},
|
||||
'meta': {'counts': {'localStorage': len(sites)},
|
||||
'unsupported': {'indexedDBOrigins': idb_count}},
|
||||
'data': {'localStorage': sites},
|
||||
}
|
||||
if not args.plaintext:
|
||||
# Uses the same PBKDF2 + AES-GCM wire format as the extension itself.
|
||||
# Imported lazily: plaintext mode has no third-party dependencies.
|
||||
try:
|
||||
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
||||
except ImportError:
|
||||
parser.error('Encryption needs cryptography: pip install cryptography (or explicitly use --plaintext)')
|
||||
if args.passphrase_stdin:
|
||||
phrase = sys.stdin.readline().rstrip('\r\n')
|
||||
elif sys.stdin.isatty():
|
||||
phrase = getpass.getpass('Portage encryption passphrase: ')
|
||||
else:
|
||||
parser.error('Encrypted export requires a TTY, or --passphrase-stdin')
|
||||
if len(phrase) < 16:
|
||||
parser.error('Use a passphrase of at least 16 characters')
|
||||
salt, iv, iterations = os.urandom(16), os.urandom(12), 250000
|
||||
key = hashlib.pbkdf2_hmac('sha256', phrase.encode('utf8'), salt, iterations, dklen=32)
|
||||
inner = json.dumps({'meta': bundle['meta'], 'data': bundle['data']}, ensure_ascii=False, separators=(',', ':')).encode('utf8')
|
||||
ciphertext = AESGCM(key).encrypt(iv, inner, None)
|
||||
bundle = {
|
||||
'portage': {
|
||||
'format':'portage-bundle-encrypted', 'version':1, 'source':'firefox',
|
||||
'generator': 'Portage offline localStorage exporter',
|
||||
'exportedAt': bundle['portage']['exportedAt'],
|
||||
'cipher':'AES-GCM','keyLength':256,'kdf':'PBKDF2','hash':'SHA-256',
|
||||
'iterations':iterations,'salt':base64.b64encode(salt).decode(),
|
||||
'iv':base64.b64encode(iv).decode(),
|
||||
},
|
||||
'ciphertext':base64.b64encode(ciphertext).decode(),
|
||||
}
|
||||
# Create mode 0600: no permissive intermediate file, no clobber.
|
||||
fd = os.open(output, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
||||
try:
|
||||
@@ -155,8 +195,10 @@ def main(argv=None):
|
||||
except BaseException:
|
||||
output.unlink(missing_ok=True)
|
||||
raise
|
||||
print(f'Exported {len(sites)} origins to {output} (PRIVATE, UNENCRYPTED)')
|
||||
print(f'Exported {len(sites)} origins to {output} (PRIVATE, '+('UNENCRYPTED' if args.plaintext else 'AES-256-GCM encrypted')+')')
|
||||
print('The bundle may contain active login tokens. Do not upload or share it.')
|
||||
if idb_count:
|
||||
print(f'WARNING: IndexedDB exists for {idb_count} origin(s) and is NOT migrated.', file=sys.stderr)
|
||||
for warning in warnings:
|
||||
print('WARNING:', warning, file=sys.stderr)
|
||||
if warnings:
|
||||
|
||||
Generated
+333
@@ -0,0 +1,333 @@
|
||||
{
|
||||
"name": "portage-profile-migration-tools",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "portage-profile-migration-tools",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"puppeteer-core": "^25.14.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/@puppeteer/browsers": {
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-3.2.6.tgz",
|
||||
"integrity": "sha512-MJP29gVoHznmqmwhH1tlZqzfeQ3aylTpSSa6WKZXtkwYUH02i9imBmWGTyZrbnAou5paX78SE4jMAUqnEPf8ug==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"modern-tar": "^0.8.6",
|
||||
"yargs": "^18.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"browsers": "lib/main-cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.12.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"proxy-agent": ">=8.0.1",
|
||||
"yauzl": "^2.10.0 || ^3.4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"proxy-agent": {
|
||||
"optional": true
|
||||
},
|
||||
"yauzl": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "6.4.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.4.0.tgz",
|
||||
"integrity": "sha512-KzTVk2tCWAHtYrvvvaP8bJKJq2pVinhLcGEQdtLIYPbmNGNyYe8QwNaTUYQp2J7/vIsUKt5QCqAfUkYyG9DkOw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "6.2.3",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
|
||||
"integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/chromium-bidi": {
|
||||
"version": "157.0.8090-0",
|
||||
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-157.0.8090-0.tgz",
|
||||
"integrity": "sha512-KJw7IQgqXwxpJgJlEIPg5mr2ZoqA+jkTRtc5EABI7sUJ3bu3cpI7NuEBoj4Gn1AsF78CaT9So5WQWspK3/wYag==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"mitt": "^3.0.1",
|
||||
"zod": "^4.6.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.19.0 <22.0.0 || >=22.12.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"devtools-protocol": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/cliui": {
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz",
|
||||
"integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"string-width": "^7.2.0",
|
||||
"strip-ansi": "^7.1.0",
|
||||
"wrap-ansi": "^9.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/cliui/node_modules/string-width": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
|
||||
"integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^10.3.0",
|
||||
"get-east-asian-width": "^1.0.0",
|
||||
"strip-ansi": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/devtools-protocol": {
|
||||
"version": "0.0.1704951",
|
||||
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1704951.tgz",
|
||||
"integrity": "sha512-GQhQOs9u/Mvm1zMtJIH872JS4AskuZdUSsPNPk4ChahtWAUqgz6atEtIsMt+nO7MqF1Ic4HxII/k8Cu36JivNg==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "10.6.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz",
|
||||
"integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/escalade": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
|
||||
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/get-caller-file": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "6.* || 8.* || >= 10.*"
|
||||
}
|
||||
},
|
||||
"node_modules/get-east-asian-width": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.7.0.tgz",
|
||||
"integrity": "sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/mitt": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
|
||||
"integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/modern-tar": {
|
||||
"version": "0.8.6",
|
||||
"resolved": "https://registry.npmjs.org/modern-tar/-/modern-tar-0.8.6.tgz",
|
||||
"integrity": "sha512-LYSks0tNVqbtez/9OB0YFP6qLRSqkdAxJWOQpVaR67lNTbj2zNLyYpowkRMia5lXLCZKzxwoxkxH2MbbBR2aEg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/puppeteer-core": {
|
||||
"version": "25.16.0",
|
||||
"resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-25.16.0.tgz",
|
||||
"integrity": "sha512-VA5Pf54N8shfopNkZZXCdiiwfnnY8ZJYAMqFQRhlH5mGUhfwf53Ar770GPtdpTDLUqvQeYpIBtC9/G2Jij2IJw==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@puppeteer/browsers": "3.2.6",
|
||||
"chromium-bidi": "157.0.8090-0",
|
||||
"devtools-protocol": "0.0.1704951",
|
||||
"typed-query-selector": "^2.12.3",
|
||||
"webdriver-bidi-protocol": "1.0.1",
|
||||
"ws": "^8.22.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-8.3.0.tgz",
|
||||
"integrity": "sha512-ZbmZM0JCihQN91dWnxoipT2KOEyHqEyfRXUyjuRhW8b/xnqPDoq4gWEVApTVa9db2wN8mmoikgFBbjh71+cGeQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"get-east-asian-width": "^1.5.0",
|
||||
"strip-ansi": "^7.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
|
||||
"integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^6.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/typed-query-selector": {
|
||||
"version": "2.12.3",
|
||||
"resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.3.tgz",
|
||||
"integrity": "sha512-/dtuMZyutHLlrxWhhC1uib00ELUr2dZ8C9B8YzZYsJmeE3V56OxRblrSM2UaF142pcMtak7ehZ6+poWGeehNIg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/webdriver-bidi-protocol": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-1.0.1.tgz",
|
||||
"integrity": "sha512-WXWs/aXF2a6Al1Z2/V/7Gp2oPZOAAmHjJOTmv4KCXRJ122IMj3tSSMc6a4q3K4QOmhQbse/Ahr+oTVJOU2dUiw==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz",
|
||||
"integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^6.2.1",
|
||||
"string-width": "^7.0.0",
|
||||
"strip-ansi": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi/node_modules/string-width": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
|
||||
"integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^10.3.0",
|
||||
"get-east-asian-width": "^1.0.0",
|
||||
"strip-ansi": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.22.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.22.0.tgz",
|
||||
"integrity": "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/y18n": {
|
||||
"version": "5.0.8",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/yargs": {
|
||||
"version": "18.2.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-18.2.0.tgz",
|
||||
"integrity": "sha512-9OpKOLeaoNFecEp7P6iYbzze/5CqWoH7N3SMs/6y1XF4nMvFMspEGZzJ6uFi9MmQwXhyzqYoSEKO3tvA3Z/o2w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cliui": "^9.0.1",
|
||||
"escalade": "^3.1.1",
|
||||
"get-caller-file": "^2.0.5",
|
||||
"string-width": "^8.2.1",
|
||||
"y18n": "^5.0.5",
|
||||
"yargs-parser": "^22.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.12.0 || >=23"
|
||||
}
|
||||
},
|
||||
"node_modules/yargs-parser": {
|
||||
"version": "22.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz",
|
||||
"integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.12.0 || >=23"
|
||||
}
|
||||
},
|
||||
"node_modules/zod": {
|
||||
"version": "4.6.7",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
|
||||
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "portage-profile-migration-tools",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Optional offline profile migration helpers for Portage",
|
||||
"engines": { "node": ">=20" },
|
||||
"dependencies": { "puppeteer-core": "^25.14.0" }
|
||||
}
|
||||
Reference in New Issue
Block a user