From c922a1a166123be80eb3d8dcce05e41179e8a63e Mon Sep 17 00:00:00 2001 From: moamen Date: Tue, 14 Apr 2026 15:30:25 +0200 Subject: [PATCH] feat: add Firefox support (MV3, Firefox 128+) - Add manifest.firefox.json with gecko-specific settings and background scripts - Add scripts/build.sh to generate Chrome and Firefox zip packages - Zero JS changes needed: Firefox 128+ supports chrome.* namespace and world: MAIN - Closes #10 --- manifest.firefox.json | 44 ++++++++++++++++++++++++++++++++++++++++ scripts/build.sh | 47 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 manifest.firefox.json create mode 100755 scripts/build.sh diff --git a/manifest.firefox.json b/manifest.firefox.json new file mode 100644 index 0000000..e2f1943 --- /dev/null +++ b/manifest.firefox.json @@ -0,0 +1,44 @@ +{ + "name": "KeyFinder", + "description": "Passively discovers API keys, tokens, and secrets leaked in page scripts, DOM, network responses, and browser storage.", + "version": "2.0.0", + "manifest_version": 3, + "browser_specific_settings": { + "gecko": { + "id": "keyfinder@momenbasel.com", + "strict_min_version": "128.0" + } + }, + "action": { + "default_icon": { + "16": "icons/icon16.png", + "48": "icons/icon48.png", + "128": "icons/icon128.png" + }, + "default_popup": "popup.html" + }, + "icons": { + "16": "icons/icon16.png", + "48": "icons/icon48.png", + "128": "icons/icon128.png" + }, + "content_scripts": [ + { + "matches": [""], + "js": ["js/patterns.js", "js/content.js"], + "run_at": "document_idle", + "all_frames": true + }, + { + "matches": [""], + "js": ["js/interceptor.js"], + "run_at": "document_start", + "world": "MAIN", + "all_frames": true + } + ], + "background": { + "scripts": ["js/background.js"] + }, + "permissions": ["activeTab", "storage"] +} diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..04e0b21 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +DIST="$ROOT/dist" +VERSION=$(grep '"version"' "$ROOT/manifest.json" | head -1 | sed 's/.*: *"\([^"]*\)".*/\1/') + +rm -rf "$DIST" +mkdir -p "$DIST" + +SHARED_FILES=( + js/background.js + js/content.js + js/interceptor.js + js/patterns.js + js/popup.js + js/results.js + css/popup.css + css/results.css + icons/icon16.png + icons/icon48.png + icons/icon128.png + popup.html + results.html +) + +# --- Chrome build --- +CHROME_DIR="$DIST/chrome" +mkdir -p "$CHROME_DIR"/{js,css,icons} +cp "$ROOT/manifest.json" "$CHROME_DIR/manifest.json" +for f in "${SHARED_FILES[@]}"; do + cp "$ROOT/$f" "$CHROME_DIR/$f" +done +(cd "$CHROME_DIR" && zip -r "$DIST/keyfinder-v${VERSION}-chrome.zip" . -x '.*') +echo "Built: dist/keyfinder-v${VERSION}-chrome.zip" + +# --- Firefox build --- +FF_DIR="$DIST/firefox" +mkdir -p "$FF_DIR"/{js,css,icons} +cp "$ROOT/manifest.firefox.json" "$FF_DIR/manifest.json" +for f in "${SHARED_FILES[@]}"; do + cp "$ROOT/$f" "$FF_DIR/$f" +done +(cd "$FF_DIR" && zip -r "$DIST/keyfinder-v${VERSION}-firefox.zip" . -x '.*') +echo "Built: dist/keyfinder-v${VERSION}-firefox.zip" + +echo "Done. Upload dist/keyfinder-v${VERSION}-firefox.zip to addons.mozilla.org"