A Go backend + Chrome extension that ensures files are only downloaded after being scanned by VirusTotal.
- Cancels the original browser download and instead saves the file into a temp folder for scanning - improving security by ensuring files never reach the user unverified.
- Works through a simple POST endpoint (
/submit-data) with JSON{ id, url, filename, mime }. - Archive support: detects
zip,rar,tar,7z, extracts them, and scans each contained file. - Smart filename resolution: prefers
Content-Dispositionheaders (includingfilename*RFC 5987), falls back to URL or MIME type. - VirusTotal integration: scans files ≤25 MB, respects API rate limits (1 request/15 s), polls until analysis finishes or times out.
- One-time safe link: returns a temporary
/safe/{token}URL if the file is clean. Link works only once. - Automatic cleanup: deletes temp files/folders after serving.
- The Chrome extension intercepts the download, cancels it in the browser, and sends the file information (
id, url, filename, mime) to the Go backend. - The backend downloads the file into
./temp/uncompressed(or./temp/compressedif archive). - If the file is an archive, it’s extracted into
./temp/uncompressedand the contained files are scanned. - Each file is uploaded to VirusTotal. The server polls until the analysis is
completedor a timeout is hit. - If any file is flagged , no download link is given.
If all are clean , the original file is exposed via a one-time/safe/{token}URL and then downloaded by the browser. - Once
/safe/{token}is fetched, the file is served once and then deleted from temp. tempdirectory is deleted at the end of each scan.
Temp layout
./temp/
├─ compressed/ # original archives
└─ uncompressed/ # original non-archives & extracted contents
This project uses the following Go modules:
github.com/gen2brain/go-unarr– for extracting archives (zip,rar,tar,7z).github.com/joho/godotenv– for loading the API key from a.envfile.
- Go (1.20+ recommended)
- A VirusTotal API key in a local
.envfile:
API_KEY=YOUR_VIRUSTOTAL_API_KEY
- Outbound internet access to VirusTotal.
go run .
# Server listens on :8080Then, make sure the Chrome extension is running. The extension intercepts downloads, cancels the browser’s default behavior, and instead forwards the URL to the backend for scanning.
