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.
中文說明請見下方的 繁體中文。
- 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, orallow - 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/
This is an MVP/prototype, suitable for demos, experiments, and early product validation. It is not yet a production-grade enterprise DLP product.
- Add one or more protected folders in the dashboard.
- Click
Scan Now. - UploadGuardAI stores local hashes and text fingerprints for supported files.
- 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
- If the destination is an external AI/cloud site and a match is found, the policy returns
blockorwarn.
- 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
cd /path/to/UploadGuardAI
python3 run.pyThen open:
http://127.0.0.1:8765
Run without opening the browser automatically:
python3 run.py --no-browser- Start the desktop service.
- Open
http://127.0.0.1:8765. - Click
Samplein the protected folder section. - Click
Add. - Click
Scan Now. - Click
Blocked sample. - Keep destination as
chatgpt.com. - Click
Check.
Expected result: BLOCK.
Then click Allowed sample and Check.
Expected result: ALLOW.
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.
- Start the desktop service:
cd /path/to/UploadGuardAI
python3 run.py- Open Chrome:
chrome://extensions
- Enable
Developer mode. - Click
Load unpacked. - Select:
/path/to/UploadGuardAI/browser_extension
- ChatGPT
- Claude
- Gemini
- NotebookLM
- Google Drive
- Dropbox
- Slack workspaces
- Notion
- Google AI Studio
Health check:
curl http://127.0.0.1:8765/api/healthCheck 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
}python3 -m unittest discover -s tests.
├── 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
- 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 explicitFileandFormDatauploads. 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.
- 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
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 產品。
- 在管理介面加入受保護資料夾。
- 按
Scan Now。 - UploadGuardAI 會為支援的檔案建立本機 hash 與文字指紋。
- 當檔案準備外傳時,系統會比較:
- 檔案 hash 是否完全相同
- 文字內容是否相似
- 是否含有 email、類 API key、機密關鍵字等簡單敏感訊號
- 如果目的地是外部 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- 啟動桌面服務。
- 打開
http://127.0.0.1:8765。 - 在受保護資料夾區塊按
Sample。 - 按
Add。 - 按
Scan Now。 - 在
Check Upload區塊按Blocked sample。 - Destination 維持
chatgpt.com。 - 按
Check。
預期結果:BLOCK。
再按 Allowed sample,然後按 Check。
預期結果:ALLOW。
Extension 會在常見 AI/雲端網站上監聽選檔與貼上事件。它也會很早注入頁面層級防護,攔截許多包含 File 物件的 fetch 與 XMLHttpRequest 上傳請求,包含許多網站接收拖曳後送出的上傳請求。檔案繼續上傳前,它會先把檔案 hash 與可讀文字片段送到本機 UploadGuardAI 服務檢查。如果本機服務離線,extension 預設會警告並放行;如果想在服務不可用時也阻擋上傳,可以在 extension popup 啟用 fail-closed 阻擋。
- 先啟動桌面服務:
cd /path/to/UploadGuardAI
python3 run.py- 在 Chrome 打開:
chrome://extensions
- 開啟
Developer mode。 - 按
Load unpacked。 - 選擇:
/path/to/UploadGuardAI/browser_extension
- ChatGPT
- Claude
- Gemini
- NotebookLM
- Google Drive
- Dropbox
- Slack workspace
- Notion
- Google AI Studio
健康檢查:
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,直到重新整理頁面或封鎖過期。
- 加強 PDF、DOCX、XLSX、PPTX 解析
- 桌面程式封裝
- Extension 政策設定介面
- 組織層級政策管理
- 活動紀錄匯出
- 支援重新產生文件後的模糊比對
- 更精準的網站上傳流程處理
MIT License,請見 LICENSE。
