Skip to content

Latest commit

 

History

History
81 lines (64 loc) · 3.8 KB

DEV.md

File metadata and controls

81 lines (64 loc) · 3.8 KB

Development

No build step. Plain HTML, CSS, and JavaScript.

Layout

Path Build
repo root Firefox / LibreWolf, Manifest V2
chrome/ Chrome / Edge / Brave / Opera, Manifest V3

Shared files exist in both places and must stay byte-identical: common.js, icons.js, ui.css, panel.html, panel.js, options.html, options.js. Edit one, copy it to the other. Check with:

for f in common.js icons.js ui.css panel.html panel.js options.html options.js; do cmp -s "$f" "chrome/$f" || echo "out of sync: $f"; done
'common.js','icons.js','ui.css','panel.html','panel.js','options.html','options.js' | % { if ((Get-FileHash $_).Hash -ne (Get-FileHash "chrome\$_").Hash) { "out of sync: $_" } }

Per build: manifest.json and background.js. The two background.js files differ only in how common.js is loaded (importScripts vs the manifest's script list) and when menus are registered (onInstalled/onStartup vs top level).

Load unpacked

Chrome / Edge / Brave / Opera

  1. Open chrome://extensions (Edge: edge://extensions).
  2. Enable Developer mode.
  3. Load unpacked and pick the chrome/ folder.
  4. After editing, hit the reload icon on the extension card. Service worker logs: Inspect views: service worker on the card.

Firefox / LibreWolf

  1. Open about:debugging#/runtime/this-firefox.
  2. Load Temporary Add-on and pick manifest.json at the repo root.
  3. After editing, click Reload. Background logs: Inspect. Temporary add-ons are removed when the browser closes.

Manual test

  1. Select 8.8.8.8 on any page, right-click, Threat Intel Search > Analyze. A small panel window opens: IP badge, gray circle with a dash, "not enough data", 7 source buttons, and Open all 7 IP sources.
  2. Click one source: one tab opens in the original window. Click Open all 7 IP sources: 7 tabs.
  3. Select hxxps://evil[.]com/login, right-click, Analyze: the panel reuses its window and shows evil.com as DOMAIN.
  4. Select a SHA256 or MD5, Analyze: HASH is auto-selected and the algorithm shows next to the badge.
  5. No panel for the forced types. Select 8.8.8.8, I (IP Address): 4 tabs (VirusTotal, OTX, AbuseIPDB, MaxMind) open right after the current tab, in order. hxxps://evil[.]com/login with D (Domain): 3 tabs for evil.com. A hash with H (Hash): 1 VirusTotal tab.
  6. Gear icon > settings. Paste a dummy key (e.g. test) into VirusTotal and click Save and test keys. Accept the site access prompt (Firefox also asks to share website content). The status should read key rejected. Look up an IP again: the breakdown says VT key rejected, the circle stays gray, links still work.
  7. With a real free key: the circle fills in, a confidence line appears, and an evidence row reads like VirusTotal 0/94 engines. A second lookup of the same indicator within 30 minutes says "cached N min ago"; refresh re-queries. Press 1 to open the first source, D to copy the indicator defanged.
  8. Untick Fetch a score when I open a lookup: no API requests at all.

Package

Uses Windows' built-in tar.exe (bsdtar), which writes forward-slash zip paths. PowerShell 5.1's Compress-Archive writes backslashes, which the stores can reject.

# Firefox / AMO
tar.exe --format zip -cf threat_intel_search-2.0.0.xpi manifest.json background.js common.js icons.js ui.css panel.html panel.js options.html options.js icons

# Chrome Web Store (leaves out chrome/store/)
tar.exe --format zip -cf threat_intel_search-chrome-2.0.0.zip -C chrome manifest.json background.js common.js icons.js ui.css panel.html panel.js options.html options.js icons

npx web-ext lint --source-dir . --ignore-files "chrome/**" "*.md" LICENSE runs Mozilla's validator on the Firefox build.