经源代码验证

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

此页面上的每项声明都对应 sh0 代码库中的真实代码。通过 3 次并行审计发现并修复 34 个问题。解决 6 个关键漏洞。零妥协。

审计结果

涵盖身份验证、加密、API 层面和前端的完整安全审计。

34
Issues found & fixed
Across 3 parallel audits
6
Critical issues
All resolved
10
High-severity issues
All resolved
100%
Resolution rate
Critical + High

我们保护什么

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

sh0-auth

AES-256-GCM Encryption

All secrets, env vars, backup files, SSH keys, and API tokens 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)
Encrypted backups with 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

常见问题

Has sh0 been security audited? +
Yes. A comprehensive 3-part audit (Auth/Crypto, API Surface, Frontend) identified 34 issues. All 6 critical and 10 high-severity issues have been fixed. Every security feature described on this page has been verified against the actual source code.
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.
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.

企业级安全,内置其中

发现 34 个问题。修复 34 个问题。AES-256-GCM、Argon2id、TOTP 2FA、RBAC、审计日志、速率限制。可在源代码中验证的安全性。