Oracle: opt-in thick mode for servers that require Native Network Encryption (NJS-533 / ORA-12660)

未关闭
#548 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@gabriell-prado 已经在做这个了。

开始于 2026年11月25日。

  • #549 来自 @gabriell-prado —— 未关闭

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
领域
backend, database

调研方向

Read the Oracle connector and startup flow to find where oracledb is imported and pools are created; the issue does not name those files. Check how CLI and environment options are defined, then follow the startup path to ensure thick mode initializes once before any pool. Done means the opt-in works with an optional client library directory, reports library load failures clearly, and leaves thin mode as the default; linked pull request #549 is already open.

由索引模型根据 Issue 内容生成。

描述

Problem

Oracle servers that require Native Network Encryption (NNE) and crypto-checksumming (SQLNET.ENCRYPTION_SERVER = REQUIRED / SQLNET.CRYPTO_CHECKSUM_SERVER = REQUIRED in the server's sqlnet.ora) cannot be used with DBHub. The Oracle connector always runs node-oracledb in thin mode, and thin mode does not implement NNE, so every query on the source fails:

NJS-533: Advanced Networking Option service negotiation failed. Native Network Encryption and DataIntegrity only supported in node-oracledb thick mode.
Cause: ORA-12660

NNE is a common way to encrypt Oracle traffic without TLS certificates or wallets. Other clients (SQLcl/JDBC, SQL*Plus, OCI-based tools) connect to the same server fine. Switching to TCPS (sslmode=require) needs a TLS listener and certificates on the server. Relaxing the server to REQUESTED would let unencrypted clients in. Both are DBA-side changes that are often not possible.

Environment

  • DBHub 2.1.0 (also reproduced on 1.6.1), node-oracledb 7.0.1, Node.js 22, Linux x86_64
  • Oracle Database 19c (19.23) Standard Edition 2, server requires AES256 encryption + SHA256 integrity
  • Source configured in TOML with type = "oracle", host, port, database (service name), sslmode = "disable"

Workaround

Install Oracle Instant Client and switch node-oracledb to thick mode before DBHub imports it, with a preload passed through NODE_OPTIONS="--require /path/to/oracle-thick.cjs":

// oracle-thick.cjs
const path = require("path");
try {
  const dbhubDir = path.join(process.env.HOME, ".local/lib/node_modules/@bytebase/dbhub");
  const oracledb = require(require.resolve("oracledb", { paths: [dbhubDir] }));
  oracledb.initOracleClient(); // Instant Client found via ldconfig / LD_LIBRARY_PATH
} catch (err) {
  process.stderr.write(`[oracle-thick] thick mode not enabled: ${err.message}\n`);
}

This works because oracledb has no exports map, so the CommonJS instance initialized by the preload is the same one DBHub's ESM import oracledb from "oracledb" gets. With it, queries succeed and v$session_connect_info shows the session using the AES256 encryption and SHA256 crypto-checksumming adapters. Read-only mode keeps working. It is fragile, though: it depends on the install path and on DBHub's module layout.

Proposal

Add an opt-in to run the Oracle connector in thick mode, e.g.:

  • a CLI flag / env var such as --oracle-thick / DBHUB_ORACLE_THICK=1, plus an optional --oracle-client-lib-dir / DBHUB_ORACLE_CLIENT_LIB_DIR passed as libDir;
  • when set, call oracledb.initOracleClient({ libDir }) once at startup, before any Oracle pool is created, and fail with a clear message if the Oracle Client libraries cannot be loaded (DPI-1047).

Since node-oracledb's mode is process-wide, a global setting seems a better fit than a per-source TOML option. I understand thin mode was chosen on purpose in #433 to keep the install free of native dependencies (npm, Docker image, MCPB bundle). This proposal keeps that: thin stays the default, and Instant Client is only loaded when someone explicitly opts in, so nothing changes for current users. Thick mode would also cover other server features that thin mode doesn't support, such as older server versions (#36).

Related: #36 (thin mode vs. older servers), #488 (wallet/mTLS in thin mode).

主要语言
TypeScript
星标
4k
派生
370
平均合并
6 小时 28 分钟
30 天内合并 PR
41

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bytebase/dbhub 的其他 Issue

查看 bytebase/dbhub 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。