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

chapaa

Latest version: v0.2.7

Overview

Last scanned
29 Nov 2026
Published
29 Nov 2026
npm package Publisher: tachimensa
0 Stars
0 Forks
8 Versions
TypeScript Repo language

Scan summary

chapaa was last scanned on 29 Nov 2026 at version 0.2.7. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 8 versions; the latest 5 were published within 2 days (28 and 29 Nov 2026).
  • Findings: No rules fired in version 0.2.7.

Versions

8 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.2.7 LATEST 29 Nov 2026 No rules fired
0.2.6 28 Nov 2026 No rules fired
0.2.5 28 Nov 2026 No rules fired
0.2.4 28 Nov 2026 Not shown
0.2.3 28 Nov 2026 Not shown

No rules fired in 0.2.7

Findings

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

README

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

chapaa

A local emulator for African mobile-money APIs. Point your existing M-Pesa (Daraja) code at localhost and get realistic callbacks and failures. No KYC, no sandbox credentials, no internet.

Website and live demo: https://godanaemiru.github.io/chapaa/: press a test phone number and see the exact callback chapaa sends.

Alpha. chapaa has not yet been checked against the real sandboxes. The Daraja response shapes follow the Daraja v3 docs (read through a third-party mirror); the MTN MoMo shapes are mostly from memory and unconfirmed. Treat a passing test against chapaa as "matches what we believe", and still test against the real sandbox before going live. See Contract tests for exactly what is verified, and issues and recorded fixtures are very welcome.

Supported: Daraja (STK Push, C2B, B2C, Transaction Status, Reversal, Account Balance) and MTN MoMo (Collections, Disbursements).

Checked against real client code: the Daraja flows run unmodified through the npm libraries mpesa-api, @kepas/daraja-js, daraja.js and daraja-sdk-ts (pointed at chapaa with a network redirect, since none of them has a base-URL option), including their callback parsers. That shows chapaa is compatible with what typical clients send and parse, not that it matches the real sandbox.

Run

npx chapaa           # http://localhost:8080

From a clone:

npm install
npm run dev

Inspector UI: http://localhost:8080/__chapaa/

Trigger failures

Pick the outcome with a magic phone number or the X-Chapaa-Scenario header (header wins).

Phone Scenario Behaviour
254700000001 user_cancelled callback ResultCode 1032
254700000002 insufficient_funds callback ResultCode 1
254700000003 timeout no callback; query returns 1037
254700000004 duplicate_callback success callback delivered twice
254700000005 delayed_callback success state now, callback after 90s
46733123451–55 same five, for MTN MoMo MoMo callbacks are POST (without payerMessage); a failure's reason is a string such as APPROVAL_REJECTED, NOT_ENOUGH_FUNDS or EXPIRED
254700000006 / 46733123456 early_callback the callback is delivered before the API call returns, to catch code that stores the transaction id only after the response
anything else success success callback after 2s

Configuration (env)

Variable Default
PORT 8080
CHAPAA_CALLBACK_DELAY_MS 2000 delay before the outcome is final
CHAPAA_DELAYED_CALLBACK_MS 90000 delay for delayed_callback
CHAPAA_DB unset SQLite file path; see Persistence
CHAPAA_REWRITE_LOCALHOST_TO unset e.g. host.docker.internal, so callbacks to localhost reach the host from inside Docker

GitHub Action

Run the emulator in CI next to your tests. It works on Linux, macOS and Windows runners.

steps:
  - uses: actions/checkout@v4
  - uses: godanaemiru/chapaa@v0.2.7
    id: chapaa
    with:
      callback-delay-ms: 200
      chaos-seed: 1
  - run: npm test
    env:
      DARAJA_BASE_URL: ${{ steps.chapaa.outputs.url }}   # also exported to every later step as CHAPAA_URL
  - if: failure()
    run: cat "${{ steps.chapaa.outputs.log-file }}"
  • Your app and tests reach it at http://127.0.0.1:8080 (change with port). Callback URLs pointing at localhost work as they are, because everything runs on the same machine.
  • Call POST $CHAPAA_URL/__chapaa/reset between test files so they start clean, and PUT $CHAPAA_URL/__chapaa/chaos to turn faults on for one test.
  • Inputs mirror the environment variables below: port, db, callback-delay-ms, delayed-callback-ms, rewrite-localhost-to, chaos-http-error-rate, chaos-outcome-failure-rate, chaos-latency-ms, chaos-callback-jitter-ms, chaos-seed, retry-max-attempts, retry-base-delay-ms, retry-factor, plus node-version (default 22), wait-timeout (default 30 s) and package.
  • package: local (the default) builds the chapaa source that ships with the action, which takes about 20 s. Once chapaa is published to npm, package: chapaa@x.y.z skips the build.
  • The step fails, with the emulator log printed, if the port is already taken or the server doesn't come up in time.
  • The emulator keeps running until the job ends; it isn't stopped by a post step.

Persistence

By default all state is in memory and lost on exit. Set CHAPAA_DB=./chapaa.db to keep it in a SQLite file: transactions with their callback history, C2B URL registrations and MoMo API users survive restarts.

docker run -p 8080:8080 -v chapaa-data:/data -e CHAPAA_DB=/data/chapaa.db chapaa
  • In Git Bash on Windows, prefix the docker run command with MSYS_NO_PATHCONV=1, or Git Bash rewrites /data/chapaa.db into a Windows path.
  • Needs Node.js 22.13 or newer (it uses the built-in node:sqlite, which prints an experimental warning). Without CHAPAA_DB it still runs on Node 20.
  • Changes are written about every 200 ms and again on shutdown, so a hard kill can lose the last fraction of a second.
  • Transactions still pending at shutdown come back as timed out (Daraja query ResultCode 1037, MoMo FAILED/EXPIRED), since their timers are gone. Callbacks that were scheduled but not yet sent, such as a 90 s delayed_callback, are dropped.
  • POST /__chapaa/reset clears the stored transactions too. Registrations and API users are kept.
  • The schema is versioned: an older chapaa refuses to open a database written by a newer one.

Chaos mode

Off by default. Faults apply to provider routes only, never to /__chapaa/*.

Variable Effect
CHAPAA_CHAOS_HTTP_ERROR_RATE fraction (0–1) of API requests answered 503 before processing
CHAPAA_CHAOS_OUTCOME_FAILURE_RATE fraction of transactions with no magic phone or header that get a random non-success scenario
CHAPAA_CHAOS_CALLBACK_JITTER_MS each callback is delayed by a random 0–N ms extra, so callbacks for transactions started close together arrive in a different order than they were created
CHAPAA_CHAOS_LATENCY_MS min-max (or a single value) added to every API request
CHAPAA_CHAOS_SEED makes the random choices reproducible, for CI

Change it while running, e.g. per test: PUT /__chapaa/chaos with {"httpErrorRate": 0.2, "latencyMs": {"min": 100, "max": 800}}; GET shows the current values. Explicit scenarios (magic phone, header) are never overridden by chaos.

Callback retries

By default each callback is sent once. Set CHAPAA_RETRY_MAX_ATTEMPTS above 1 to retry on connection errors and non-2xx responses, waiting CHAPAA_RETRY_BASE_DELAY_MS (default 1000) × CHAPAA_RETRY_FACTOR (default 2) to the power of the attempt. Each attempt is listed in the inspector. Whether and how the real providers retry is unverified, so match it to your own provider's docs. Validation calls and manual resends are never retried.

Implemented

  • Daraja: GET /oauth/v1/generate, POST /mpesa/stkpush/v1/processrequest, POST /mpesa/stkpushquery/v1/query
  • Daraja C2B: POST /mpesa/c2b/{v1,v2}/registerurl, POST /mpesa/c2b/v1/simulate. Simulate calls your ValidationURL first (reply {"ResultCode":"0"} to accept), then your ConfirmationURL. If validation is unreachable, ResponseType decides (Completed accepts, Cancelled rejects).
  • Daraja B2C: POST /mpesa/b2c/{v1,v3}/paymentrequest with an async result to ResultURL. user_cancelled maps to ResultCode 2001, insufficient_funds to 1.
  • Daraja Transaction Status POST /mpesa/transactionstatus/v1/query and Reversal POST /mpesa/reversal/v1/request: look up the original by receipt number (from an STK callback, C2B TransID or B2C result). An unknown id returns 400. A second reversal returns result code 11.
  • MTN MoMo: POST /v1_0/apiuser, POST /v1_0/apiuser/:id/apikey, GET /v1_0/apiuser/:id, POST /{collection,disbursement}/token, POST /collection/v1_0/requesttopay + GET …/:ref, POST /disbursement/v1_0/transfer + GET …/:ref, GET /{collection,disbursement}/v1_0/account/balance (static 1000 EUR for now). Duplicate X-Reference-Id returns 409. Credentials and subscription keys are accepted without checking.
  • Inspector: GET /__chapaa/transactions, GET/PUT /__chapaa/chaos, POST /__chapaa/reset, POST /__chapaa/transactions/:id/resend

Roadmap

See the MVP scope: Daraja C2B/B2C/Reversal/Transaction Status, MTN MoMo collections and disbursements, contract tests against real sandboxes.

Contract tests

npm test includes a contract suite (test/contract.test.ts) that drives chapaa and compares every response and callback with a fixture in contracts/: same keys, same JSON types, and a few exact values such as ResponseCode: "0". It catches emulator drift, for example a missing ResultParameter or a number where the real API sends a string.

Each fixture says where it came from:

source Meaning Count
sandbox observed on the real Daraja and MTN MoMo sandboxes (2026-11-28 and 2026-11-29) 21
docs-mirror written from the Daraja v3 docs, read through a third-party GitHub mirror of the Safaricom pages, not the official portal 8
unverified written from memory; the suite only pins current behaviour 6

Seven of the 21 sandbox fixtures are MoMo: the API user, API key and token calls, the request to pay (HTTP 202), the duplicate-reference error (HTTP 409), the status of a failed payment, and its callback. The other fourteen are Daraja: the OAuth token, the STK Push response, the STK query both while pending (HTTP 200 with result code 4999) and once settled, a real STK callback (a cancelled payment, code 1032), the C2B simulate response, the B2C, Account Balance and Reversal responses, three error bodies (missing Authorization header on STK Push and on OAuth, and a bad request), and two failure results: B2C with 2001 ("The initiator information is invalid.") and a reversal of an unknown transaction with R000002. The B2C failure and the reversal failure match what the docs mirror showed. Successful B2C, Transaction Status and Reversal results, and the Account Balance result, are not recorded: the sandbox rejected our initiator security credential in two runs (2001), and the balance result's ErrorMsg says why: "The current security credential of the user has expired." Recording them needs a sandbox initiator whose credential is still valid. The five unverified MoMo fixtures are the successful payment and its callback, Disbursements and the balance. Treat a green run as "matches what we believe", not "matches the provider", until a full recording has been made.

Real recordings have corrected chapaa twice so far. A pending STK query was emulated as an HTTP 500 error, and the sandbox usually returns a normal 200 with result code 4999 ("The transaction is still under processing"). A cancelled payment's description was "Request cancelled by user", and the sandbox sends "Request Cancelled by user." with a capital C and a full stop.

Behaviour that chapaa does not reproduce yet:

  • The sandbox answered a pending STK query once with HTTP 500, errorCode 500.001.1001 and an empty errorMessage, instead of the usual 200 with 4999. It is not deterministic, and chapaa always returns the 200 form.
  • A failed Account Balance request returns result code 2001 with parameters ActionType, ErrorMsg and BOCompletedTime. chapaa has no failing balance scenario.
  • The C2B URL registration call returned HTTP 500 (500.003.1001, "Service is currently unreachable") in every recording run, so it isn't recorded, and neither is the C2B confirmation callback that depends on it.
  • The sandbox resolved every test payment as cancelled, so a successful-payment callback isn't recorded either.
Recording real fixtures

Needs sandbox credentials (not included). The recorder writes contracts/recorded/<id>.json, which overrides the matching fixture on the next test run, and prints which fixtures it could not record. Its request flow was exercised only against chapaa itself (as a stand-in server), never against the live sandboxes, so expect to adjust it on the first real run.

# Daraja
DARAJA_CONSUMER_KEY=... DARAJA_CONSUMER_SECRET=... DARAJA_PASSKEY=... DARAJA_PHONE=2547... \
  npm run contract:record -- daraja

# MTN MoMo (the callback host must be a hostname, not an IP)
MOMO_COLLECTION_KEY=... MOMO_CALLBACK_HOST=example.com npm run contract:record -- momo

What each extra variable unlocks:

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 chapaa

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

Vulnerability Insights

Compromised Claude Code extensions (versions 2.1.312 & 2.1.313) in Cursor try to install a backdoor

Copy of Template Design OX Blog (2)
Research

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

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Frame 2085668439 (1)
Group 1261154229