mushi-mushi 0.6.3 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CONTRIBUTING.md CHANGED
@@ -91,6 +91,33 @@ pnpm changeset
91
91
 
92
92
  Select the affected packages, the semver bump type, and write a summary. The changeset file gets committed with your PR.
93
93
 
94
+ ## Release flow
95
+
96
+ Releases are fully automated. Maintainers don't run `npm publish` by hand.
97
+
98
+ 1. PRs land on `master` with one or more changeset files in `.changeset/`.
99
+ 2. `release.yml` runs on every push to `master`. It opens (or updates) a `chore: version packages` PR that bumps every affected `package.json`, rolls up the changelogs, and deletes the consumed changesets.
100
+ 3. Merging that "Version Packages" PR re-fires `release.yml`. The publish step authenticates to npm via **OpenID Connect (OIDC) Trusted Publishers** — no long-lived `NPM_TOKEN` is exchanged — and every tarball ships with a **Sigstore provenance attestation** uploaded to the public transparency log.
101
+
102
+ If GitHub's anti-loop protection suppresses the auto re-fire (the squash merge can be attributed to `github-actions[bot]`), trigger the workflow manually: **Actions → release → Run workflow → master**.
103
+
104
+ ### Adding a brand-new publishable package
105
+
106
+ Trusted Publisher bindings are configured **per package** on `npmjs.com` and require the package to already exist on the registry. New packages therefore need a one-time bootstrap before OIDC can take over.
107
+
108
+ 1. Add the package under `packages/<name>/` with a real `version`, `files`, `publishConfig.access: "public"`, `LICENSE`, and the standard fields enforced by `pnpm check:publish-readiness`.
109
+ 2. Build it locally: `pnpm install && pnpm -r build`.
110
+ 3. Mint a short-lived granular access token at `https://www.npmjs.com/settings/<your-user>/tokens/granular-access-tokens/new` — **Bypass 2FA: ON**, **Read and write: All packages**, **Expiration: 7 days**.
111
+ 4. Bootstrap-publish:
112
+ ```bash
113
+ NPM_TOKEN=npm_xxx pnpm bootstrap:new-package
114
+ ```
115
+ The script auto-detects which workspace packages are missing on npm and publishes them via `pnpm publish --no-provenance` (so `workspace:^` specifiers get rewritten to real semver in the tarball).
116
+ 5. The script prints one URL per freshly-published package. Open each, click **GitHub Actions** under "Trusted Publisher", confirm the auto-filled fields (`<owner>` / `<repo>` / `release.yml`), and tap your security key.
117
+ 6. Revoke the bootstrap token at `https://www.npmjs.com/settings/<your-user>/tokens`.
118
+
119
+ From the next changeset bump onward, that package publishes through the normal `release.yml` flow with full OIDC provenance — same as the rest.
120
+
94
121
  ## Code Style
95
122
 
96
123
  - **TypeScript strict mode** — no `any` unless absolutely necessary
package/README.md CHANGED
@@ -23,6 +23,16 @@ One `npx` command. Works with React, Next.js, Vue, Nuxt, Svelte, SvelteKit, Angu
23
23
 
24
24
  ---
25
25
 
26
+ ## What does it actually do? (60 seconds, no jargon)
27
+
28
+ Your users open your app, something feels broken — a button that doesn't react, a page that takes forever, a layout that folds in half on their phone — and they leave. Your error tracker stays silent because nothing technically _crashed_.
29
+
30
+ Mushi adds a small **"shake your phone (or click the bug)"** button. The user taps it, scribbles a note, and Mushi captures everything around the moment: a screenshot, the page they were on, what they were trying to do, and the last few seconds of network and console activity. An AI then reads that report, tags it with severity and category in plain English, groups it with similar reports so you see one row per actual bug, and (optionally) hands it off to another AI that opens a draft pull request with a proposed fix. **A human always reviews and merges** — the loop never bypasses you.
31
+
32
+ Founders, PMs, designers: see the [60-second tour in the GitHub README](https://github.com/kensaurus/mushi-mushi#read-this-first-if-youre-not-a-developer).
33
+
34
+ ---
35
+
26
36
  ## Install in one line
27
37
 
28
38
  ```bash
@@ -33,14 +43,14 @@ The wizard detects your framework, installs the right SDK, writes env vars to `.
33
43
 
34
44
  ```tsx
35
45
  // After the wizard runs (React example):
36
- import { MushiProvider } from '@mushi-mushi/react'
46
+ import { MushiProvider } from '@mushi-mushi/react';
37
47
 
38
48
  export function App({ children }) {
39
49
  return (
40
50
  <MushiProvider config={{ projectId: 'proj_xxx', apiKey: 'mushi_xxx' }}>
41
51
  {children}
42
52
  </MushiProvider>
43
- )
53
+ );
44
54
  }
45
55
  ```
46
56
 
@@ -50,23 +60,26 @@ That's it. Your users now have a shake-to-report button (or a floating widget).
50
60
 
51
61
  ## What you get
52
62
 
53
- - **🐛 Shake-to-report widget** — Shadow-DOM, zero CSS conflicts. Ships with screenshot, console ring, network ring, route + intent capture, and an offline queue.
54
- - **🧠 AI-classified reports** — 2-stage pipeline (Haiku fast-filter → Sonnet deep + vision + RAG) tags each report with category, severity, confidence, and the component path.
55
- - **🪞 Dedup by meaning, not by string** — pgvector knowledge graph collapses duplicate reports across users, routes, and deploys so your queue isn't a noise storm.
56
- - **🤖 One-click "Dispatch fix"** — agentic orchestrator opens a GitHub PR with a screenshot diff and a Playwright replay. Sandbox-pluggable (`e2b`, `modal`, `cloudflare`, or your own).
57
- - **📬 Wires into your existing stack** — Sentry breadcrumbs, Slack Block Kit, Jira OAuth sync, Linear issues, PagerDuty escalations, Langfuse traces, GitHub PRs.
58
- - **🧑‍💻 Agent-native via MCP** — Cursor, Claude Code, Copilot, and any MCP client can read, triage, and dispatch fixes through the same JSON-RPC surface.
63
+ - **Shake-to-report widget** — Shadow-DOM, zero CSS conflicts. Ships with screenshot, console ring, network ring, route + intent capture, and an offline queue.
64
+ - **AI-classified reports** — 2-stage pipeline (Haiku fast-filter → Sonnet deep + vision + RAG) tags each report with category, severity, confidence, and the component path. Stage 2 streams partial results to the admin UI as tokens arrive.
65
+ - **Dedup by meaning, not by string** — pgvector knowledge graph collapses duplicate reports across users, routes, and deploys so your queue isn't a noise storm.
66
+ - **Bidirectional inventory (v2)** — opt in to `capture: { discoverInventory: true }` and the SDK quietly observes routes, `data-testid`s, and outbound API paths in production. Claude drafts an `inventory.yaml` of user stories + pages + actions for you to accept — most teams will never hand-author one.
67
+ - **Five pre-release gates (v2)** — `mushi-mushi/no-dead-handler`, `mushi-mushi/no-mock-leak`, inventory drift, agentic-failure detection, synthetic walk health. One composite GitHub status check via the [Mushi Mushi CI Gate Action](https://github.com/kensaurus/mushi-mushi/tree/master/packages/mcp-ci).
68
+ - **Spec-traced fixes (v2.10)** — every dispatched fix carries the inventory `Action` it's meant to repair, the `expected_outcome` contract is rendered into the LLM prompt, a deterministic `validateAgainstSpec` gate fires before the PR opens, and a targeted synthetic probe runs the moment the PR lands.
69
+ - **One-click "Dispatch fix"** — agentic orchestrator opens a GitHub PR with a screenshot diff and a Playwright replay. Sandbox-pluggable (`e2b`, `modal`, `cloudflare`, or your own).
70
+ - **Standards-first integrator** — W3C `traceparent` end-to-end, Standard Webhooks signing on every outbound delivery, RFC-draft `Idempotency-Key` middleware, OAuth 2.0 Dynamic Client Registration, OTLP/HTTP+JSON BYOK exporter. You bring your own observability stack — Mushi never marks up tokens.
71
+ - **Agent-native via MCP + A2A** — MCP Streamable HTTP at `/functions/v1/mcp`, A2A v1.0.0 tasks at `/v1/a2a/tasks` (pull SSE _and_ push notifications), Agent Card discovery, OpenAPI 3.1 spec. Cursor, Claude Code, Copilot, OpenAI Agents SDK, LangGraph, CrewAI all see the same surface.
59
72
 
60
73
  ---
61
74
 
62
75
  ## Who it's for
63
76
 
64
- | You are… | …and this helps because |
65
- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
66
- | **A solo dev / small team** shipping a consumer app | You already have Sentry for crashes — but users drop off over *friction*, not exceptions. Mushi captures "this button doesn't do anything". |
67
- | **A PM or designer** living in the admin | Triage, severity, component ownership, and PR status — all in one dark-mode console. No reading stack traces. |
68
- | **An AI-native team** already using Cursor / Claude | MCP tools expose the whole loop to your agent. `get_recent_reports`, `classify`, `dispatch_fix` — the same primitives your teammates use. |
69
- | **An enterprise** needing SOC 2 + residency | Region-pinned data (US / EU / JP / SELF), SAML SSO, audit-log ingest, DSAR workflow, HMAC-signed plugin webhooks. |
77
+ | You are… | …and this helps because |
78
+ | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
79
+ | **A solo dev / small team** shipping a consumer app | You already have Sentry for crashes — but users drop off over _friction_, not exceptions. Mushi captures "this button doesn't do anything". |
80
+ | **A PM or designer** living in the admin | Triage, severity, component ownership, and PR status — all in one dark-mode console. No reading stack traces. |
81
+ | **An AI-native team** already using Cursor / Claude | MCP tools expose the whole loop to your agent. `get_recent_reports`, `classify`, `dispatch_fix` — the same primitives your teammates use. |
82
+ | **An enterprise** needing SOC 2 + residency | Region-pinned data (US / EU / JP / SELF), SAML SSO, audit-log ingest, DSAR workflow, HMAC-signed plugin webhooks. |
70
83
 
71
84
  ---
72
85
 
@@ -74,17 +87,17 @@ That's it. Your users now have a shake-to-report button (or a floating widget).
74
87
 
75
88
  Mushi is a **companion** to Sentry/Datadog, not a replacement. It sees the bugs your crash tracker can't.
76
89
 
77
- | Scenario | Sentry / Datadog | **Mushi Mushi** |
78
- | ---------------------------------------- | :--------------: | :-------------: |
79
- | Unhandled JS exception | ✅ | ✅ |
80
- | Button that *looks* clickable but isn't | — | ✅ |
81
- | 12-second page load, no error thrown | — | ✅ |
82
- | User can't find the settings panel | — | ✅ |
83
- | Layout broken on iPad Safari only | — | ✅ |
84
- | Form submits but data doesn't save | ~ | ✅ |
85
- | Feature silently regressed last deploy | ~ | ✅ |
86
- | LLM-classified + deduped queue | — | ✅ |
87
- | One-click AI fix → draft GitHub PR | — | ✅ |
90
+ | Scenario | Sentry / Datadog | **Mushi Mushi** |
91
+ | --------------------------------------- | :--------------: | :-------------: |
92
+ | Unhandled JS exception | ✅ | ✅ |
93
+ | Button that _looks_ clickable but isn't | — | ✅ |
94
+ | 12-second page load, no error thrown | — | ✅ |
95
+ | User can't find the settings panel | — | ✅ |
96
+ | Layout broken on iPad Safari only | — | ✅ |
97
+ | Form submits but data doesn't save | ~ | ✅ |
98
+ | Feature silently regressed last deploy | ~ | ✅ |
99
+ | LLM-classified + deduped queue | — | ✅ |
100
+ | One-click AI fix → draft GitHub PR | — | ✅ |
88
101
 
89
102
  > Already have Sentry? Mushi writes breadcrumbs into your existing Sentry session so you can jump from a crash to the user's own words in one click.
90
103
 
@@ -92,6 +105,8 @@ Mushi is a **companion** to Sentry/Datadog, not a replacement. It sees the bugs
92
105
 
93
106
  ## Integrates with
94
107
 
108
+ **12 outbound plugins** — Mushi sends signals to whatever your team already lives in:
109
+
95
110
  <table>
96
111
  <tr>
97
112
  <td align="center" width="110"><b>GitHub</b><br/><sub>Auto-draft PRs<br/>+ Checks API</sub></td>
@@ -99,32 +114,50 @@ Mushi is a **companion** to Sentry/Datadog, not a replacement. It sees the bugs
99
114
  <td align="center" width="110"><b>Slack</b><br/><sub>Block Kit<br/>+ /mushi cmd</sub></td>
100
115
  <td align="center" width="110"><b>Jira</b><br/><sub>OAuth 3LO<br/>bidir sync</sub></td>
101
116
  <td align="center" width="110"><b>Linear</b><br/><sub>Issue create<br/>+ status sync</sub></td>
117
+ <td align="center" width="110"><b>PagerDuty</b><br/><sub>Severity-scoped<br/>escalation</sub></td>
102
118
  </tr>
103
119
  <tr>
104
- <td align="center" width="110"><b>PagerDuty</b><br/><sub>Severity-scoped<br/>escalation</sub></td>
120
+ <td align="center" width="110"><b>Discord</b><br/><sub>Embed messages<br/>per channel</sub></td>
121
+ <td align="center" width="110"><b>MS Teams</b><br/><sub>Adaptive cards<br/>+ on-call</sub></td>
122
+ <td align="center" width="110"><b>GitHub Issues</b><br/><sub>Labels<br/>+ assignees</sub></td>
123
+ <td align="center" width="110"><b>Bugsnag</b><br/><sub>Mirror + close<br/>on fix merge</sub></td>
124
+ <td align="center" width="110"><b>Rollbar</b><br/><sub>Mirror + resolve<br/>on fix merge</sub></td>
125
+ <td align="center" width="110"><b>Crashlytics</b><br/><sub>Push reports<br/>+ close</sub></td>
126
+ </tr>
127
+ <tr>
128
+ <td align="center" width="110"><b>Zapier</b><br/><sub>Generic<br/>webhook fan-out</sub></td>
105
129
  <td align="center" width="110"><b>Langfuse</b><br/><sub>LLM trace<br/>deeplinks</sub></td>
106
130
  <td align="center" width="110"><b>Cursor</b><br/><sub>via MCP<br/>server</sub></td>
107
131
  <td align="center" width="110"><b>Claude Code</b><br/><sub>via MCP<br/>server</sub></td>
108
- <td align="center" width="110"><b>Zapier</b><br/><sub>Generic<br/>webhook fan-out</sub></td>
132
+ <td align="center" width="110"><b>OpenAI Agents</b><br/><sub>via A2A<br/>tasks</sub></td>
133
+ <td align="center" width="110"><b>LangGraph</b><br/><sub>via A2A<br/>+ MCP</sub></td>
109
134
  </tr>
110
135
  </table>
111
136
 
112
- Plus first-class adapters for Datadog, New Relic, Honeycomb, and Grafana alerts via [`@mushi-mushi/adapters`](https://www.npmjs.com/package/@mushi-mushi/adapters).
137
+ **11 inbound adapters** — Mushi receives alerts from your existing monitoring and turns them into the same triaged report rows as user-felt bugs:
138
+
139
+ > Sentry · Datadog · Bugsnag · Rollbar · Firebase Crashlytics · New Relic · Honeycomb · Grafana Loki · AWS CloudWatch · Opsgenie · Firebase Analytics
140
+
141
+ All of them ship in [`@mushi-mushi/adapters`](https://www.npmjs.com/package/@mushi-mushi/adapters) — drop them into any Node webhook server (Express / Fastify / Hono / serverless function).
113
142
 
114
143
  ---
115
144
 
116
145
  ## Framework support
117
146
 
118
- | Framework | Install after wizard (automatic) |
119
- | ------------------- | ------------------------------------------- |
120
- | React | `@mushi-mushi/react` |
121
- | Next.js | `@mushi-mushi/react` |
122
- | Vue 3 / Nuxt | `@mushi-mushi/vue` + `@mushi-mushi/web` |
123
- | Svelte / SvelteKit | `@mushi-mushi/svelte` + `@mushi-mushi/web` |
124
- | Angular 17+ | `@mushi-mushi/angular` + `@mushi-mushi/web` |
125
- | React Native / Expo | `@mushi-mushi/react-native` |
126
- | Capacitor / Ionic | `@mushi-mushi/capacitor` |
127
- | Vanilla JS | `@mushi-mushi/web` |
147
+ | Framework | Install after wizard (automatic) |
148
+ | ------------------------------- | ------------------------------------------------- |
149
+ | React | `@mushi-mushi/react` |
150
+ | Next.js | `@mushi-mushi/react` |
151
+ | Vue 3 / Nuxt | `@mushi-mushi/vue` + `@mushi-mushi/web` |
152
+ | Svelte / SvelteKit | `@mushi-mushi/svelte` + `@mushi-mushi/web` |
153
+ | Angular 17+ | `@mushi-mushi/angular` + `@mushi-mushi/web` |
154
+ | React Native / Expo | `@mushi-mushi/react-native` |
155
+ | Capacitor / Ionic | `@mushi-mushi/capacitor` |
156
+ | Flutter / Dart | `pub add mushi_mushi` |
157
+ | iOS native (Swift) | Swift Package Manager — early dev |
158
+ | Android native (Kotlin/Java) | Gradle `dev.mushimushi:mushi-android` — early dev |
159
+ | Node (Express / Fastify / Hono) | `@mushi-mushi/node` (server-side error capture) |
160
+ | Vanilla JS | `@mushi-mushi/web` |
128
161
 
129
162
  Prefer to skip the wizard? `npm i @mushi-mushi/react` (or your framework's package) and wire it up by hand.
130
163
 
@@ -211,12 +244,12 @@ npx mushi-mushi --help
211
244
 
212
245
  Mushi is a CLI launcher — it spawns one `npm install` and writes one `.env.local` line. Here's what each scanner shows and why:
213
246
 
214
- | Scanner | What it shows | What it actually means |
215
- | ---------------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
216
- | **npm provenance** | ✅ Signed by `kensaurus/mushi-mushi @ master` | Cryptographic Sigstore attestation — `npm audit signatures` will verify this build came from this exact commit on this exact CI workflow. |
217
- | **Socket.dev** | Score + a few low-signal alerts | Alerts are expected and benign: `child_process.spawn` (used to invoke `npm install`), `process.env` (read `DEBUG`, `npm_config_*`), URL strings (printed in help text). All visible in `src/index.ts` — ~150 LOC, easy to audit.|
218
- | **Bundlephobia** | ❌ EntryPointError | **Expected.** This is a CLI (`bin` only — no `main`/`module`/`exports`), so there is no importable bundle to measure. Bundlephobia only works for libraries you `import`. |
219
- | **Snyk Advisor** | Health score (lower right after publish) | Snyk's crawler often lags by 1–2 weeks for new public packages — score corrects itself once it picks up the actual `package.json` (`CONTRIBUTING.md`, `funding`, downloads, repo activity). |
247
+ | Scanner | What it shows | What it actually means |
248
+ | ------------------ | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
249
+ | **npm provenance** | ✅ Signed by `kensaurus/mushi-mushi @ master` | Cryptographic Sigstore attestation — `npm audit signatures` will verify this build came from this exact commit on this exact CI workflow. |
250
+ | **Socket.dev** | Score + a few low-signal alerts | Alerts are expected and benign: `child_process.spawn` (used to invoke `npm install`), `process.env` (read `DEBUG`, `npm_config_*`), URL strings (printed in help text). All visible in `src/index.ts` — ~150 LOC, easy to audit. |
251
+ | **Bundlephobia** | ❌ EntryPointError | **Expected.** This is a CLI (`bin` only — no `main`/`module`/`exports`), so there is no importable bundle to measure. Bundlephobia only works for libraries you `import`. |
252
+ | **Snyk Advisor** | Health score (lower right after publish) | Snyk's crawler often lags by 1–2 weeks for new public packages — score corrects itself once it picks up the actual `package.json` (`CONTRIBUTING.md`, `funding`, downloads, repo activity). |
220
253
 
221
254
  If something looks off to you, [open an issue](https://github.com/kensaurus/mushi-mushi/issues) — the source is 100% public and the CI build is reproducible.
222
255
 
@@ -237,6 +270,19 @@ mushi deploy check # post-deploy smoke check
237
270
  mushi status # live pipeline health
238
271
  ```
239
272
 
273
+ For the **v2 inventory + gates** loop the actionable surface is the GitHub Action — drop one job into your repo and it runs Claude's proposer / the gate suite / the discovery digest on every PR:
274
+
275
+ ```yaml
276
+ # .github/workflows/mushi-gates.yml
277
+ - uses: kensaurus/mushi-mushi/packages/mcp-ci@master
278
+ with:
279
+ api-key: ${{ secrets.MUSHI_API_KEY }}
280
+ project-id: ${{ secrets.MUSHI_PROJECT_ID }}
281
+ command: gates # also: propose · discover-api · discovery-status · auth-bootstrap
282
+ ```
283
+
284
+ The same commands are exposed as MCP tools through [`@mushi-mushi/mcp`](https://www.npmjs.com/package/@mushi-mushi/mcp), so Cursor / Claude Code / Copilot can drive the v2 loop without you ever opening a terminal.
285
+
240
286
  Or skip the CLI entirely and drive it from your AI agent via [`@mushi-mushi/mcp`](https://www.npmjs.com/package/@mushi-mushi/mcp):
241
287
 
242
288
  ```json
package/SECURITY.md CHANGED
@@ -19,15 +19,59 @@ If you discover a security vulnerability, please report it responsibly.
19
19
 
20
20
  **Do NOT open a public GitHub issue.**
21
21
 
22
- Instead, email: **kensaurus@gmail.com**
22
+ Use either channel below:
23
+
24
+ 1. **GitHub Private Vulnerability Reporting** — strongly preferred.
25
+ <https://github.com/kensaurus/mushi-mushi/security/advisories/new>
26
+ Routes the report into a private advisory with built-in CVE issuance,
27
+ patch coordination, and contributor-credit workflow.
28
+ 2. **Email** — `kensaurus@gmail.com`, subject prefix `[mushi-security]`.
29
+ PGP welcome but not required.
23
30
 
24
31
  Include:
25
32
  - Description of the vulnerability
26
- - Steps to reproduce
27
- - Impact assessment
33
+ - Steps to reproduce (smallest reproducer wins)
34
+ - Impact assessment (what an attacker gains)
28
35
  - Suggested fix (if any)
36
+ - Whether you want public credit (and how to spell your name)
37
+
38
+ ### Coordinated-disclosure timeline
39
+
40
+ | Day | Action |
41
+ |-----|--------|
42
+ | 0 | Report received |
43
+ | ≤ 2 | Acknowledgment + assigned a tracking ID |
44
+ | ≤ 7 | Triage complete: severity assigned (CVSS 3.1) and target patch date communicated |
45
+ | ≤ 30 | Patch released for critical / high (CVSS ≥ 7.0); ≤ 60 days for medium; best-effort for low |
46
+ | Patch + 7 | Public advisory + CVE published; reporter credited unless they declined |
47
+ | Patch + 90 | Embargo expires regardless; if upstream is unresponsive, the reporter is free to publish |
48
+
49
+ ### Safe harbor
50
+
51
+ Good-faith security research on Mushi Mushi is welcome. If you stay
52
+ within the rules below, we will not pursue legal action, will not ask
53
+ your hosting provider to take you offline, and will publicly credit your
54
+ work:
55
+
56
+ - Test only against your own self-hosted instance, the public demo at
57
+ <https://kensaur.us/mushi-mushi/admin/>, or accounts you own.
58
+ - Do not access, exfiltrate, or modify data belonging to other users.
59
+ - Do not run automated scanning that affects availability for others
60
+ (rate-limit your tooling, exclude `/health`).
61
+ - Disclose privately first (channels above); do not publish before the
62
+ embargo above expires.
63
+ - Do not intentionally exploit a finding to escalate beyond proving it
64
+ exists.
65
+
66
+ If a finding requires touching production data to confirm, **stop and
67
+ ask first** — describe what you'd need to do and we'll spin up a sandbox.
68
+
69
+ ### Hall of fame
29
70
 
30
- We will acknowledge receipt within 48 hours and aim to release a patch within 7 days for critical issues.
71
+ Researchers who report a confirmed vulnerability are credited in the
72
+ release notes for the patched version and added to
73
+ [`docs/SECURITY_HALL_OF_FAME.md`](./docs/SECURITY_HALL_OF_FAME.md) (with
74
+ permission).
31
75
 
32
76
  ## Scope
33
77
 
@@ -48,6 +92,125 @@ We will acknowledge receipt within 48 hours and aim to release a patch within 7
48
92
  - **Rotate API keys** regularly via the admin console
49
93
  - **Enable SSO** for team projects (Enterprise tier)
50
94
  - **Review audit logs** periodically for suspicious activity
95
+ - **Verify SDK integrity** with `npm audit signatures` after install
96
+ - **Set `Content-Security-Policy`** on any page embedding the Mushi widget;
97
+ the widget itself ships with `script-src 'self'` and does not load
98
+ remote scripts.
99
+
100
+ ## Threat model
101
+
102
+ What we treat as in-scope attacker capabilities, and what we don't.
103
+
104
+ | Capability | In scope | Notes |
105
+ |-----------|----------|-------|
106
+ | Unauthenticated network attacker hitting public endpoints | ✅ | Rate-limit + HMAC + replay protection on every webhook endpoint (`packages/server/supabase/functions/_shared/webhook-middleware.ts`). |
107
+ | Authenticated user trying to read another tenant's data | ✅ | Postgres RLS on every `public.*` table; advisor lints reviewed monthly. |
108
+ | Authenticated user trying to escalate to super-admin | ✅ | Role lives in `auth.users.raw_app_meta_data.role`; cannot be self-edited via PostgREST. |
109
+ | Compromised dependency (npm supply-chain attack) | ✅ | 7-day cooldown + provenance + Harden-Runner + pinned SHAs (see "Supply-chain hardening" below). |
110
+ | Stolen API key | ✅ | Per-key scopes (`api_key_has_scope`), revocation via admin console, audit log of every use. |
111
+ | User pasting a Stripe / OpenAI / GitHub PAT into a bug report | ✅ | PII scrubber redacts ~15 vendor token formats client-side before the report leaves the device. Mirrors `packages/core/src/pii-scrubber.ts` across iOS, Android, Flutter, React Native. |
112
+ | Stolen end-user device with the SDK installed | ⚠️ partial | Offline queue is AsyncStorage / Keychain / SharedPreferences — no app-level encryption beyond the OS default. Reports waiting to flush are vulnerable to a forensic attacker. |
113
+ | Compromised Supabase service-role key | ❌ | Treated as a tier-0 incident; would require key rotation and audit-log forensics. Not defendable in software. |
114
+ | Compromise of `kensaurus@gmail.com` | ❌ | Treated as a project-fork event; downstream consumers should pin to the last known-good version and follow the new release channel. |
115
+ | Physical / OS-level attacker on an end-user device | ❌ | Out of scope. |
116
+ | Malicious fork using the Mushi name to ship malware | ❌ (technical) ✅ (legal) | The MIT/BSL grant lets the fork exist; the trademark policy (`TRADEMARK.md`) makes shipping it under the Mushi name an infringement we will pursue. |
117
+
118
+ ## Data handling and PII
119
+
120
+ ### What the SDK collects by default
121
+
122
+ | Field | Scope | PII risk |
123
+ |-------|-------|----------|
124
+ | URL / route the user was on | Always | Low — strip query strings if your routes encode user IDs. |
125
+ | Browser / OS / device | Always | None |
126
+ | Console errors (last 50) | Opt-in via `captureConsole: true` | Medium — can include user data your code logs. |
127
+ | Network failures (URL + status) | Opt-in via `captureNetwork: true` | Medium — query params logged as-is unless you redact in-app. |
128
+ | User id / email / role | Only if you call `setUser()` | High — only set what you need; we do not auto-discover. |
129
+ | Session replay frames | Off by default | High — handled by the masking layer; passwords / cards / opted-out elements never leave the page. |
130
+ | Free-text bug description | Always | Medium — passed through the PII scrubber (see below). |
131
+
132
+ ### What the PII scrubber redacts before send
133
+
134
+ Implemented identically across `@mushi-mushi/core`, the iOS, Android,
135
+ Flutter, and React Native SDKs. Defaults are below — every category can
136
+ be toggled off, but `secretTokens` is on by default and we recommend
137
+ keeping it that way.
138
+
139
+ | Category | Default | Patterns |
140
+ |----------|---------|----------|
141
+ | `ssns` | on | `123-45-6789` |
142
+ | `creditCards` | on | 12–19 digit Luhn-shaped sequences with optional separators |
143
+ | `secretTokens` | on | AWS access key (`AKIA…` / `ASIA…`), AWS secret (`aws_secret_access_key=…`), Stripe (`sk_live_…`, `sk_test_…`, `rk_…`, `pk_…`), Slack (`xox[abpor]-…`), GitHub PAT (`ghp_…`, `github_pat_…`), OpenAI (`sk-…`, `sk-proj-…`), Anthropic (`sk-ant-…`), Google API (`AIza…`), JWT (`eyJ…` 3-segment) |
144
+ | `emails` | on | RFC-5322 lite |
145
+ | `phones` | on | E.164 with optional country code |
146
+ | `ipAddresses` | off | IPv4 (off because internal IPs are usually not PII and noise hurts triage) |
147
+ | `ipv6` | off | Same |
148
+
149
+ The fields scrubbed are:
150
+
151
+ - `description` — primary free-text field of every bug report
152
+ - `summary` — short summary, in the same composer
153
+ - `breadcrumbs[].message` — auto-captured user-action trail (clicks, route changes, console messages)
154
+
155
+ Structured fields you set explicitly (`metadata.userEmail`,
156
+ `metadata.userId`, etc.) are intentionally **not** scrubbed — those are
157
+ opt-in attribution data, and silently rewriting them would break
158
+ support workflows.
159
+
160
+ ### Where data lives
161
+
162
+ - **Reports & telemetry** — Supabase Postgres in the `us-west-1` region.
163
+ - **Session replays** — Supabase Storage, same region. Lifecycle policy
164
+ trims replays older than 30 days unless explicitly retained from the
165
+ admin console.
166
+ - **Inbound webhook bodies** — only a SHA-256 hash + `delivery_id` of
167
+ the body is persisted (`webhook_audit_log`). The full body is
168
+ processed in memory and discarded.
169
+ - **Outbound integrations** (Slack, Jira, …) — Mushi is a sender only;
170
+ the receiving system's retention applies.
171
+
172
+ ### Encryption
173
+
174
+ | Surface | At rest | In transit |
175
+ |---------|---------|------------|
176
+ | Postgres (Supabase) | AES-256 (Supabase default) | TLS 1.2+ |
177
+ | Supabase Storage (replays) | AES-256 | TLS 1.2+ |
178
+ | Edge Function ↔ Postgres | — | TLS via the Supavisor pooler |
179
+ | SDK ↔ ingest endpoint | — | TLS 1.2+ enforced; HSTS preload on `kensaur.us` |
180
+ | Inbound webhooks | — | TLS terminated at CloudFront / Supabase edge |
181
+ | Audit log integrity | append-only by RLS; no in-row signing | — |
182
+
183
+ ### Cryptographic primitives
184
+
185
+ | Use | Algorithm | Implementation |
186
+ |-----|-----------|---------------|
187
+ | Webhook HMAC verification (Sentry, GitHub, Datadog, Honeycomb, Grafana, Bugsnag, Rollbar, Crashlytics) | HMAC-SHA256, constant-time compare | Web Crypto in Deno; `crypto.subtle.timingSafeEqual` analogue |
188
+ | AWS SNS subscription confirmation | RSA-SHA1 / RSA-SHA256 | Deno `crypto.subtle.verify` with the cert from `SigningCertURL` (URL allow-listed to `*.sns.*.amazonaws.com`) |
189
+ | Opsgenie JWT shared-token | HS256 with `aud` claim verification | `jose` (Deno-compatible) |
190
+ | API-key hashing (database) | SHA-256 prefix + bcrypt secret half | `pgcrypto` |
191
+ | Provenance attestations (npm) | Sigstore (Fulcio + Rekor) | `npm publish --provenance` |
192
+
193
+ We deliberately do not roll our own crypto. If you find an algorithm or
194
+ library above that has been deprecated, please file a security advisory.
195
+
196
+ ### Operator security checklist
197
+
198
+ When you provision a new self-hosted Mushi instance:
199
+
200
+ - [ ] Set `auth_leaked_password_protection = true` in Supabase Auth
201
+ (HaveIBeenPwned blocklist; flagged as `auth_leaked_password_protection`
202
+ in the security advisor).
203
+ - [ ] Enable at least two MFA factors in Supabase Auth (`auth_insufficient_mfa_options`).
204
+ - [ ] Rotate the service-role key on day 1, then quarterly.
205
+ - [ ] Restrict Postgres direct connections to your CI / migration runners
206
+ via Supabase network restrictions.
207
+ - [ ] Run `pnpm dlx supabase advisors --project-ref <ref>` after every
208
+ migration; aim for zero ERROR-level findings.
209
+ - [ ] Configure a Supabase log drain to your SIEM if you are subject to
210
+ SOC 2 / ISO 27001.
211
+ - [ ] Set CSP `frame-ancestors` on the host page if you embed the Mushi
212
+ widget (the widget is iframe-friendly but does not enforce
213
+ framing constraints itself).
51
214
 
52
215
  ## Supply-chain hardening (how this package is protected)
53
216
 
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // src/index.ts
4
4
  import { runInit } from "@mushi-mushi/cli/init";
5
5
  import { FRAMEWORK_IDS, isFrameworkId } from "@mushi-mushi/cli/detect";
6
- var VERSION = true ? "0.6.3" : "0.0.0-dev";
6
+ var VERSION = true ? "0.6.5" : "0.0.0-dev";
7
7
  var MIN_NODE_MAJOR = 18;
8
8
  var ISSUES_URL = "https://github.com/kensaurus/mushi-mushi/issues";
9
9
  var HELP = `mushi-mushi \u2014 bug-reporting SDK launcher
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "mushi-mushi",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "license": "MIT",
5
5
  "description": "Ship a shake-to-report button and get AI-classified, deduped, ready-to-fix bug reports — one `npx mushi-mushi` command for React, Next.js, Vue, Nuxt, Svelte, SvelteKit, Angular, React Native, Expo, Capacitor, and vanilla JS. Companion to Sentry: catches the user-felt bugs crash trackers can't see. Wires into GitHub, Slack, Jira, Linear, PagerDuty, Langfuse, and any MCP-compatible AI agent (Cursor, Claude Code, Copilot).",
6
6
  "bin": {
7
7
  "mushi-mushi": "./dist/index.js"
8
8
  },
9
9
  "dependencies": {
10
- "@mushi-mushi/cli": "^0.6.0"
10
+ "@mushi-mushi/cli": "^0.7.0"
11
11
  },
12
12
  "devDependencies": {
13
- "@types/node": "^22.15.3",
14
- "eslint": "^10.2.0",
13
+ "@types/node": "^22.19.17",
14
+ "eslint": "^10.3.0",
15
15
  "tsup": "^8.5.1",
16
- "typescript": "^6.0.2",
17
- "vitest": "^4.1.4",
16
+ "typescript": "^6.0.3",
17
+ "vitest": "^4.1.5",
18
18
  "@mushi-mushi/eslint-config": "0.0.0"
19
19
  },
20
20
  "author": "Kenji Sakuramoto",