Skip to content

About

A local desktop guard that checks files before they are uploaded to AI and cloud apps. 在文件上傳到 AI 或雲端服務前,先由本機程式檢查與阻擋。

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

UploadGuardAI

UploadGuardAI is a local-first desktop guard that checks files before they are uploaded to AI tools and cloud apps. It is designed as a practical prototype for reducing accidental document leakage to services such as ChatGPT, Claude, Gemini, Google Drive, Dropbox, Slack, and Notion.

UploadGuardAI is not a magical "AI-proof document" system. If a person can read a document, they can still screenshot, retype, photograph, or summarize it. The goal is more realistic: add a local checkpoint before files leave the browser, block obvious risky uploads, and keep a local activity record.

中文說明請見下方的 繁體中文。

UploadGuardAI dashboard

What It Does

  • Runs a local desktop service at http://127.0.0.1:8765
  • Provides a browser-based dashboard for protected folders, scan status, policy, and activity logs
  • Indexes protected files with SHA-256 hashes and lightweight text fingerprints
  • Checks whether an outgoing file should be block, warn, or allow
  • Includes a Chrome extension prototype that checks selected files before upload
  • Uses only the Python standard library for the desktop service
  • Stores runtime data locally under data/

Current Status

This is an MVP/prototype, suitable for demos, experiments, and early product validation. It is not yet a production-grade enterprise DLP product.

How It Works

  1. Add one or more protected folders in the dashboard.
  2. Click Scan Now.
  3. UploadGuardAI stores local hashes and text fingerprints for supported files.
  4. When a file is checked, UploadGuardAI compares:
    • exact file hash
    • text similarity
    • simple sensitive-content signals such as email, API-key-like strings, and confidential keywords
  5. If the destination is an external AI/cloud site and a match is found, the policy returns block or warn.

Requirements

  • macOS, Linux, or Windows with Python 3.9+
  • Chrome or another Chromium-based browser for the extension prototype
  • No third-party Python packages are required

Run The Desktop Service

cd /path/to/UploadGuardAI
python3 run.py

Then open:

http://127.0.0.1:8765

Run without opening the browser automatically:

python3 run.py --no-browser

Try The Demo

  1. Start the desktop service.
  2. Open http://127.0.0.1:8765.
  3. Click Sample in the protected folder section.
  4. Click Add.
  5. Click Scan Now.
  6. Click Blocked sample.
  7. Keep destination as chatgpt.com.
  8. Click Check.

Expected result: BLOCK.

Then click Allowed sample and Check.

Expected result: ALLOW.

Chrome Extension Prototype

The extension watches file picker and paste events on common AI/cloud sites. It also injects an early page-level guard that intercepts many fetch and XMLHttpRequest upload requests containing File objects, including many drag-and-drop uploads after the site accepts the drop. Before an upload request continues, it sends the file hash and a small readable text sample to the local UploadGuardAI service. If the local service is offline, the extension warns and allows the upload by default; use the extension popup to enable fail-closed blocking when the service is unavailable.

Install

  1. Start the desktop service:
cd /path/to/UploadGuardAI
python3 run.py
  1. Open Chrome:
chrome://extensions
  1. Enable Developer mode.
  2. Click Load unpacked.
  3. Select:
/path/to/UploadGuardAI/browser_extension

Supported Sites

  • ChatGPT
  • Claude
  • Gemini
  • NotebookLM
  • Google Drive
  • Dropbox
  • Slack workspaces
  • Notion
  • Google AI Studio

API

Health check:

curl http://127.0.0.1:8765/api/health

Check a local file path:

curl -X POST http://127.0.0.1:8765/api/check-upload \
  -H 'content-type: application/json' \
  -d '{"path":"/path/to/file.txt","destination":"chatgpt.com"}'

Check browser-provided file data:

curl -X POST http://127.0.0.1:8765/api/check-upload-data \
  -H 'content-type: application/json' \
  -d '{"fileName":"upload.txt","destination":"chatgpt.com","sha256":"...","text":"optional text sample"}'

Example response:

{
  "decision": "block",
  "destination": "chatgpt.com",
  "path": "upload.txt",
  "reasons": ["protected_file_text_similarity"],
  "matched_file": {
    "path": "/path/to/protected/file.txt"
  },
  "similarity": 0.955
}

Tests

python3 -m unittest discover -s tests

Project Structure

.
├── ai_file_guard/          # Desktop service, dashboard, policy engine
├── browser_extension/      # Chrome extension prototype
├── samples/                # Demo protected/outgoing files
├── tests/                  # Unit and API tests
├── run.py                  # Desktop service entrypoint
└── README.md

Limitations

  • This does not prevent screenshots, manual retyping, photography, or deliberate bypass.
  • The browser extension cannot access a user's original full local file path, so it uses file hash and readable text samples.
  • Text similarity currently works best for plain text files.
  • PDF, Word, Excel, and PowerPoint support is lightweight in this prototype.
  • Drag-and-drop DOM events are not intercepted because some AI sites keep their upload overlay open when extensions intercept drop. Network upload checks still run for explicit File and FormData uploads. Gemini and Google AI mode have background drop checks: normal dropped files are not intercepted, but if a dropped file matches protected content, UploadGuardAI blocks subsequent AI send requests until the page is reloaded or the block expires.

Roadmap

  • Stronger document parsing for PDF, DOCX, XLSX, and PPTX
  • Native desktop packaging
  • Browser extension policy UI
  • Organization-level policy management
  • Better audit log export
  • Optional fuzzy matching for regenerated documents
  • More precise site-specific upload handling

License

MIT License. See LICENSE.


繁體中文

UploadGuardAI 是一個本機優先的桌面防護工具,用來在文件被上傳到 AI 工具或雲端服務前,先做一次本機檢查。它適合用來示範與驗證「防止不小心把敏感文件傳到 ChatGPT、Claude、Gemini、Google Drive、Dropbox、Slack、Notion」這類產品方向。

它不是神奇的「讓 AI 永遠讀不了文件」技術。只要人能看到文件,就仍然可以截圖、拍照、手打、重述或繞過。UploadGuardAI 的定位更實際:在檔案離開瀏覽器前加一道本機檢查,擋下明顯風險,並留下本機紀錄。

它能做什麼

  • 在本機啟動桌面服務:http://127.0.0.1:8765
  • 提供瀏覽器管理介面,用來管理受保護資料夾、掃描、政策與活動紀錄
  • 用 SHA-256 hash 與文字指紋記錄受保護文件
  • 判斷外傳檔案應該 block、warn 或 allow
  • 提供 Chrome extension 原型,在使用者選檔上傳前呼叫本機服務檢查
  • 桌面服務只使用 Python 標準函式庫,不需要安裝第三方套件
  • 執行資料保存在本機 data/

目前狀態

這是一個 MVP/原型,適合 demo、實驗與早期產品驗證。它還不是正式企業級 DLP 產品。

運作方式

  1. 在管理介面加入受保護資料夾。
  2. 按 Scan Now。
  3. UploadGuardAI 會為支援的檔案建立本機 hash 與文字指紋。
  4. 當檔案準備外傳時,系統會比較:
    • 檔案 hash 是否完全相同
    • 文字內容是否相似
    • 是否含有 email、類 API key、機密關鍵字等簡單敏感訊號
  5. 如果目的地是外部 AI/雲端網站,而且命中規則,就依政策回傳 block 或 warn。

需求

  • macOS、Linux 或 Windows
  • Python 3.9+
  • 若要使用 extension,需要 Chrome 或 Chromium 瀏覽器
  • 不需要安裝任何第三方 Python 套件

啟動桌面服務

cd /path/to/UploadGuardAI
python3 run.py

然後打開:

http://127.0.0.1:8765

如果只想啟動服務、不自動開瀏覽器:

python3 run.py --no-browser

試用 Demo

  1. 啟動桌面服務。
  2. 打開 http://127.0.0.1:8765。
  3. 在受保護資料夾區塊按 Sample。
  4. 按 Add。
  5. 按 Scan Now。
  6. 在 Check Upload 區塊按 Blocked sample。
  7. Destination 維持 chatgpt.com。
  8. 按 Check。

預期結果:BLOCK。

再按 Allowed sample,然後按 Check。

預期結果:ALLOW。

Chrome Extension 原型

Extension 會在常見 AI/雲端網站上監聽選檔與貼上事件。它也會很早注入頁面層級防護,攔截許多包含 File 物件的 fetch 與 XMLHttpRequest 上傳請求,包含許多網站接收拖曳後送出的上傳請求。檔案繼續上傳前,它會先把檔案 hash 與可讀文字片段送到本機 UploadGuardAI 服務檢查。如果本機服務離線,extension 預設會警告並放行;如果想在服務不可用時也阻擋上傳,可以在 extension popup 啟用 fail-closed 阻擋。

安裝方式

  1. 先啟動桌面服務:
cd /path/to/UploadGuardAI
python3 run.py
  1. 在 Chrome 打開:
chrome://extensions
  1. 開啟 Developer mode。
  2. 按 Load unpacked。
  3. 選擇:
/path/to/UploadGuardAI/browser_extension

支援網站

  • ChatGPT
  • Claude
  • Gemini
  • NotebookLM
  • Google Drive
  • Dropbox
  • Slack workspace
  • Notion
  • Google AI Studio

API

健康檢查:

curl http://127.0.0.1:8765/api/health

用本機檔案路徑檢查:

curl -X POST http://127.0.0.1:8765/api/check-upload \
  -H 'content-type: application/json' \
  -d '{"path":"/path/to/file.txt","destination":"chatgpt.com"}'

給瀏覽器 extension 使用的檢查 API:

curl -X POST http://127.0.0.1:8765/api/check-upload-data \
  -H 'content-type: application/json' \
  -d '{"fileName":"upload.txt","destination":"chatgpt.com","sha256":"...","text":"optional text sample"}'

測試

python3 -m unittest discover -s tests

專案結構

.
├── ai_file_guard/          # 桌面服務、管理介面、判斷邏輯
├── browser_extension/      # Chrome extension 原型
├── samples/                # Demo 檔案
├── tests/                  # 單元測試與 API 測試
├── run.py                  # 啟動入口
└── README.md

限制

  • 無法阻止截圖、手打、拍照、故意繞過。
  • 瀏覽器 extension 無法取得使用者原始完整本機檔案路徑,所以使用檔案 hash 與可讀文字片段判斷。
  • 文字相似度目前最適合純文字檔。
  • PDF、Word、Excel、PowerPoint 在此原型中只有輕量支援。
  • 拖曳上傳的 DOM 事件不會被攔截,因為部分 AI 網站在 extension 攔截 drop 後會讓上傳 overlay 卡住。明確透過 File 與 FormData 送出的上傳仍會在網路層被檢查。Gemini 與 Google AI mode 有背景 drop 檢查:正常拖曳檔案不會被接管;如果拖入檔案命中 protected content,UploadGuardAI 會阻止後續 AI send request,直到重新整理頁面或封鎖過期。

Roadmap

  • 加強 PDF、DOCX、XLSX、PPTX 解析
  • 桌面程式封裝
  • Extension 政策設定介面
  • 組織層級政策管理
  • 活動紀錄匯出
  • 支援重新產生文件後的模糊比對
  • 更精準的網站上傳流程處理

授權

MIT License,請見 LICENSE。

About

A local desktop guard that checks files before they are uploaded to AI and cloud apps. 在文件上傳到 AI 或雲端服務前,先由本機程式檢查與阻擋。

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages