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

mizar

Latest version: v2.0.0

Overview

Last scanned
27 Nov 2026
Published
27 Nov 2026
npm package Publisher: amwenjie
0 Stars
0 Forks
1 Versions
163 Downloads
TypeScript Repo language

Scan summary

mizar was last scanned on 27 Nov 2026 at version 2.0.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: First and only release on 27 Nov 2026.
  • Findings: No rules fired in version 2.0.0.
  • Downloads: 163 downloads.

Versions

1 version published
Versions and the rules that fired in each
VersionPublishedStatus
2.0.0 LATEST 27 Nov 2026 No rules fired

No rules fired in 2.0.0

Findings

Findings for v2.0.0. 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 2.0.0; other versions have their own rules, not their own score.

README

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

mizar

mizar 是一个 React 服务端渲染(SSR)/ 同构框架。它负责运行时与约定,构建交给配套的编译工具 alcor。

  • 同构渲染:服务端 renderToString / 流式渲染,客户端 hydrateRoot;getInitialData 双端取数。
  • 多 SPA:一个 webserver、一套 URL 命名空间;basePath 可选,归属按完整路由模式判定。
  • 按需加载:@loadable/component + alcor 的 @loadable/babel-plugin,SSR 与 hydration 一致。
  • 服务端 API:src/server/apis 文件即路由(express 风格)。
  • 远程组件(M1):RemoteRegistry 运行时加载 + <RemoteBoundary /> 统一双端渲染。
  • WebServer:Express 封装(安全头、压缩、代理、静态资源、访问日志脱敏、健康检查)。

当前版本 2.0.0。peer 依赖:react ~18.3、react-dom ~18.3、react-redux ~9.1、react-router-dom ~6.26、react-router ~6.26、redux ~5、@reduxjs/toolkit ~2.2、redux-thunk ~3.1。


目录结构

-config
  -app.json              # 部署实例:name / port / cdn / assetsPathPrefix
  -apps.json             # 多 SPA 清单(可选):name / basePath? / ssr? / client? / hidden?
  -configure.json        # 编译期配置(alcor 读)+ federation 运行时配置(mizar 读)
-src
  -isomorphic            # 同构代码(客户端/服务端都会执行)
    -spa1.ts             # SPA 入口:本级目录下每个 .ts/.tsx 都是一个入口,文件名 = app 名
    -spa2.ts
    -routers
      -index.tsx         # react-router v6 路由表
    -pages
      -PageA
        -index.tsx       # 页面组件(connect() 包裹)
        -index.less      # 样式(pages/components 目录下按 CSS Modules 处理)
        -reducer.ts      # 页面 reducer(alcor 编译期注入)
        -interface.ts
    -common
    -public              # 非模块化静态文件(可选,需在 meta 中引入)
  -server
    -apis                # 服务端 API(文件路径 = URL 路径)
    -index.ts            # 服务端启动入口
  -standalone            # 独立产物入口(可选)
-typings
-package.json
-tsconfig.json

入口文件约定:src/isomorphic 本级目录(不含子目录)的所有 .ts/.tsx 都是 SPA 入口,文件名即 app 名;子目录(pages/routers/common)永远不会被当作入口。


快速开始(单 SPA)

config/app.json

{ "name": "my-app", "port": 8891, "assetsPathPrefix": "static/", "cdn": "/" }

src/isomorphic/index.ts

import { bootstrap } from "mizar/iso/bootstrap";
import routers from "./routers/index";
import notFound from "./routers/notfound";

bootstrap(routers.concat(notFound))();

src/server/index.ts

import WebServer from "mizar/server";
import { bootstrap } from "mizar/server/bootstrap";
import routers from "../isomorphic/routers/index";
import notFound from "../isomorphic/routers/notfound";
import meta from "./meta";

(async () => {
    const server = new WebServer({ compress: true });
    await bootstrap(server)(routers.concat(notFound), meta);
})();

客户端入口:bootstrap

import { bootstrap } from "mizar/iso/bootstrap";

bootstrap(pageRouter, { appId?, basename? })(containerId?: string): Promise<Root | undefined>
  • pageRouter:当前 SPA 的路由表(react-router v6 RouteObject[])。
  • appId:调试标识(运行时身份由服务端下发的 window.__SPA__ 决定)。
  • basename:反向代理前缀(单 app 部署在 /myapp 下时使用)。多 SPA 请用 apps.json 的 basePath,入口不需要重复写;显式 basename 优先。
  • containerId:挂载容器,默认 "app"。

启动流程:loadableReady() → 预加载当前命中的路由 loadable(保证页面 connect()/reducer 在 store 创建前注册)→ 预加载 registerLoadablePreload 注册的远程组件 → getStore() 恢复 __PRELOADED_STATE__ → __onlyCSR__ === false 时 hydrateRoot,否则 createRoot。window.__NO_HYDRATE__ === true(server-only app)时直接返回。

registerLoadablePreload(component):把 loadable(...)(含 Module Federation 远程组件)登记为“首帧前必须 resolve”,避免 hydration 时服务端已渲染真实内容、客户端却渲染 loading。远程组件已由 <RemoteBoundary /> 自动登记。


服务端入口:bootstrap

import { bootstrap } from "mizar/server/bootstrap";

bootstrap(server?: WebServer)(apps: IPageRouter[] | IAppDefinition[], meta?: IGetMetaFn | IMetaProps)
  • 传 IPageRouter[]:单 SPA(历史签名)。
  • 传 IAppDefinition[](每项带 router):多 SPA。

IAppDefinition

字段 类型 默认 说明
name string 必填 app 名,同时是客户端入口名
basePath string "/" 可选 URL 前缀,如 "/admin";只拼接本 app 的路由,不作为同/跨 SPA 判定依据
entry string name 客户端入口名
ssr boolean true 是否 SSR
client boolean true false = server-only:输出 SSR HTML、不加载客户端入口、自动 Cache-Control: private, no-store + X-Robots-Tag: noindex
hidden boolean false true = 不下发到公开的 window.__APPS__
cacheControl string "private, no-store" server-only app 的缓存头
router IPageRouter[] 必填 路由表
meta IGetMetaFn \| IMetaProps — 页面 head 配置

启动顺序:

  1. assertNoReducerConflicts():跨 app 的 reducer 名冲突直接报错。
  2. 读 config/configure.json 的 federation.remotes,自动加载远程组件(失败不阻塞;federation.autoLoadRemotes: false 可关闭)。
  3. 挂载 src/server/apis 生成的 API 路由 + 页面路由。
  4. server.bootstrapAsync() 开始监听。

页面:getInitialData 与 connect

getInitialData

页面组件(函数组件或类组件)实现静态方法 getInitialData(initFetch, options):

PageA.getInitialData = async function (initFetch, options) {
    const res = await initFetch({
        method: "POST",
        url: "/api/path/method/name",      // 服务端只允许 /api/ 相对路径或 http(s) 绝对地址
        params: { id: options.params.id }, // query string
        data: { key: 1 },                  // 请求体
    });
    return { data: res.data };
};
  • initFetch(config):唯一可用的请求方法(内部复用请求上下文:cookie/headers/url)。配置同 axios。
  • options.params:路由参数(/detail/:id 的 id)。
  • options.query:query string。
  • options.body:请求体。
  • 返回值会写入该页面 reducer(state[reducerName]),SSR 与客户端导航都会调用。
connect
import { connect, reduxConnect } from "mizar/iso/connect";

export default connect()(PageA, [childA, childB]);
  • connect(mapStateToProps?, mapDispatchToProps?, mergeProps?, options?) 与 react-redux 一致。
  • 返回的 enhancer:(component, reducer?, reducerName?, subComponents?)。
  • 省略 reducer / reducerName 时,由 alcor 在编译期按约定从同目录 reducer.ts 注入(页面必须写在 .../Xxx/index.tsx,同目录放 reducer.ts)。
  • reduxConnect 是 react-redux 原始 connect。
Page 组件里的 props

connect() 默认把 state[reducerName] 展开为 props,并注入 dispatch。页面拿到的 data 就是 getInitialData 返回的 data。


路由

react-router v6 useRoutes 风格:

const pageRouter = [
    { path: "/detail/iso/:id", element: <VideoDetail /> },
    { path: "/detail/article/:id", element: <ArticleDetail /> },
    { path: "/detail/video/:id", element: <AsyncVideoDetail /> }, // loadable 按需加载
    { path: "*", element: <NotFound />, name: "NotFound" },
];
  • 按需加载:const AsyncX = loadable(() => import("./pages/X"));alcor 的 @loadable/babel-plugin 负责 SSR 的 requireSync。
  • 404:path: "*"(可用 name: "NotFound" 或 notFound: true 标记);catch-all 不参与 app 归属判定。
  • 嵌套路由:children 支持,归属判定会拼出完整 URL 模式。

多 SPA

多 SPA 由同一个 webserver 启动,视为一个大网站:页面 URL 是全站唯一命名空间。

完整 URL
完整 URL = basePath + 路由 path

例:basePath: "/admin" + 路由 /video/:id → 页面地址 /admin/video/:id。路由文件里写的仍是不带前缀的 /video/:id。

basePath 是可选的
  • 不设就是根相对(/detail/article/:id)。
  • 设了就是给这个 app 的所有路由加前缀(如 /user、/admin)。
  • basePath 不是同/跨 SPA 的判定依据:判定始终是「目标 URL 是否命中某个 app 的完整模式」。
归属判定(服务端 / 客户端一致)
  • 服务端:把每个 app 的路由拼上它的 basePath 得到完整模式,按 matchPath 匹配请求 URL;catch-all 不参与;最长模式优先;无命中时由第一个带 catch-all 的 app 渲染 404。
  • 客户端:window.__APPS__ 下发 { name, basePath, routes },其中 routes 已是完整模式;getAppByPath(url) 取最长匹配。
全站 URL 唯一

启动时 assertNoRouteConflicts 检测完整模式重复并抛错(/admin/x 与 /user/x 不冲突)。语义重叠(/a/:id vs /a/:slug)由写 URL 的人保证。

服务端下发/注入的客户端变量
变量 内容
window.__SPA__ 当前 app 名
window.__SPA_BASE__ 当前 app 的 basePath(客户端 bootstrap 自动作为 basename)
window.__APPS__ [{ name, basePath, routes }](仅非 hidden app;不含 entry/router 组件/ssr/meta)
window.__PRELOADED_STATE__ 首屏 Redux state
window.__onlyCSR__ false = 需要 hydration
window.__NO_HYDRATE__ true = server-only app,不 hydrate

导航

跨 SPA / 同 SPA 的判定与执行由框架 API 统一处理:

import { AppLink } from "mizar/iso/components/AppLink";
import { useAppNavigate } from "mizar/iso/libs/navigation";
import { navigateTo } from "mizar/iso/libs/apps";

<AppLink to="/admin/video/1">去 spa2</AppLink>;

const navigate = useAppNavigate();
navigate("/detail/article/1111");

navigateTo("/detail/article/1111", navigate);
目标 URL 行为
命中当前 app 的完整模式 react-router 客户端导航(basename-relative),在浏览器 getInitialData 后渲染,不整页刷新
命中另一个 app 的完整模式 window.location.assign(url) 整页请求;服务端选中目标 app 返回其文档
不属于任何 app 不算跨 SPA,由当前 app 的 catch-all 渲染 404(不整页刷新、不循环)
  • 跨 SPA 必须用 AppLink / useAppNavigate / navigateTo。
  • react-router 原生 useNavigate / Link 只用于同 SPA(它不会走跨 SPA 判定)。
  • toAppRelativePath(url):把完整 URL 转为当前 app 的 basename-relative 路径(无 basePath 时恒等)。
  • 其余工具:getAppByPath(url)、isCrossAppPath(url)、getCurrentAppName()、getCurrentBasePath()、getClientApps()。

服务端 API

src/server/apis 下的文件路径即 URL 路径(编译产物是 dist/apis/*.js,由 alcor 的 ServerApiPack 生成)。

// src/server/apis/path/method.ts
export function get(req, res) { res.send("GET"); }
export function post(req, res) { res.json({ ok: true }); }
export function love(req, res) { res.send("love"); }
export default function all(req, res) { res.send("all"); }
  • 导出的 get / post / put / delete 对应同名的 HTTP method。
  • export default 作为该路径的 all 中间件。
  • 其它具名导出 → 子路径 /<文件路径>/<方法名>(all)。
  • 文件/目录名中的 (xxx) 会转成 :xxx 路由参数。
  • 请求路径必须以 /api/ 开头(apiController 只匹配 /api 前缀)。
  • 处理函数签名 (req, res);服务端 getInitialData 与浏览器请求共用同一处理函数时,res 只能使用 json() / send()。

fetch

getInitialData 的 initFetch(以及同构代码里的 mizar/iso/fetch)行为:

  • 服务端:
    • http(s):// 绝对地址 → axios 直连(不带 cookie)。
    • /api/... 相对路径 → 在进程内 mock 请求(复用当前请求的 cookie/headers/url),走 src/server/apis。
    • 其它相对路径 → 直接抛错(避免静默返回 undefined)。
  • 客户端:axios;/api/... 走真实 HTTP。

IFetchConfig 继承 axios 配置,额外支持 showLoading?: boolean(配合全局 loading 组件)。


流式渲染(streaming)

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 mizar

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

CVE

Java4Shell (CVE-2026-114938): Easy to Crash, Hard to Exploit — Less Than 0.12% of JVMs Estimated at Risk of RCE

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Copy of Template Design OX Blog (3)
Research

Ruby2Shell: Ruby Memory Corruption Flaws Expose Applications to Remote Code Execution, But is it an Actual Risk?

Frame 2085668439 (1)
Group 1261154229