Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

zen-fs-config

Latest version: v0.10.3

Overview

Last scanned
27 Nov 2026
Published
27 Nov 2026
npm package Publisher: richard432
1 Stars
0 Forks
78 Versions
10.2K Downloads
TypeScript Repo language

Scan summary

zen-fs-config was last scanned on 27 Nov 2026 at version 0.10.3. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 78 versions; the latest 5 were published within 3 days (25–27 Nov 2026).
  • Findings: No rules fired in version 0.10.3.
  • Downloads: 10,244 downloads.

Versions

78 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.10.3 LATEST 27 Nov 2026 No rules fired
0.10.2 27 Nov 2026 No rules fired
0.10.1 26 Nov 2026 No rules fired
0.10.0 26 Nov 2026 Not shown
0.9.8 25 Nov 2026 Not shown

No rules fired in 0.10.3

Findings

Findings for v0.10.3. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.10.3; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

zen-fs-config

基于 ZenFS 的分布式配置管理库。以 IndexedDB 为本地主后端(offline-first),用户提供的远程后端作为副本自动同步。支持应用隔离、共享空间、节点本地配置和冲突安全。

架构方向(REQUIREMENTS §9 D2):核心采用通用同步组(GenericSyncGroup)基类 + 两种类型实现——config-sync(版本化/墓碑/冲突,并承载 .meta/app-data-groups/)与 data-sync(纯文件同步,可经配置同步组以 app-data-groups 纳管);后端类型管理与数据后端信息写入仍留在核心 zen-fs-config(UI 仅做呈现)。本文档描述的是当前实现(两类 repo),目标架构以 D2 为准。

GitHub: https://github.com/weijia/zen-fs-config NPM: zen-fs-config 设计文档: DESIGN.md

功能特性

  • 离线优先 — IndexedDB 始终是主后端;读写在无网络时也能工作
  • 多后端同步 — 可添加任意数量的远程副本(Gitee、GitHub、RemoteStorage、WebDAV 等),自动双向同步
  • 应用隔离 — 每个 appId 拥有独立的配置空间
  • 共享空间 — /shared/ 目录在所有设备间同步
  • 节点本地配置 — 按 /nodes/{nodeId}/ 存放的每设备配置,随主同步对双向同步到后端(各节点以 nodeId 子目录隔离)
  • 自描述拓扑 — 后端配置以文件形式存于 .meta/backends/,重新打开仓库时自动恢复全部状态

安装

# 核心依赖(始终需要)
npm install zen-fs-config @zenfs/core @zenfs/dom zen-fs-sync

# 可选云后端 —— 对等依赖,仅安装你实际用到的
npm install zen-fs-github           # GitHub(仓库/分支)副本
npm install zen-fs-gitee            # Gitee(仓库/分支)副本
npm install zen-fs-remotestoragejs # RemoteStorage 副本

@zenfs/dom 提供 IndexedDB 后端(浏览器环境必需)。zen-fs-cache 为可选依赖。

云后端是可选对等依赖,由你(使用者)自行安装,zen-fs-config 并不打包它们。 核心会预注册 GitHub、Gitee、RemoteStorage 这三种后端类型(因此你可以直接把 type: 'Gitee' 等传给 addBackend/connect,无需调用 registerBackend),但不包含它们的实现包。你必须自己 npm install 对应包;否则 createBackend() 会抛出明确的"未安装——请运行 npm install <pkg>"提示。这样可保持核心包体积精简,也不会强制所有人都带上网络依赖。

通过 <script> 标签直接使用(无需构建)

包内置了一个自包含的浏览器构建 dist/zen-fs-config.js,它把核心依赖(@zenfs/core、@zenfs/dom、zen-fs-sync、zen-fs-cache)打包在一起,并将库挂载到全局变量 window.ZenFSConfig。无需 npm install、无需打包工具,直接放入任意 HTML 页面即可。云后端(GitHub / Gitee / RemoteStorage)并不包含在自包含包内——见下方小节,了解如何在 <script> 模式下启用它们(无需 import map)。

<script src="https://unpkg.com/zen-fs-config/dist/zen-fs-config.js"></script>
<script>
  (async () => {
    const { connect } = window.ZenFSConfig;

    // 自动创建 IndexedDB 主后端
    const { repo } = await connect('my-app');

    repo.setConfig('greeting.json', { msg: 'hello' });
    const cfg = await repo.getConfig('greeting.json');
    console.log(cfg); // { msg: 'hello' }
  })();
</script>

浏览器构建包含纯 JS 实现的 SHA-256 回退,因此即使在 crypto.subtle 不可用的非安全上下文(普通 HTTP)中,版本追踪也能正常工作。

在 <script> 模式下启用云后端(GitHub / Gitee / RemoteStorage)—— 无需 import map

自包含核心包不包含云后端实现——它们是可选对等依赖,为保持包体积精简而被排除在核心之外。好消息是:三个云包现在都已发布浏览器全局(UMD)构建,因此在无编译的 <script> 页面里,你只需用普通的 <script> 标签即可启用它们——无需 import map、也无需打包器:

<script src="https://unpkg.com/zen-fs-gitee/dist/zen-fs-gitee.global.js"></script>
<script src="https://unpkg.com/zen-fs-github/dist/zen-fs-github.global.js"></script>
<script src="https://unpkg.com/zen-fs-remotestoragejs/dist/zen-fs-remotestoragejs.global.js"></script>
<script src="https://unpkg.com/zen-fs-config/dist/zen-fs-config.js"></script>
<script>
  (async () => {
    const { connect } = window.ZenFSConfig;
    const { repo } = await connect('my-app', {
      backendInfo: { type: 'Gitee', options: { token, owner, repo, branch } },
    });
  })();
</script>

构建文件 → 全局变量映射:

  • zen-fs-gitee → window.ZenFSGitee(构建文件:dist/zen-fs-gitee.global.js)
  • zen-fs-github → window.ZenFSGitHub(构建文件:dist/zen-fs-github.global.js;v1.1.3+)
  • zen-fs-remotestoragejs → window.ZenFSRemoteStorage(构建文件:dist/zen-fs-remotestoragejs.global.js)

zen-fs-config 会自动识别这些全局变量(window.ZenFSGitee / window.ZenFSGitHub / window.ZenFSRemoteStorage)并直接使用,跳过裸 import()。由于三个包都声明了 browser/unpkg 字段,裸包名 URL(如 https://unpkg.com/zen-fs-github)同样会返回全局构建——如果你愿意,也可以把前面三行 <script> 简写成裸 URL。

快速开始

1. 初始化(零参数)
import { connect } from 'zen-fs-config';

// 不传任何后端参数,自动创建 IndexedDB 本地主后端
const { repo } = await connect('my-app');

// 读写配置(同步 API,从 IndexedDB 读取)
repo.setConfig('/database', { host: 'localhost', port: 5432 });
const db = repo.getConfig<{ host: string; port: number }>('/database');
2. 设置新的配置
repo.setConfig('/cache', { ttl: 3600, maxSize: '100MB' });
repo.setConfig('/feature-flags', { newUI: true, beta: false });
3. 增加数据后端(副本)
// GitHub / Gitee / RemoteStorage 已由核心预注册,无需 registerBackend。
// 先安装对应包(如 `npm install zen-fs-gitee`,见「安装」),然后:
await repo.addBackend('gitee-prod', 'Gitee', {
  token: 'your-token',
  owner: 'your-name',
  repo: 'config-repo',
  branch: 'main',
}, '生产环境 Gitee 配置仓库');
// ↑ 自动与本地 IndexedDB 主后端双向同步
4. 自动同步
// setConfig 写入 IndexedDB 后,自动同步到所有副本后端
repo.setConfig('/database', { host: 'new-host', port: 5432 });

// 手动触发同步(通常不需要,同步是自动的)
await repo.flush();
5. 再次打开时初始化
// 重新打开页面时,只需传入 appId
// IndexedDB 中的配置和后端拓扑会自动恢复
const { repo } = await connect('my-app');

// 配置直接从 IndexedDB 读取(离线可用)
const db = repo.getConfig<{ host: string; port: number }>('/database');

// 已注册的副本后端会自动重新连接并同步
const backends = await repo.getBackends();
console.log(backends?.backends.map(b => b.id)); // ['local-idb', 'gitee-prod', ...]
6. 带初始后端初始化
// 首次初始化时可以直接传入远程后端
const { repo } = await connect('my-app', {
  primaryBackendId: 'gitee-prod',  // 副本后端 ID
  backendInfo: {
    type: 'Gitee',
    options: { token: 'xxx', owner: 'xxx', repo: 'xxx', branch: 'main' },
  },
  idbStoreName: 'my-app-config',  // 自定义 IndexedDB store 名称
  // 全新(空)远端自己没有组类型:必须显式声明,
  // 否则 connect() 抛 NeedsInitError,而不是替你猜。
  initGroupType: 'config-sync',
});

// 之后重新打开时不需要再传后端参数
const { repo: repo2 } = await connect('my-app');

统一入口:connect()

如果你事先不知道某个后端里放的是配置同步仓库(config-sync)还是数据同步组(data-sync),可以用统一的 connect() 入口。它始终以配置同步组(ConfigRepo)为锚点(数据组统一由其承载);当后端是 data-sync 时,会把它挂到配置同步组下的默认数据组上。数据同步组不提供独立顶层入口——数据组一律由配置同步组经 createAppDataGroup 纳管(决策 A / T5)。

import { connect } from 'zen-fs-config';

// 1. 不传 backendInfo → 纯本地,默认 config-sync
const { groupType, repo } = await connect('my-app');

// 2. 传入远程后端 → 自动探测组类型
const result = await connect('my-app', {
  backendInfo: { type: 'Gitee', options: { token, owner, repo, branch } },
});
if (result.groupType === 'data-sync') {
  // result.dataGroup — 由配置同步组纳管的数据组(result.repo 为对应的配置同步组)
} else {
  // result.repo — ConfigRepo
}

探测与分发规则:

  • 始终创建(或复用)一个配置同步组 ConfigRepo 作为锚点。
  • 建任何本地东西之前先探测后端:严格读 /.meta/group.json(只有真正的「不存在」才算空,401/403 会照实报错而不是被吞成空库),没有描述符时再读旧标记 /.config/group-type、/.meta/group-type。探测结果是 unreachable | empty | marked | occupied 四态之一。
  • 库不再生成任何 group-type 标记(0.9.0 起):组类型只由 group.json 的 kind 表达,旧标记仅作读取兼容,遇到就删除。所以 getGroupType() 在新部署上返回 null,判断类型请读描述符的 kind(或直接看 connect() 返回的 groupType)。
  • unreachable → 抛 RemoteUnreachableError(code: 'REMOTE_UNREACHABLE'),不创建本地组。
  • empty(无描述符也无标记)→ 抛 NeedsInitError(code: 'NEEDS_INIT',requiresInit: true),除非你传了 initGroupType(或旧选项 groupType)。库不会替全新后端猜组类型 —— 先问用户,再带类型重连。
  • marked → config-sync 把该后端连到配置同步组;data-sync 把它挂到配置同步组下的默认数据组。
  • 显式传的 options.groupType 与探测结果不符 → Group type mismatch;occupied 但描述符 kind 非法 → 直接报错。
  • 返回的 ConnectResult 始终带 groupType 和 repo(配置同步组);接入 data-sync 后端时还带 dataGroup(默认数据组)。
方法 说明
connect(appId, options?) 统一入口:始终返回 ConfigRepo,可选附带默认数据组
probeGroupTypeDetailed(type, options) 只探测、不写本地:返回 { state, groupType, remote, error?, descriptor? }

connect() 接受与 createConfigRepo 相同的选项(backendInfo、primaryBackendId、idbStoreName、nodeId、folderPath、cache、serializer、onConflict、syncPollIntervalMs),另加 groupType、initGroupType(远端为空时用户选定的组类型)与 deferReplicaSetup。在 Node.js 上通过 folderPath(或设 ZEN_FS_CONFIG_HOME)开启本地磁盘持久化。

deferReplicaSetup:两个信号

默认就是本地优先:connect() 不再逐个校验远端后端(每个副本一次网络往返)才返回,这段直接挪到后台;传 deferReplicaSetup: false 才恢复「等所有副本校验完再返回」的旧行为(此时一个不响应的后端会把 connect() 挂住):

const result = await connect('my-app', {
  backendInfo: { type: 'Gitee', options: { token, owner, repo, branch } },
  deferReplicaSetup: true,
});

// 信号① —— connect() 已返回,本地配置立刻可用
result.repo.getConfig('/theme');
result.replicasPending; // true

// 信号② —— 远端校验 + 建对完成
const summary = await result.whenReplicasReady?.();
// { ready: ['Gitee-replica'], skipped: [], failed: [] }
  • 信号①(connect() resolve):本地仓完整可用 —— 读写、getBackends()(描述符已落盘)、listAppDataGroups() 都正常。但此时还没有同步对,getSyncStatuses() 是空的。不能把空的同步对列表当成「没有远端后端」,先看 replicasPending。
  • 信号②(whenReplicasReady()):resolve 出 { ready, skipped, failed }。skipped 是 { backendId, reason },表示该后端归属别的同步组(身份冲突)—— 这类情况不再从 connect() 抛出;failed 是 { backendId, error },表示建实例 / 网络失败。该方法永不 reject;未开 defer 时也会立即 resolve(读当前状态),所以调用方可以无分支地 await。
  • 校验通过前不建任何同步对,因此没有「建了又拆」的冲突窗口,也不需要给同步加闸门。代价是消费方必须认上面两个信号。
  • dispose() 与 flush() 都会等待后台建对,晚到的 pair 不会挂到已销毁的引擎上,flush() 也不会跑在 0 个 pair 上。

数据组的路径语义

dataGroup.fs 暴露的是数据组的逻辑根(应用数据目录),不是某一个后端的物理根。

  • 往组根相对路径(例如 /struct/a.json)写入,会同步到组内所有后端。
  • 每个后端会把同一个逻辑路径映射到自己的物理根:Gitee/GitHub 仓库根、RemoteStorage 的 basePath、WebDAV 目录等。
  • 后端的 basePath / 仓库根是物理根,不是所有后端共用的逻辑前缀。多个后端拥有不同的物理根是合法的;不要因为 basePath 不一致就判定数据组不可用。
  • 所有后端都应使用同一个组根相对路径。如果应用要在组根下划一个命名空间(例如 app_data/folders),那是应用层显式约定,不能从后端 basePath 反推。
// dataGroup.fs 是数据组逻辑根;组内所有后端都会收到这个路径。
await dataGroup.fs.promises.writeFile('/struct/host.json', json);

一个常见错误是逐个比较后端的 basePath,再试图算出一个“公共写入前缀”。这把逻辑组根和物理后端根混为一谈,会误拒绝本来可用的多后端数据组。

目录结构

/
├── {appId}/              # 应用私有配置(自动同步到副本)
├── shared/               # 跨应用共享配置(双向同步)
├── nodes/{nodeId}/       # 节点本地配置(同步;按 nodeId 命名空间隔离)
└── .meta/
    ├── backends/          # 后端拓扑(每个后端一个文件)
    │   ├── local-idb.json
    │   ├── gitee-prod.json
    │   └── ...
    ├── .deleted/          # 删除墓碑(跨后端删除传播)
    └── .conflicts/        # 冲突归档(双方内容都保存)

每个配置文件有 sidecar 版本文件:db.json → .db.json.version(版本号 + SHA-256 哈希)。

核心 API

入口:用统一的 connect(appId, options?)(见上)获取 ConfigRepo。createConfigRepo 仍作为底层工厂导出,但推荐用 connect——它还统一处理 data-sync 组与 Node.js 本地持久化(folderPath / ZEN_FS_CONFIG_HOME)。

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm zen-fs-config

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Vulnerability Insights

OpenSSH Password Authentication Bypass on Alpine Linux (*sshole) – CVE-2026-123158

Frame 2085668439 (1)
Group 1261154229