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
This commit is contained in:
moamen
2026-04-14 15:30:25 +02:00
parent f25d07f97d
commit c922a1a166
2 changed files with 91 additions and 0 deletions
+44
View File
@@ -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": ["<all_urls>"],
"js": ["js/patterns.js", "js/content.js"],
"run_at": "document_idle",
"all_frames": true
},
{
"matches": ["<all_urls>"],
"js": ["js/interceptor.js"],
"run_at": "document_start",
"world": "MAIN",
"all_frames": true
}
],
"background": {
"scripts": ["js/background.js"]
},
"permissions": ["activeTab", "storage"]
}
+47
View File
@@ -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"