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

@lark-apaas/express-datapaas

Latest version: v1.0.3-beta.0

Overview

Last scanned
26 Nov 2026
Published
26 Nov 2026
npm package Publisher: byted.lycoiref, bytedance-npm-team, duanlikang_byte, fengtianran_byted, xiaochuanzhang_byted
37 Versions
5.7K Downloads

Scan summary

@lark-apaas/express-datapaas was last scanned on 26 Nov 2026 at version 1.0.3-beta.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 37 versions; the latest 5 were published within 7 days (20–26 Nov 2026).
  • Findings: No rules fired in version 1.0.3-beta.0.
  • Downloads: 5,658 downloads.

Versions

37 versions published
Versions and the rules that fired in each
VersionPublishedStatus
1.0.3-beta.0 LATEST 26 Nov 2026 No rules fired
1.0.3-alpha.20261126072827 26 Nov 2026 No rules fired
1.0.3-alpha.20261121081954 21 Nov 2026 No rules fired
1.0.3-alpha.20261121033604 21 Nov 2026 Not shown
1.0.3-alpha.20261120130341 20 Nov 2026 Not shown

No rules fired in 1.0.3-beta.0

Findings

Findings for v1.0.3-beta.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 1.0.3-beta.0; other versions have their own rules, not their own score.

README

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

@lark-apaas/express-datapaas

基于 Drizzle ORM 封装的 PostgreSQL 数据库模块,为 Express 应用提供连接管理与 RLS(行级安全)支持。

功能特性

  • 基于 Drizzle ORM + postgres-js 的数据库连接管理
  • 自动在 pg session 层面注入用户上下文,无感支持 RLS
  • 简洁的函数式 API,createDatabase 返回可直接使用的 db 实例
  • Express 中间件形式的 RLS 上下文注入

安装

npm install @lark-apaas/express-datapaas
Peer Dependencies

需要同时安装以下依赖:

npm install drizzle-orm@0.44.6 express

注意: drizzle-orm 版本必须为 0.44.6,安装后会自动通过 postinstall 脚本打补丁以支持 RLS 功能。

快速开始

1. 创建数据库实例
import { createDatabase } from '@lark-apaas/express-datapaas';
import * as schema from './schema';

const { db, close } = createDatabase({
  connectionString: process.env.DATABASE_URL!,
  schema,
  logger: false,
  maxConnections: 7,
  idleTimeout: 20,
  connectionTimeout: 10,
  ssl: false,
});

// 应用退出时关闭连接
process.on('SIGTERM', async () => {
  await close();
});
2. 注册 RLS 中间件
import express from 'express';
import { createRlsMiddleware } from '@lark-apaas/express-datapaas';

const app = express();

// 在 userContext 中间件之后注册
app.use(createRlsMiddleware());

中间件会从 req.userContext 读取用户信息,自动为后续的数据库查询设置 RLS 上下文。

3. 使用数据库
import { db } from './database';
import { users } from './schema';

app.get('/api/users', async (req, res) => {
  // db 查询自动携带 RLS 上下文
  const result = await db.select().from(users);
  res.json(result);
});

API 参考

createDatabase(config)

创建数据库连接实例。

参数 CreateDatabaseConfig:

字段 类型 必填 默认值 说明
connectionString string 是 - PostgreSQL 连接串
schema object 否 - Drizzle schema 对象
logger boolean \| Logger 否 false 是否启用 SQL 日志
maxConnections number 否 7 最大连接数
idleTimeout number 否 20 空闲连接超时(秒)
connectionTimeout number 否 10 连接超时(秒)
ssl string \| boolean \| object 否 false SSL 配置,连接串含 sslmode=require 时自动启用

返回值 DatabaseInstance:

字段 类型 说明
db PostgresJsDatabase Drizzle 数据库实例,可直接用于查询
close () => Promise<void> 关闭数据库连接
createRlsMiddleware(options?)

创建 Express RLS 中间件。

参数 RlsMiddlewareOptions(可选):

字段 类型 说明
roleSchema string 角色 schema 标识。省略时自动使用 createDatabase 从连接串解析的值

UserContext 结构:

中间件从 req.userContext 读取以下字段:

interface UserContext {
  userId?: string;        // 用户 ID
  tenantId?: number;      // 租户 ID
  appId?: string;         // 应用 ID
  roles?: string[];       // 用户角色列表
  isSystemAccount: boolean; // 是否系统账号
  userType?: string;      // 用户类型
}

RLS 行为:

场景 设置的 PostgreSQL 角色
系统账号 (isSystemAccount: true) service_role_{schema}
已登录用户 (userId 存在) authenticated_{schema}
匿名用户 anon_{schema}

同时会设置 app.user_id、app.role_ids、app.user_type 等会话变量。

注意事项

  1. drizzle-orm 版本锁定:必须使用 drizzle-orm@0.44.6,该版本已通过 patch-package 打补丁以支持 RLS 上下文注入
  2. 应用层不要单独安装 drizzle-orm:如果需要 drizzle-orm 的类型导出,直接从 @lark-apaas/express-datapaas 导入(如 PostgresJsDatabase)
  3. 中间件顺序:createRlsMiddleware() 必须在设置 req.userContext 的中间件之后注册
  4. 连接关闭:应用退出时务必调用 close() 释放连接资源

License

MIT

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 @lark-apaas/express-datapaas

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

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Vulnerability Insights

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

Frame 2085668439 (1)
Group 1261154229