Skip to content

Commit c922a1a

Browse files
committed
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
1 parent f25d07f commit c922a1a

2 files changed

Lines changed: 91 additions & 0 deletions

File tree

manifest.firefox.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "KeyFinder",
3+
"description": "Passively discovers API keys, tokens, and secrets leaked in page scripts, DOM, network responses, and browser storage.",
4+
"version": "2.0.0",
5+
"manifest_version": 3,
6+
"browser_specific_settings": {
7+
"gecko": {
8+
"id": "keyfinder@momenbasel.com",
9+
"strict_min_version": "128.0"
10+
}
11+
},
12+
"action": {
13+
"default_icon": {
14+
"16": "icons/icon16.png",
15+
"48": "icons/icon48.png",
16+
"128": "icons/icon128.png"
17+
},
18+
"default_popup": "popup.html"
19+
},
20+
"icons": {
21+
"16": "icons/icon16.png",
22+
"48": "icons/icon48.png",
23+
"128": "icons/icon128.png"
24+
},
25+
"content_scripts": [
26+
{
27+
"matches": ["<all_urls>"],
28+
"js": ["js/patterns.js", "js/content.js"],
29+
"run_at": "document_idle",
30+
"all_frames": true
31+
},
32+
{
33+
"matches": ["<all_urls>"],
34+
"js": ["js/interceptor.js"],
35+
"run_at": "document_start",
36+
"world": "MAIN",
37+
"all_frames": true
38+
}
39+
],
40+
"background": {
41+
"scripts": ["js/background.js"]
42+
},
43+
"permissions": ["activeTab", "storage"]
44+
}

scripts/build.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5+
DIST="$ROOT/dist"
6+
VERSION=$(grep '"version"' "$ROOT/manifest.json" | head -1 | sed 's/.*: *"\([^"]*\)".*/\1/')
7+
8+
rm -rf "$DIST"
9+
mkdir -p "$DIST"
10+
11+
SHARED_FILES=(
12+
js/background.js
13+
js/content.js
14+
js/interceptor.js
15+
js/patterns.js
16+
js/popup.js
17+
js/results.js
18+
css/popup.css
19+
css/results.css
20+
icons/icon16.png
21+
icons/icon48.png
22+
icons/icon128.png
23+
popup.html
24+
results.html
25+
)
26+
27+
# --- Chrome build ---
28+
CHROME_DIR="$DIST/chrome"
29+
mkdir -p "$CHROME_DIR"/{js,css,icons}
30+
cp "$ROOT/manifest.json" "$CHROME_DIR/manifest.json"
31+
for f in "${SHARED_FILES[@]}"; do
32+
cp "$ROOT/$f" "$CHROME_DIR/$f"
33+
done
34+
(cd "$CHROME_DIR" && zip -r "$DIST/keyfinder-v${VERSION}-chrome.zip" . -x '.*')
35+
echo "Built: dist/keyfinder-v${VERSION}-chrome.zip"
36+
37+
# --- Firefox build ---
38+
FF_DIR="$DIST/firefox"
39+
mkdir -p "$FF_DIR"/{js,css,icons}
40+
cp "$ROOT/manifest.firefox.json" "$FF_DIR/manifest.json"
41+
for f in "${SHARED_FILES[@]}"; do
42+
cp "$ROOT/$f" "$FF_DIR/$f"
43+
done
44+
(cd "$FF_DIR" && zip -r "$DIST/keyfinder-v${VERSION}-firefox.zip" . -x '.*')
45+
echo "Built: dist/keyfinder-v${VERSION}-firefox.zip"
46+
47+
echo "Done. Upload dist/keyfinder-v${VERSION}-firefox.zip to addons.mozilla.org"

0 commit comments

Comments
 (0)