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

@zukhruf/sqlite-federation

Latest version: v0.8.266

Overview

Last scanned
30 Nov 2026
Published
30 Nov 2026
npm package Publisher: ezzabuzaid
2 Stars
0 Forks
310 Versions
48.8K Downloads
TypeScript Repo language

Scan summary

@zukhruf/sqlite-federation was last scanned on 30 Nov 2026 at version 0.8.266. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 310 versions; the latest 5 were published on 30 Nov 2026.
  • Findings: No rules fired in version 0.8.266.
  • Downloads: 48,779 downloads.

Versions

310 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.8.266 LATEST 30 Nov 2026 No rules fired
0.8.265 30 Nov 2026 No rules fired
0.8.264 30 Nov 2026 No rules fired
0.8.263 30 Nov 2026 Not shown
0.8.262 30 Nov 2026 Not shown

No rules fired in 0.8.266

Findings

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

README

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

@zukhruf/sqlite-federation

A host keeps its data in many SQLite databases, for example one database for each data source. A statement must read some of them together, for example to join messages with contacts. One SQLite connection can attach at most 10 databases, and the SQLite in Node cannot raise that limit. This package gives one read-only handle over a primary database and every additional database that the host can locate. The primary database stays open for the lifetime of the handle. Each statement attaches the additional databases it names and detaches them when it ends. This is also known as query federation: one query reads many separate databases.

The words in these documents have one meaning each. See the glossary in CONTEXT.md.

Use it

This project is an experiment. It uses only node:sqlite.

npm install @zukhruf/sqlite-federation

Read many databases with one handle

The host gives locate. A statement names each database as a schema.

import { mkdtempDisposable } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';

import { Federation } from '@zukhruf/sqlite-federation';
import { open } from '@zukhruf/sqlite-open';

await using scratch = await mkdtempDisposable(join(tmpdir(), 'federation-'));
const messagesPath = join(scratch.path, 'messages.sqlite');
const contactsPath = join(scratch.path, 'contacts.sqlite');
{
  using messages = open(messagesPath);
  messages.exec(`CREATE TABLE messages (handle TEXT, text TEXT);
    INSERT INTO messages VALUES ('+962790000000', 'See you at 6');`);
  using contacts = open(contactsPath);
  contacts.exec(`CREATE TABLE contacts (phone TEXT, name TEXT);
    INSERT INTO contacts VALUES ('+962790000000', 'Sara');`);
}
const paths = new Map([
  ['messages', messagesPath],
  ['contacts', contactsPath],
]);

using federation = new Federation({
  main: ':memory:',
  locate: (name) => paths.get(name),
});
console.log(federation.sql.all`
  SELECT c.name, m.text
  FROM messages.messages m JOIN contacts.contacts c ON c.phone = m.handle`);

Output:

[ [Object: null prototype] { name: 'Sara', text: 'See you at 6' } ]
  • sql has all and get of the SQLTagStore of node:sqlite. A value in ${} is a bound parameter.
  • main is a primary database path or { name } to find that path through locate. It is opened read-only for the lifetime of the handle. Use ':memory:' when there is no primary file. main does not count toward the attachment limit.
  • A statement names each additional database as a schema: messages.messages. Use unqualified names for the primary database and temporary views; qualify cross-database tables. There is no pre-attached search path for unqualified source tables.
  • locate(name) is required. It returns the path of a database, or undefined when the host has no database by that name. The constructor calls it once for a named main; each statement calls it for additional databases, so it reads them from their new paths after the host moves them.
  • Return undefined for a database that the host has not written yet. The handle cannot make a database, so an attach of a path with no file fails.
  • Additional databases are read-only. A statement that writes to one fails with attempt to write a readonly database. Connection-local temporary objects remain writable.
  • using closes the connection of the handle at the end of its scope.

Load temporary views and run SQL strings

exec(sql) executes connection-local setup SQL, including a file containing several CREATE TEMP VIEW statements. It uses SQLite's exec directly, without replaying the script. The databases a temporary view refers to are resolved when a query reads it.

query(sql) runs exactly one SQL statement and returns QueryResult: columns, including headings when there are no rows, and rows, whose values are indexed by column position. Duplicate column names therefore keep both values. Trailing comments and empty statements are allowed; a second statement, even malformed, fails before the first executes.

federation.exec(`
  CREATE TEMP VIEW conversations AS
  SELECT c.name, m.text
  FROM messages.messages m JOIN contacts.contacts c ON c.phone = m.handle;
`);
const result = federation.query('SELECT * FROM conversations');

function(name, options?, fn) registers a function of SQL on the connection of the handle. It is function of DatabaseSync in node:sqlite, with the same arguments, options and errors. Like a temporary view, the function is connection-local and stays until the handle closes. A statement or a temporary view can call it. When fn throws, the statement fails with that error, and the databases that the statement attached are detached. For example, a host stops a read of temporary views when the data they show expires:

federation.function('current', () => {
  if (expired()) throw new Error('The position expired. Read again.');
  return null;
});
federation.exec(`
  CREATE TEMP VIEW recent AS
  SELECT text FROM messages.messages WHERE current() IS NULL;
`);

Qualified tables and PRAGMAs discover additional databases through locate. Both PRAGMA contacts.table_info(contacts) and SELECT * FROM pragma_table_info('contacts', 'contacts') locate Contacts, including when the schema is a bound parameter in a tagged query. Quoted schema names such as "call-history" work too. Every attachment made for the statement is detached afterwards, including on failure; main and temporary views remain on the connection. The additional databases count toward the attachment limit.

The constructor accepts Node's timeout option for waiting on a writer's lock, in milliseconds. Without it, the handle waits 5000 ms, the busy timeout of @zukhruf/sqlite-open. It also accepts Node's readBigInts option. An INTEGER of SQLite holds 64 bits, and a number holds an integer exactly only up to 2^53, so a plain handle throws ERR_OUT_OF_RANGE for a larger one. With readBigInts: true, query and sql give each integer as a bigint. A host that reads databases it does not know, such as an agent's SQL over the imports of Context Compiler, sets it. Hosts that need crash recovery perform it before supplying the paths, including inside locate for a named primary or additional database; Federation opens those files read-only.

Read a primary database

Supply main: { name } to find the primary database through locate, or supply its path directly. Tables can be qualified with main, and unqualified schema queries and PRAGMAs describe that database. A named primary is opened as main, not attached under its name. Presets loaded with exec live on the same connection and can be joined with attached databases. Federation closes the connection on disposal.

import { Federation } from '@zukhruf/sqlite-federation';

using database = new Federation({
  main: { name: 'messages' },
  locate: (name) => paths.get(name),
  timeout: 30_000,
});
const result = database.query(
  'SELECT c.name, m.text FROM main.messages m JOIN contacts.contacts c ON c.phone = m.handle',
);

Each statement attaches what it names

  • SQLite fails with no such table: <name>.<table> for a qualified table or unknown database <name> for a PRAGMA when its database is not attached. The handle decodes the name, attaches that database and runs the statement again. It never parses the statement. ADR 0002 tells why.
  • When the statement ends, the handle detaches each database that it attached, also when the statement fails. An attach costs less than 1 ms. ADR 0001 tells why.
  • Between two statements, the handle holds no lock. A writer in another connection or process can commit.
  • One statement can attach at most 10 databases in addition to main. To read more, split the statement and join the rows in code. ADR 0003 tells why.

Errors

Error When
TooManyDatabasesError A statement names more databases than the limit. names has at least one name more than the limit. The message tells you to split the statement.
Unknown main database <name> The constructor cannot locate the named primary database.
no such table: <name>.<table> The error of SQLite, when locate returns undefined for the name, or when the database does not have the table.
UnavailableError The constructor cannot open the primary database: the file is missing, or the system denies access. path is the path. cause is the error of SQLite. It is the class of @zukhruf/sqlite-open. It is a MissingError when the file or a folder on its path is not there, and a DeniedError when the system denies access. The package exports both, and both are an UnavailableError.
unable to open database file The error of SQLite, when locate returns a path with no file for a database that a statement attaches.
attempt to write a readonly database The error of SQLite, when a statement writes.
The error of locate The constructor or statement fails with that error. The databases that the statement attached before are detached.
unknown database <name> The error of SQLite, when a PRAGMA names a database that locate cannot find. Quoting follows the statement or the table-valued PRAGMA argument.
Run one SQL statement at a time A raw query contains a second statement.

The same concepts in other systems

System What it does
SQLite swarmvtab A virtual table over one table in many databases. It opens each database on its own connection and closes the least recently used one. It is an extension that Node does not include.
Datasette --crossdb It attaches the first 10 databases and ignores the others.
q (harelba/q) It attaches databases up to the limit, and copies the tables of the others into a temporary database.
PostgreSQL postgres_fdw A foreign table reads a table of another server, and one query can join it with local tables.

API

// The read-only handle a statement runs on. It names each database as a schema.
type Query = Pick<SQLTagStore, 'all' | 'get'>; // of node:sqlite

type QueryResult = {
  readonly columns: readonly string[];
  readonly rows: readonly Readonly<Record<number, SQLOutputValue>>[];
};

// The path of the SQLite file a name stands for, or undefined when the host
// has no database by that name.
type Locate = (name: string) => string | undefined;

type FederationOptions = Pick<
  DatabaseSyncOptions,
  'timeout' | 'readBigInts'
> & {
  readonly main: string | { readonly name: string };
  readonly locate: Locate;
};

class Federation implements Disposable {
  constructor({ main, locate, ...options }: FederationOptions);
  readonly sql: Query;
  readonly function: DatabaseSync['function']; // of node:sqlite
  exec(sql: string): void;
  query(sql: string): QueryResult; // exactly one SQL statement
  [Symbol.dispose](): void; // closes the connection
}

class TooManyDatabasesError extends Error {
  readonly names: readonly string[];
  constructor(limit: number, names: readonly string[]);
}

// The classes of @zukhruf/sqlite-open, which the package exports.
class UnavailableError extends Error {
  readonly path: string;
  constructor(path: string, cause: unknown);
  static from(path: string, error: unknown): UnavailableError | undefined;
}
class MissingError extends UnavailableError {
  constructor(path: string, cause: unknown);
}
class DeniedError extends UnavailableError {
  constructor(path: string, cause: unknown);
}

Documentation

  • 0001 Each statement attaches what it names
  • 0002 The error of SQLite names the database
  • 0003 A statement over the limit fails
  • Code copied into this package

Development

This package is part of the zukhruf workspace. Run the commands from the workspace root.

npm install
npx nx run sqlite-federation:test        # builds, then runs the tests in src/
npx nx run sqlite-federation:typecheck   # formats, lints, then type checks
npx nx run sqlite-federation:build       # compiles src/ to dist/
src/
  index.ts                       the exports
  federation.ts                  Federation, FederationOptions, Query, QueryResult and Locate
  too-many-databases-error.ts    TooManyDatabasesError
  federation.test.ts             the tests, on real SQLite files

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 @zukhruf/sqlite-federation

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

PolinRider Returns
Research

PolinRider Returns: Hijacked npm Packages Use Ethereum Blockchain to Conceal Malware Infrastructure

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