Skip to content

Compatibility, Security Hardening, and Performance Improvements

Choose a tag to compare

@shuaiplus shuaiplus released this 18 Feb 17:03
· 735 commits to main since this release

Release Notes

v0.3.0 - 2026-02-18

Added

  • Pagination support for list endpoints:
    • Added pageSize + continuationToken handling for /api/ciphers and /api/folders.
    • Added reusable pagination utility module (src/utils/pagination.ts).
  • Added a comprehensive self-check script (tests/selfcheck.ts) and npm command:
    • npm run selfcheck
    • Covers compatibility, auth flow, CORS, sync, attachments, blocked endpoints, and gap checks.
  • Added centralized limits/config constants (src/config/limits.ts) for auth, rate limits, cache, cleanup, pagination, compatibility versioning, and more.
  • Added in-memory /api/sync response cache (short TTL) and support for excludeDomains query handling.
  • Added one-time-use protection for attachment download tokens:
    • New used_attachment_download_tokens table and consume-once check.

Changed

  • Refactored setup page rendering into a dedicated template module (src/setup/pageTemplate.ts), replacing older split setup page handlers.
  • Improved icon proxy and favicon behavior:
    • Added custom NW favicon (/favicon.ico, /favicon.svg).
    • Added devtools probe endpoint (/.well-known/appspecific/com.chrome.devtools.json).
    • Added icon hostname validation and edge cache usage for /icons/{hostname}/icon.png.
  • Improved rate limiting strategy:
    • Login throttling now tracks by client IP (login_attempts_ip) instead of email.
    • Split API budgets into write-operations budget and dedicated /api/sync read budget.
    • Added low-frequency cleanup for stale limiter records.
  • Improved cipher model compatibility:
    • Introduced opaque passthrough for unknown cipher fields so new client fields can round-trip without server changes.
  • Improved refresh token storage:
    • New tokens are stored as SHA-256 keyed values (with legacy plaintext token migration compatibility).
  • Updated routing and API behavior for single-user mode and compatibility alignment:
    • Some blocked account operations now return 501 Not implemented in single-user mode.
    • /config.version and /api/version now share a single source of truth from limits config.

Fixed

  • Fixed folder deletion behavior to clear folderId references in related ciphers.
  • Fixed potential D1 bind errors by normalizing undefined to null in storage bindings.
  • Fixed registration race path by creating first user atomically (createFirstUser) to enforce single-user bootstrap safely.
  • Fixed identity error responses to consistently match OAuth-style expectations.
  • Fixed setup/register write protections by requiring same-origin browser evidence (Origin/Referer) on setup-sensitive write endpoints.
  • Fixed attachment download endpoint security and behavior:
    • Added strict JWT secret safety guard checks for attachment public download path.
    • Removed permissive attachment CORS response behavior.

Security

  • Strengthened CORS policy:
    • Replaced wildcard behavior with allowlist-style origin handling for same-origin and trusted Bitwarden client origins.
    • Added stricter preflight validation.
  • Hardened first-time setup and registration path:
    • Stronger JWT secret checks and clearer setup flow guidance.
    • Additional safety checks for encrypted key-like payloads during registration/key updates.

Docs & Project

  • Documentation refresh:
    • Added English README (README_EN.md) and updated README structure/content.
    • Updated feature comparison tables and deployment guidance.
    • Replaced README_ZH.md with README.md as the Chinese primary doc.
  • Added upstream sync workflow (.github/workflows/sync-upstream.yml).
  • Updated wrangler.toml project naming and removed placeholder D1 database ID.

发布说明

v0.3.0 - 2026-02-18

新增

  • 列表接口分页能力:
    • /api/ciphers、/api/folders 支持 pageSize + continuationToken。
    • 新增通用分页工具模块(src/utils/pagination.ts)。
  • 新增完整自检脚本(tests/selfcheck.ts)与 npm 命令:
    • npm run selfcheck
    • 覆盖兼容性、认证流程、CORS、同步、附件、受限端点、缺口分析等。
  • 新增统一配置常量(src/config/limits.ts),集中管理认证、限流、缓存、清理、分页、兼容版本号等参数。
  • 新增 /api/sync 短时内存缓存,并支持 excludeDomains 请求参数。
  • 新增附件下载令牌一次性消费保护:
    • 增加 used_attachment_download_tokens 表并校验“只可使用一次”。

变更

  • 重构 setup 页面渲染结构:
    • 将初始化页面整合到独立模板模块(src/setup/pageTemplate.ts),替代原有拆分 handler。
  • 改进图标代理与站点图标行为:
    • 增加 NW 自定义 favicon(/favicon.ico、/favicon.svg)。
    • 增加 devtools 探测端点(/.well-known/appspecific/com.chrome.devtools.json)。
    • 为 /icons/{hostname}/icon.png 增加主机名校验与边缘缓存。
  • 调整限流策略:
    • 登录限流从按邮箱改为按客户端 IP(login_attempts_ip)。
    • API 限流拆分为写请求预算 + /api/sync 读请求预算。
    • 增加低频过期记录清理。
  • 提升 cipher 模型兼容性:
    • 引入“未知字段透传”能力,新版客户端新增字段可无损往返。
  • 改进 refresh token 存储:
    • 新令牌按 SHA-256 key 存储,同时兼容旧明文 token 迁移。
  • 单用户模式与兼容策略细化:
    • 部分受限账户操作改为返回 501 Not implemented in single-user mode。
    • /config.version 与 /api/version 统一由配置常量驱动。

修复

  • 修复删除文件夹后 cipher 仍残留 folderId 引用的问题。
  • 修复 D1 参数绑定时 undefined 导致的运行错误(统一转换为 null)。
  • 修复首次注册竞争路径:通过原子化 createFirstUser 安全保证单用户初始化。
  • 修复 identity 端点错误响应格式,与 OAuth 风格保持一致。
  • 修复 setup/register 写操作保护:对敏感写端点要求同源浏览器证据(Origin/Referer)。
  • 修复附件下载链路的安全与行为细节:
    • 附件公开下载端点增加 JWT 密钥安全检查。
    • 移除附件下载响应中的宽松 CORS 行为。

安全

  • 强化 CORS 策略:
    • 从通配符改为 allowlist 风格,仅允许同源和受信任 Bitwarden 客户端来源。
    • 预检请求校验更严格。
  • 强化初始化与注册阶段安全性:
    • 更严格的 JWT_SECRET 校验和引导流程。
    • 对注册/密钥更新中的加密字段做结构校验。

文档与工程

  • 文档更新:
    • 新增英文文档 README_EN.md,并整体调整 README 结构与内容。
    • 更新功能对比表与部署说明。
    • 以 README.md 作为中文主文档,移除 README_ZH.md。
  • 新增上游同步工作流(.github/workflows/sync-upstream.yml)。
  • 更新 wrangler.toml 项目名并移除占位 D1 database_id。