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

@kozou/api

Latest version: v1.21.2

Overview

Last scanned
15 Nov 2026
Published
15 Nov 2026
npm package Publisher: takashi-matsuyama
2 Stars
0 Forks
7 Versions
769 Downloads
TypeScript Repo language

Scan summary

@kozou/api was last scanned on 15 Nov 2026 at version 1.21.2. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 7 versions; the latest was published on 15 Nov 2026.
  • Findings: No rules fired in version 1.21.2.
  • Downloads: 769 downloads.

Versions

7 versions published
Versions and the rules that fired in each
VersionPublishedStatus
1.21.2 LATEST 15 Nov 2026 No rules fired
1.21.1 6 Nov 2026 No rules fired
1.21.0 19 Oct 2026 No rules fired
1.20.1 19 Oct 2026 Not shown
1.20.0 18 Oct 2026 Not shown

No rules fired in 1.21.2

Findings

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

Known vulnerabilities

1 CVE · last 19 Jun 2026

0 CRITICAL 1 HIGH 0 MEDIUM 0 LOW

Versions

  • ≥ 1.8.1
  • < 1.8.1 1 HIGH

Vulnerabilities

  • GHSA-V52W-28XH-V562 High 19 Jun 2026 Kozou: Unauthenticated MCP HTTP server and bundled dev-stack hardening (DNS-rebinding, request-body limits, read-only reads, default network exposure) Fixed in 1.8.1

README

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

@kozou/api

Stable (Kozou v1.0; composite foreign keys as of v1.1; RPC actions as of v1.6). The REST wire format, query grammar, and OpenAPI extensions documented below are a stable contract: they will not change incompatibly without a major release — see Stability.

Kozou's own REST layer. Given a SchemaContext (from @kozou/introspect

  • @kozou/core) and a PostgreSQL connection, it serves the tables and views of your database as a REST API, driven entirely by your DDL and COMMENT metadata — no hand-written route code.

This is the in-house data layer that Kozou v1.0 makes the default backend. The Admin UI talks to it through the same DataAdapter seam (@kozou/core) it already uses, so swapping the data layer is not a breaking change for UI code.

API

Service
  • GET / — service info (name, version) and the list of available resources.
  • GET /openapi.json — an OpenAPI 3.1 document for the whole API (see OpenAPI).
Reading
  • GET /<resource> — list rows of a table or view. Returns { rows, total, page, pageSize }. Supports:
    • pagination — page (1-based) and pageSize (LIMIT / OFFSET, capped);
    • sort — sort=field.asc,other.desc;
    • filter — <column>=<op>.<value> (see Filtering);
    • free-text search — search=<text> (ILIKE across text columns);
    • embedding — embed=<relation-chain> (see Embedding).
  • GET /<resource>/<id> — fetch a single table row by primary key. For a composite primary key, <id> is the key columns in declaration order, comma-joined in one path segment (/order_lines/42,3); embed is supported here too. Returns the row, or 404.
  • GET /<resource>?as=options&label=<col>&fields=<a,b>&q=<text>&limit=<n> — lightweight relation-select lookup. Returns { options: [{ id, label }] }. For a composite-key resource each id is a JSON array of key components in primary-key declaration order. To address that row's item route, build the {id} path segment from the components: percent-encode each component and join them with an unescaped comma. A component value that itself contains a comma cannot be represented in the item route (a documented limitation of the comma-joined segment).
Writing
  • POST /<resource> — create a row from a JSON body; returns 201 + the created row. An empty body inserts a row of column defaults.
  • PATCH /<resource>/<id> — update the supplied columns; returns the row, or 404.
  • DELETE /<resource>/<id> — delete by primary key; returns the deleted row, or 404.

Writes are rejected on views (405) and on unknown columns (400).

Filtering

List filters use a <column>=<op>.<value> grammar:

operator meaning
eq / neq equal / not equal
gt / gte / lt / lte range comparisons
like / ilike pattern match (* is the wildcard)
in membership — in.(a,b,c)
is is.null / is.notnull / is.true / is.false

A bare value (status=paid) is shorthand for eq and stays backward compatible. Repeating a column ANDs its filters (e.g. a gte + lt range). A value that itself looks like an operator can be forced to equality with an explicit eq. prefix (name=eq.gt.5). Operators are a fixed allowlist, the column is checked against the schema, and every value is passed as a bound parameter — nothing is interpolated into SQL text. Values for the common scalar families (integer, numeric / float, boolean) are validated up front and rejected with a 400; values for other types are enforced by PostgreSQL.

Embedding

embed=<relation-chain> inlines related rows as nested JSON, on both list and item reads:

  • forward (to-one) and reverse (to-many) relations, mixed in one request — including composite (multi-column) foreign keys, which join on every column pair; a forward composite relation is selected by its referenced table name, a reverse one by the child table name, and x-kozou-embeds advertises only relations whose selector is unambiguous;
  • dot-separated chains up to 5 deep (embed=order.customer.region);
  • comma-separated for several relations (embed=customer,lines);
  • up to 25 distinct relations per request, and up to 100 child rows inlined per parent for a to-many relation.

To-many embeds are rendered as a JSON array ordered by the child's primary key. Many-to-many is expressed by naming the junction explicitly (embed=link.far); there is no automatic flattening of junction tables.

OpenAPI

GET /openapi.json returns an OpenAPI 3.1 document generated from the schema. Database COMMENTs drive it: table / view / column descriptions become schema descriptions, CHECK / ENUM members become enum, and Kozou's @-annotations become vendor extensions:

  • @ai: notes → x-kozou-ai
  • the resolved widget → x-kozou-widget
  • @policy: advisories → x-kozou-policy
  • embeddable relations → x-kozou-embeds (with cardinality)

The document models the schema, the x-kozou-* metadata, and the list / item / CRUD surface faithfully: create and update carry their own request schemas (<resource>.CreateInput requires only NOT NULL columns without a default; <resource>.UpdateInput is a partial subset), the as=options relation-select mode is documented on the collection path with its alternate response shape, and the advertised embed hints match what the server resolves at request time.

RPC actions

Beyond the table/view CRUD surface, @kozou/api can compile opt-in Postgres functions into callable actions — POST /rpc/<schema>.<fn> with a JSON body of named arguments. This is how the security model Kozou recommends (JWT → SET LOCAL ROLE → RLS + column GRANTs, with state changes funnelled through functions) stays reachable: the verb is exposed, the database still enforces who may run it.

Nothing is exposed by default. A function is compiled only when its COMMENT carries the @expose: rpc tag:

COMMENT ON FUNCTION approve_order(order_id uuid) IS
  'Approve an order and reserve stock.
   @ai: not idempotent — check status before re-calling.
   @expose: rpc';

Exposure ≠ permission. Whether a caller may actually run it is enforced by the PostgreSQL EXECUTE privilege under the request's role; a denial is 42501 → 403. Guardrails (loud build issues when a tagged function is skipped, never a silent gap):

  • PUBLIC EXECUTE is a hard skip. CREATE FUNCTION grants EXECUTE to PUBLIC by default, which would let anyone (incl. an anon role) call the endpoint. Such a function is not exposed unless intentionally opened — REVOKE EXECUTE … FROM PUBLIC and GRANT to the intended role, or declare it public with @expose: rpc public / api.rpc.allowPublicExecute.
  • SECURITY DEFINER needs a double opt-in. It runs as its owner and can bypass RLS, so it is exposed only when listed in api.rpc.allowDefiner and it declares an owner-safe SET search_path (owner-only schemas plus a trailing pg_temp).
  • Overloads / unsupported shapes (VARIADIC / polymorphic / unnamed args, unmappable returns, an overloaded schema.name) are loudly skipped.

Arguments are named (scalar / enum / FK-typed); a DEFAULT argument may be omitted. The return maps to the wire as: scalar → the value, single composite → an object, SETOF / RETURNS TABLE → an array, void → 204. Values are always bound parameters; argument names are validated against the function's signature.

The same exposed set is compiled to every surface: the OpenAPI document gains a POST /rpc/<schema>.<fn> operation (operationId: rpc.<schema>.<fn>, with the @ai / @policy advisory as x-kozou-*), the MCP server gains a describe_functions tool, and the Admin UI gains an "Actions" page. See the kozou package config for api.rpc.allowDefiner / allowPublicExecute.

Errors

Every non-2xx response carries the same envelope:

{ "error": { "code": "machine-readable", "message": "human-readable" } }

Database outcomes map to stable statuses. The raw database message is written to the server log, never into the response body (it can carry internal schema detail):

Database condition (SQLSTATE) HTTP code
insufficient privilege / row-level security (42501) 403 forbidden
unique violation (23505) 409 conflict
foreign-key violation (23503) 409 conflict
not-null violation (23502) 400 constraint_violation
check violation (23514) 400 constraint_violation
anything else 500 internal (generic message; detail in the server log)

Mapped messages are fully generic: the violated constraint or column name appears only in the server log, never in the response (an error can name objects outside the exposed surface — for instance a foreign key from a table that is not exposed — so identifiers are withheld across the board). Data exceptions (SQLSTATE class 22) are deliberately not mapped: mapping the whole class would relabel genuine kozou bugs as client errors. Instead, the client inputs that would otherwise raise one are validated before they reach the database — list filter and search values, item id segments, and write-body values all return a 400 up front when malformed. Pre-flight covers the scalar families with a reliable lexical form (the integer widths, the decimal/float family — including NaN, and ±Infinity for the float types — boolean, and uuid); a malformed value of another type — for example a bad date — still falls through to a 500, by design. Two further notes: in a write body only string-valued fields are pre-flighted (a non-string JSON value is left to PostgreSQL — a JSON number is already a valid numeric, an object targets a json column), and the check requires the canonical lexical form, so it will reject some redundant spellings PostgreSQL also accepts (a hex/underscored integer literal, an abbreviated boolean prefix) — send the plain decimal / true/false form.

With auth enabled, the auth layer adds its own statuses: missing token → 401 (or the configured anonRole takes over), invalid token → 401, disallowed role → 403.

Stability

Stable as of Kozou v1.0 (covered by semantic versioning — no incompatible change without a major release):

  • the REST envelopes — the list { rows, total, page, pageSize }, the item shape, and the create / update / delete return shapes;
  • the query grammar — pagination, sort, the <column>=<op>.<value> filter grammar, as=options, and embed;
  • the GET /openapi.json document — OpenAPI 3.1 plus the x-kozou-ai / x-kozou-widget / x-kozou-policy / x-kozou-embeds extensions;
  • the composite-foreign-key relation shape (as of Kozou v1.1) — a multi-column foreign key is a first-class relation. Where advertised in x-kozou-embeds it embeds, with the server joining on every column pair. A forward composite relation is selected by its referenced table name (advertised only when no other foreign key shares that target table); a reverse one is selected by the child table name (advertised only when the child has exactly one foreign key back and no forward relation shadows that name). The hint carries fields (the local foreign-key columns, in declaration order; the hint is an embed selector, not a join recipe), and as=options on a composite-key target returns array option ids whose components follow primary-key declaration order;
  • the auth boundary — JWT claims mapped to SET LOCAL ROLE (see below);
  • the error envelope { error: { code, message } } and the database-mapped status table (as of Kozou v1.1.1 — see Errors above);
  • the RPC actions wire (as of Kozou v1.6) — the REST POST /rpc/<schema>.<fn> endpoint (a named-arguments JSON body; the return-shape mapping scalar → the value, single composite → an object, a set (SETOF / RETURNS TABLE) → an array (objects for a row set, bare values for a scalar set), void → 204), the function metadata in the OpenAPI document (x-kozou-volatility / x-kozou-security, the @ai / @policy advisory as x-kozou-ai / x-kozou-policy, and per-argument x-kozou-widget / x-kozou-type / x-kozou-relation), and the MCP call execution tool, which shares the same argument and return-value shaping (representing a void return as an explicit "executed, no value" object instead of 204). The exposure rules (@expose: rpc, the PUBLIC-EXECUTE hard skip, the SECURITY DEFINER double opt-in) were already settled; this adds the wire to the guarantee.

Scalar leaf values are serialized by the PostgreSQL driver's default JSON output — notably numeric and bigint are rendered as JSON strings (to preserve precision). This applies to both the table/view and RPC surfaces.

Still evolving (not yet covered by the stability guarantee):

  • the @kozou/codegen output (a separate package, still experimental).

Scope: default coverage vs PostgREST opt-out

@kozou/api covers the relational REST surface most schemas need; Kozou v1.0 makes it the default backend. Deployments that need a feature in the "opt-out" column can stay on (or switch back to) the PostgREST adapter (adapter: postgrest) — see the migration notes in the kozou package. The intent is no silent gap: the in-house backend by default, PostgREST as a deliberate opt-out.

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 @kozou/api

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

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 (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

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?

Frame 2085668439 (1)
Group 1261154229