经源代码验证

安全不是一个功能。
它是基础。

本页每一项说明都对应 sh0 代码库中的真实代码。2026 年 3 月 17 日的内部审计发现了 34 个问题;截至报告日期,6 个严重问题已修复。

审计结果

覆盖认证、加密、API 接口和前端的内部安全审计。

34
发现的问题
内部审计,2026 年 3 月 17 日
6/6
已修复的严重问题
截至报告日期
8/10
已修复的高危问题
截至报告日期
17/34
已修复的问题
截至报告日期

2026 年 3 月 17 日内部审计:共发现 34 个问题(6 个严重、10 个高危、12 个中危、6 个低危)。截至报告日期,6 个严重问题和 10 个高危问题中的 8 个已修复;其余问题计划在加固阶段处理。自 2026 年 10 月 5 日起,已修复的漏洞将在此发布。

我们保护什么

六个核心安全层,每个都在 Rust 源代码中经过验证。

sh0-auth

AES-256-GCM Encryption

All secrets, env vars, SSH keys, and API tokens -- and backup files when backup encryption is enabled -- encrypted with AES-256-GCM via the ring crate. Nonce format: nonce(12) || ciphertext || tag(16). Authenticated encryption ensures both confidentiality and integrity.

sh0-auth

Argon2id Password Hashing

OWASP-recommended Argon2id for all password storage. PHC-format hash output with unique random salt per password. TOTP backup codes also hashed with Argon2id.

sh0-api

HTTP-Only Cookie Auth

Access tokens (15 min) and refresh tokens (30 days) stored in HTTP-only cookies with SameSite=Strict. Secure flag auto-enabled in production. CSRF double-submit cookie pattern.

sh0-auth

API Key Security

Format: sh0_ prefix + 32 random chars. SHA-256 hashed storage, prefix-based lookup (first 8 chars). Constant-time comparison via the subtle crate to prevent timing attacks.

sh0-api

RBAC & Project Permissions

Owner, Admin, Developer, Viewer roles with per-project membership. Dedicated extractors (AuthUser, AdminUser, ProjectAccess) verify authorization on every API endpoint.

sh0-auth

TOTP Two-Factor Auth

RFC 6238 compliant, 6-digit codes, 30-second step, SHA-1 with +/-1 skew tolerance. 8 backup codes per user, each Argon2id-hashed. Provisioning URI for QR code setup.

纵深防御

01

Encrypted at rest

Master key derived via PBKDF2-HMAC-SHA256 with 100,000 iterations and a 16-byte salt. Every secret -- env vars, SSH private keys, backup dumps, API tokens -- is AES-256-GCM encrypted before touching disk.

02

Authenticated at every layer

JWT (HS256) from Bearer header or HTTP-only cookie, with API key fallback. Refresh tokens SHA-256 hashed in the database. Expired tokens caught with specific error codes. Multi-strategy auth on every request.

03

Rate-limited and throttled

Per-IP sliding window: 10 login attempts/15 min, 5 TOTP attempts/5 min, 50 invitations/min. Global read/write rate limits with automatic cleanup. Health and webhook paths exempt.

04

Audited and traceable

Every significant action logged: user ID, action, resource type/ID, IP address (X-Forwarded-For aware), timestamp. Paginated queries with filtering by user, resource type, and resource ID.

安全堆栈

PBKDF2 (100k iter.)
AES-256-GCM
Argon2id
HTTP-Only Cookies
CSRF Double-Submit
RBAC (4 roles)
Audit Log
Rate Limiting

每一层都加强下一层 -- 攻破一层,其余仍然坚守

加密依赖

没有自定义加密。仅使用经过实战检验的 Rust crate。

ring 0.17
AES-GCM, PBKDF2, SHA-256, CSPRNG
argon2 0.5
Argon2id password hashing
subtle 2.6
Constant-time comparison
jsonwebtoken 9
JWT sign/verify (HS256)
totp-rs 5
RFC 6238 TOTP generation
rustls 0.23
TLS for remote connections

源代码中已验证

每个发现都映射到实现它的 crate。

Argon2id password hashing with random salt per password (sh0-auth)
AES-256-GCM authenticated encryption for all secrets (sh0-auth)
PBKDF2-HMAC-SHA256 with 100,000 iterations for key derivation (sh0-auth)
Constant-time API key comparison (subtle crate) (sh0-auth)
Parameterized SQL queries throughout (zero SQL injection) (sh0-db)
Refresh token hashed with SHA-256, never stored in plaintext (sh0-db)
TOTP backup codes hashed with Argon2id (sh0-auth)
Docker socket communication via Unix socket only (sh0-docker)
Exec commands use array format, never shell interpolation (sh0-docker)
Foreign key constraints and WAL mode enforced on every connection (sh0-db)
Optional backup encryption with the master key before storage (sh0-backup)
SSH private keys encrypted at rest, loaded in-memory only (sh0-git)
Upload size capped at 500 MB, pagination clamped to 1-200 (sh0-api)
Input validation on database names, compose files, port strings (sh0-backup)

没有 sh0

  • x Store tokens in localStorage (XSS-vulnerable)
  • x Write custom encryption per service
  • x Manage SSH keys in plaintext on disk
  • x Hope nobody SQL-injects your queries
  • x Share root credentials across team
  • x No audit trail of who did what

使用 sh0

  • HTTP-only cookies, SameSite=Strict, CSRF protection
  • AES-256-GCM for everything, master key with PBKDF2
  • SSH keys encrypted at rest, loaded in-memory only
  • Parameterized queries + input validation everywhere
  • RBAC with 4 roles + per-project permissions
  • Full audit log with IP, user, action, resource tracing

常见问题

sh0 做过安全审计吗? +
是的,内部审计。2026 年 3 月 17 日的三部分审计(认证与加密、API 接口、前端)共发现 34 个问题:6 个严重、10 个高危、12 个中危、6 个低危。截至报告日期,6 个严重问题和 10 个高危问题中的 8 个已修复;其余问题计划在加固阶段处理。自 2026 年 10 月 5 日起,已修复的漏洞将以安全公告形式在本站发布。
How are secrets stored? +
All secrets (env vars, API tokens, SSH keys, backup credentials) are encrypted with AES-256-GCM using a master key derived via PBKDF2-HMAC-SHA256 with 100,000 iterations and a 16-byte salt. The master key file is generated once and encrypted at rest.
How does authentication work? +
JWT access tokens (15 min) in HTTP-only cookies with SameSite=Strict. Refresh tokens (30 days) SHA-256 hashed in the database. API key fallback with constant-time comparison. CSRF protection via double-submit cookie pattern. Bearer tokens supported for CLI.
What about two-factor authentication? +
TOTP (RFC 6238) with 6-digit codes, 30-second step, and +/-1 skew tolerance. 8 backup codes per user, each Argon2id-hashed. Rate-limited to 5 attempts per 5 minutes to prevent brute force.
Can one user access another user's containers? +
No. Every API endpoint that touches containers verifies project membership through the ProjectAccess extractor. Global owners/admins can access all projects, but developers and viewers must have explicit per-project membership.
What about container security? +
Docker Engine communication uses Unix socket only (no TCP exposure). All container commands use exec arrays, never shell interpolation. Compose files are structurally validated before deployment, including volume mounts, port strings, and dependency graphs.
一键模板的安全由谁负责? +
这是共同的责任。sh0 维护模板定义,并在收到漏洞报告时修复模板。镜像由各上游项目发布;已部署应用的安全(镜像版本、应用更新、其自身的用户和密码)由运营服务器的一方负责。
Which cryptographic libraries do you use? +
ring 0.17 (hardware-accelerated AES-GCM, PBKDF2, SHA-256), argon2 0.5 (password hashing), subtle 2.6 (constant-time comparison), jsonwebtoken 9 (JWT), totp-rs 5 (TOTP), and rustls 0.23 (TLS). No custom cryptography.

报告安全漏洞

请发送邮件至下方地址,注明 sh0 版本、复现步骤和观察到的影响。请勿公开提交 issue。

[email protected]

如未收到回复,也可以使用联系表单: sh0.dev/contact

我们的承诺

  • 72 小时内确认收到报告。
  • 修复目标:严重漏洞 7 天内,高危漏洞 30 天内,其余 90 天内。
  • 严重和高危漏洞会在修复前 48 至 72 小时预告:仅包含日期、严重程度和组件,细节随修复一同发布。
  • 安全修复将以补丁版本发布,不与新功能混合,以便补丁模式的自动更新可以单独安装。

善意研究

对于在您自己的 sh0 实例上善意开展的研究,我们不会采取法律行动:不访问他人数据,不干扰不属于您的服务,并在公开前给我们合理的修复时间。

奖励

上线初期不提供现金奖励:经研究者同意后,我们会在本页公开致谢。外部渗透测试之后可能推出奖励计划。

企业级安全,内置其中

AES-256-GCM、Argon2id、TOTP 双因素认证、RBAC、审计日志、速率限制。安全性可在源代码中验证,漏洞通过公开的披露政策报告。