Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions audit/sec_review_2026-10-29T06-03-39Z_fb9f3ca.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Security Review Report

- **Reviewing agent / model:** Claude Opus 5.5, model ID `claude-opus-5-5`, running in Claude Code
- **Reasoning effort / tier:** not disclosed by the runtime
- **Review date and time:** 2026-10-29T06:03:39Z (UTC, from system clock)

## Scope

Full repository review of ThruBox Client (`@aossie-org/thrubox-client`
1.1.0) at commit `fb9f3ca4a08878729fe8b920ecb637fcac16e185`, the head of
upstream `AOSSIE-Org/ThruBox-Client` `main` ("Merge pull request #66"),
reviewed in a clean detached worktree with no local changes. This commit
includes the mailbox cursor work (#63) and the removal of
`RelayClient.delete()` (#65).

Detected project type: none of the skill's specific signals match (this is a
zero-dependency TypeScript HTTP client library, not a Next.js/Svelte app), so
the general checklist was applied, using the relevant parts of the frontend
checklist (secrets, request handling, open redirect, prototype pollution) as
a guide for client-side HTTP code. Files reviewed in full: `src/client.ts`,
`src/errors.ts`, `src/index.ts`, `src/types.ts`, `package.json`,
`tsup.config.ts`, `.gitignore`, and the security-relevant parts of
`README.md`. The `pull_request_target` workflows (`danger.yml`,
`sync-pr-labels.yml`, `label-merge-conflicts.yml`) and `cache-reaper.yml`
were spot-checked for untrusted-code checkout and expression injection.

Trust boundary: the network between the SDK and the relay. Everything the
relay returns (status codes, headers, bodies, message fields including `seq`
and `from`) is untrusted input to the SDK. Per the ThruBox Server README and
its own security review, the relay is a "dumb encrypted mailbox": payload
confidentiality is the application's job (client-side encryption), and the
optional `X-API-Key` is one secret shared by every client of a relay.

## Findings

No findings met the confidence threshold (0.7) for this review.

What was checked and why each item was not reported:

- **Injection / path manipulation in URLs.** `receive()` puts `address` in
the path with `encodeURIComponent` (`src/client.ts:115`), so `/`, `?` and
`#` are escaped and a caller cannot reach another endpoint or inject query
parameters. The only residual case is an address of exactly `.` or `..`,
which URL normalisation resolves to `/api/messages/` or `/api/`; that hits
no other handler and only affects the caller's own request. `after` and
`limit` go through `URLSearchParams` (`src/client.ts:109-112`).
- **Base URL handling.** The constructor rejects any scheme other than
`http:`/`https:` (`src/client.ts:52-61`), so `file:`, `data:` and similar
are refused.
- **API key handling.** The key is held in a private field, sent only as the
`X-API-Key` header (`src/client.ts:246-248`), and never logged or placed in
error messages. It is sent over `http:` if the integrator chooses an `http:`
base URL. That is a configuration choice with no SDK-side exploit path,
and the README examples use `https:`. Not reported.
- **API key on redirects.** `fetch` follows redirects by default, and the
Fetch spec (and Node's undici) strip only `Authorization`, `Cookie` and
`Proxy-Authorization` on a cross-origin redirect, so `X-API-Key` would be
forwarded to a redirect target. The only parties able to issue that
redirect are the relay operator (who already holds the shared key) or
whoever terminates TLS for the relay (who also already sees it), so no
attacker gains anything they did not already have. Below threshold.
- **Response handling.** Responses are parsed with `response.json()`; plain
`JSON.parse` semantics do not pollute prototypes, and the SDK never merges
server objects into its own state. Server error text is put into
`RelayError.message` as data, not executed or rendered. `Retry-After`
parsing (`src/client.ts:289-302`) only produces a number.
- **Cursor logic (#63).** `poll()` advances the cursor only to the highest
numeric `seq` returned, and only after the callback succeeds
(`src/client.ts:197-213`). A malicious relay could return a huge `seq` and
make the client skip later messages, but the relay already controls what
it delivers, so this grants it nothing new.
- **Retries and idempotency.** `POST` is never retried (`src/client.ts:250`),
so a timed-out send cannot be duplicated by the SDK; GET retries are
bounded by the validated `retries` option with exponential backoff.
- **`delete()` removal (#65).** No deletion code path remains in `src/`, so
the server-side "anyone can delete any message" issue is no longer
reachable through this SDK.
- **Randomness.** `Math.random()` is used only for backoff jitter
(`src/client.ts:340`), not for any security value.
- **Secrets in the repo.** No hardcoded keys or tokens in source.
- **CI workflows (spot check).** `danger.yml` runs on `pull_request_target`
but checks out the base branch only and runs a pinned `danger@13.0.7`
against the base `dangerfile.js`; `cache-reaper.yml` interpolates
`workflow_dispatch` inputs, which only users with write access can supply.

## Notes

No notes for this review.

## Limitations

**Standing limitations**

- This review does not replace a full manual audit or a penetration test.
- This is static analysis of source text. Nothing was executed, fuzzed, or
traced at runtime, so timing-dependent, load-dependent, or
infrastructure-dependent issues cannot be confirmed here.
- Confidence scores are the reviewing model's own self-assessment, not a
calibrated statistical probability.
- Absence of a reported finding does not mean the code is secure. Safety
guardrails built into some models can cause a real vulnerability to be
softened, generalized, or left out rather than reported in exploit-level
detail, and training-data bias can make some vulnerability classes easier
for a model to recognize than others. Treat this report as a floor on what a
full audit would find, not a ceiling.
- Findings reflect the reviewing model's training data cutoff. A vulnerability
tied to a very recently disclosed CVE or library advisory may not be
recognized as such.

**Review-specific limitations**

- Applications built on this SDK were not in scope. `Message.from`
(`src/types.ts:21-22`) is documented only as "Sender wallet address", but
the relay stores whatever the sender claims and does not authenticate it
(see the ThruBox Server review's limitations). The SDK itself makes no
trust decision on `from`, so this is not an SDK vulnerability, but any
consumer that treats `from` as proof of sender identity without verifying
a signature inside the encrypted payload would be spoofable. That could
not be checked here. Saying so in the `from` doc comment and the README
would help integrators.
- The `.github/workflows/` files were only spot-checked for
`pull_request_target` checkout of untrusted code and expression injection.
The release and publish pipeline (`version-release.yml`, npm provenance
publishing) and third-party action pinning were not reviewed in depth.
- `tests/client.test.ts`, `dangerfile.js` logic beyond its trigger, and the
`skills/` folder were not reviewed for vulnerabilities. Dev dependencies in
`package-lock.json` were not checked against advisories; the published
package has no runtime dependencies.
11 changes: 11 additions & 0 deletions audit/sec_review_2026-10-29T06-03-39Z_fb9f3ca_remediations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Remediations of Security Review Findings

Review date and time: 2026-10-29T06:03:39Z (UTC, from system clock)

## Remediations

None needed. The review reported no findings at or above its 0.7 confidence threshold.

## Non-remediated findings

None.
Loading