ishaanman7898/ShareSecure
GitHub: ishaanman7898/ShareSecure
一个注重隐私保护的临时文件分享平台,支持无痕转发链路、自动过期和加密存储,可自托管部署。
Stars: 0 | Forks: 0
# ShareSecure

一种极其简单且真正尊重您隐私的文件分享方式。
上传 PDF 或 Word 文档,获取链接,分享它。每个打开链接的人都会获得自己独立的链接——之间没有痕迹关联。当过期时间归零,文件即彻底消失。无需管理账户,没有跟踪。
## 您将获得什么
**隐私至上**
- 每个链接都是完全独立的。分享给 Alice,她获得自己的链接。如果她分享给 Bob,Bob 会获得一个不同的链接。没有链条,无法追踪谁从谁那里获得了文件。
- 数据库的设计使得每一行看起来都一样——没有时间戳链接转发记录,没有精确的文件大小,没有内容指纹。即使数据库完全泄露,攻击者也几乎得不到任何信息。
- 无 Cookies,无用户跟踪。匿名上传无需账户。
- **IP 地址提示:** 您的 IP 地址本质上对服务器及您与服务器之间的任何网络基础设施可见。ShareSecure 不会在其应用程序代码中显式记录 IP 地址,但底层操作系统、Web 服务器或托管服务商可能会在此应用程序控制之外保留连接日志。如果您的威胁模型要求 IP 匿名,请通过 **Tor** 或可信的 **VPN** 访问此服务。
**切实可行**
- 仅接受 PDF 和 DOCX 文件。文件类型通过魔数(实际二进制签名)验证,而非文件名或用户提供的 MIME 类型——欺骗是不可能的。
- 每个文件都通过 SHA-256 验证。如果有人试图篡改,您会立即知道。
- 每个访问文件的人都会获得自己独立的删除 token。您可以控制自己能删除的内容。
- 文件自动过期(1 分钟到 24 小时)。时间一到,它们将永远消失。
**注释**
- 使用画笔、荧光笔或橡皮擦标记 PDF。您的注释仅保留在您的链接中。
- 保存与否——取决于您。如果您即将丢失未保存的工作,浏览器会警告您。
**内置保护**
- 无法右键单击,无法打印,无法保存。我们屏蔽了 Ctrl+S、Ctrl+P 等所有操作。
- 永不缓存。设备不会保留副本。
## 架构
```
sharesecure/
├── db/ # Database schemas (reference only — server auto-creates tables)
│ ├── schema.sql # Files table schema
│ └── auth_schema.sql # Users table schema
├── docs/ # Documentation
│ ├── SECURITY.md # Security policy & vulnerability reporting
│ └── TERMS_AND_CONDITIONS.md # Legal terms (source document)
├── public/ # Static frontend (served at root)
│ ├── index.html # Upload page
│ ├── app.js # Upload page logic
│ ├── style.css # Upload page styles
│ ├── viewer.html # File viewer page
│ ├── viewer.js # Viewer logic (PDF.js, annotations, sharing)
│ ├── viewer.css # Viewer styles
│ ├── terms.html # Terms & Conditions page
│ ├── 404.html # Not found page
│ ├── expired.html # Expired file page
│ ├── icon.ico # Favicon
│ ├── ShareSecure.png # Logo / banner
│ └── qrcode.min.js # Client-side QR generation (no third-party calls)
├── server/ # Express.js server
│ ├── index.js # Main server entry point
│ ├── db.js # SQLite database setup & migrations
│ ├── utils.js # Encryption, compression, pseudonymous ID utilities
│ └── routes/
│ ├── files.js # Upload/download/delete/reshare routes
│ └── auth.js # Authentication routes
├── functions/ # Cloudflare Pages Functions (serverless API)
│ ├── _middleware.js # Security headers (applied to ALL responses)
│ └── api/
│ ├── upload.js # POST - Upload file
│ ├── info/[shortId].js # GET - File metadata
│ ├── raw/[shortId].js # GET - Raw file bytes
│ ├── download/[shortId].js # GET - Force-download
│ ├── reshare/[shortId].js # POST - Untraceable reshare link
│ ├── delete/[shortId].js # POST - Delete file
│ ├── annotations/[shortId].js # GET/POST - PDF annotations
│ └── r/[shortId].js # Viewer route handler
├── .env.example # Example environment configuration
└── package.json
```
## 实际工作原理
```
You Friend A Friend B
| | |
| upload document | |
| get link: /r/ABC123 | |
| (keep it) | |
| | |
| send /r/ABC123 ------> | |
| | they open it |
| | get new link: /r/XYZ |
| | (completely separate) |
| | |
| | share /r/XYZ -------> |
| | | they open it
| | | get link: /r/QRS
| | | (totally independent)
V V V
DB Row ABC123 DB Row XYZ DB Row QRS
[identical structure] [identical structure] [identical structure]
Even if the database leaks, nobody can figure out
who shared with who. All the rows look the same.
```
## 安全性
我们剥离所有身份识别头,在各处阻止缓存,强制 HTTPS,阻止搜索引擎索引,并阻止您不需要的浏览器 API。没有 Referrer 泄露,没有指纹识别,没有 iframe 嵌入。每次上传都通过魔数验证文件类型。每次访问都根据 SHA-256 哈希值验证文件。如果出现问题,您会知道。
## 自托管
运行您自己的私有 ShareSecure 实例。您拥有数据,您控制密钥。
### 前置条件
- **Node.js 18 或更高版本** — [nodejs.org](https://nodejs.org)
- **Git** — [git-scm.com](https://git-scm.com)
- 一个加密密钥(说明如下——无需额外工具)
### 步骤 1 — 克隆仓库
```
git clone https://github.com/ishaanman7898/ShareSecure.git
cd ShareSecure
npm install
```
### 步骤 2 — 生成加密密钥
加密密钥是一个 64 字符的十六进制字符串(32 个随机字节)。您有多种生成方式:
#### 选项 A — 使用 Node.js(无需额外工具)
```
node -e "console.log('ENCRYPTION_KEY=' + require('crypto').randomBytes(32).toString('hex'))"
```
这适用于安装了 Node.js 的所有平台。复制整行 `ENCRYPTION_KEY=...`。
#### 选项 B — 使用 OpenSSL
OpenSSL 是标准的加密工具包。它可能预装了,也可能没有。
**检查是否已安装:**
```
openssl version
```
**如果缺少请安装 OpenSSL:**
| 平台 | 命令 |
|---|---|
| **Windows** (winget) | `winget install ShiningLight.OpenSSL` |
| **Windows** (Chocolatey) | `choco install openssl` |
| **Windows** (手动) | 从 [slproweb.com/products/Win32OpenSSL.html](https://slproweb.com/products/Win32OpenSSL.html) 下载 — 下载 "Light" 安装程序 |
| **macOS** (Homebrew) | `brew install openssl` |
| **Ubuntu / Debian** | `sudo apt-get install openssl` |
| **Fedora / RHEL / CentOS** | `sudo dnf install openssl` |
| **Arch Linux** | `sudo pacman -S openssl` |
| **Alpine Linux** | `apk add openssl` |
**生成密钥:**
```
openssl rand -hex 32
```
为其添加前缀:`ENCRYPTION_KEY=
标签:Cloudflare Pages, JSONLines, MITM代理, PDF批注, SHA-256, 匿名分享, 去中心化, 数据泄露, 数据防泄露, 文件共享, 文件完整性校验, 无追踪, 端到端加密, 网络安全, 自定义脚本, 自托管, 阅后即焚, 隐私保护, 零信任