What Inspa can touch, what leaves your machine, and how to report a problem. This page is written for the security or IT reviewer signing off on Inspa for a design team. Every claim below points at the code that enforces it, so you can check it yourself. If the code and this page disagree, the code wins and this page has a bug: please report it.
Inspa's local CLI runs on an editor's own machine, with that editor's own git, gh and coding-agent credentials.
The assets worth protecting are the source code on disk,
the editor's credentials (git remote, gh, Claude Code login) and the integrity of the repo (nothing should be pushed or merged that the editor didn't ask for).
The attackers we design against are (1) a malicious website open in the same browser that tries to reach the local server (CSRF, DNS rebinding),
(2) another device on the network,
and (3) a coding agent that goes off-script (prompt injection from file contents, or a plain mistake) and tries to run commands,
reach the network or edit files outside the project.
Out of scope:
an attacker who already runs code as the editor's OS user (they can read the files and credentials directly), and the security of the agent provider itself.
npx inspa starts one HTTP server that serves the Inspa UI and its API (packages/cli/src/server.ts).
- Loopback only.
It binds to
127.0.0.1by default, so other devices on the network can't connect. The per-variant dev servers it starts are also on loopback (packages/core/src/devserver.ts). - Host check (anti DNS rebinding).
Every request, including static files and WebSocket upgrades, must carry a
Hostof127.0.0.1:<port>,localhost:<port>or[::1]:<port>. Anything else gets403(packages/cli/src/guard.ts, from #145). - Origin check (anti CSRF).
Every
POST/PUT/PATCH/DELETEand every WebSocket upgrade must come from the UI's ownOrigin, or carry the per-sessionX-Inspa-Tokenheader (a random 24-byte token, generated at start-up and never served to any page). Missing or foreign Origin without the token gets403. - JSON only for mutations.
Mutating requests need
Content-Type: application/json(415otherwise). That forces a CORS preflight, which the server never answers, so a cross-site form orfetchcan't sneak through. - What the API can do: read the project's design tokens and config, count a component's uses,
run an edit through the agent (and cancel it), create and clean up variant worktrees,
and hand off a picked variant (push its branch, open a draft PR).
It does not expose a shell or arbitrary file reads:
static files are served only from the built UI directory, and paths that escape it get
403.
Edits come from the editor's own agent.
The Claude adapter (packages/core/src/agent/claude.ts) runs the Claude Agent SDK with these restrictions:
- Allowed tools:
Read,Edit,MultiEdit,Write,Glob,Grep,LS(ALLOWED_TOOLS). Nothing else. - Disabled outright:
Bash,BashOutput,KillShell(no shell),WebFetch,WebSearch(no web access by the agent's tools),Task(no sub-agents),NotebookEdit(DISALLOWED_TOOLS). - Paths checked against the project.
Every tool call goes through
checkToolUse, which denies anyfile_path/path/notebook_paththat resolves outside the project directory (cwd), including via... Unknown tools are denied too, so a tool the SDK adds later is off until we allow it. - Project settings only.
The SDK loads only the project's own Claude settings (
settingSources: ["project"]), in the default permission mode, with a turn cap (30 by default). - Narrower for a one-element edit.
An edit on one element runs scoped: read and edit tools only, only on that element's own files, at most 6 turns.
If it cannot finish there, it runs once more with the limits above (
packages/core/src/agent/mode.ts). - A process kept for the design session.
Single edits are sent to one Claude Code process per project folder, which is started when you select an element and stopped after 5 minutes idle or when Inspa exits.
Its tool list and settings are the ones above, and every tool call is checked against the edit that is running;
between edits every tool call is refused.
Set
INSPA_WARM_AGENT=0to start a new process for every edit instead (packages/core/src/agent/claude-warm.ts). - No AI in tests.
INSPA_AGENT=fakeuses a deterministic fake agent that never touches the network; all of Inspa's tests use it.
| Traffic | When | Credentials |
|---|---|---|
| The agent's own traffic to its provider (e.g. Claude Code → Anthropic): your prompt, the selected element's source context, the project's tokens, and the files the agent chooses to read | Each point-and-prompt edit or variant | The editor's own Claude Code login. Inspa holds no API key. |
git push of the handoff branch to your remote, and gh pr create --draft with before/after screenshots and the designer's notes |
Only when the editor picks a variant and hands it off | The editor's own git and gh credentials |
That's all. Inspa has no telemetry, no analytics, no crash reporting and no update check. It never merges a PR; engineers review and merge in GitHub as usual.
Inspa Cloud is being built in cloud:
GitHub sign-in and sessions, workspaces with roles and invites, the GitHub webhook receiver and PR summary comment, a review-comments API, Stripe billing, guest review links and review packets.
It does not host your app or read your hosts' preview deploys:
the preview viewer and hosted projects went with whole-project hosting (the No project hosting docs page).
What it does today is in the Inspa Cloud (early) docs page;
what it stores is in the Security and data docs page.
Inspa Cloud will never store customer source code (mission principle 4).
It reads through a GitHub App with minimal permissions, and stores only metadata, comments and screenshots.
Tests use a mocked GitHub.
The App's permissions, events and URLs are defined in one place, the manifest cloud/src/github/manifest.ts (#1071), which the one-click registration page (/admin/github-app/register) sends to GitHub.
cloud/test/github-app-manifest.test.ts fails if this table or the event list below drifts from it.
This is exactly what the webhook receiver (POST /webhooks/github, cloud/src/github/webhook.ts, #172, #567), the PR summary comment (cloud/src/github/pr-sync.ts, #576) and variant pick comments (#933) need;
a later feature that needs more adds it to the manifest and here first.
GitHub shows the same list on its install screen.
| Permission | Access | Why |
|---|---|---|
| Metadata | Read | Required by GitHub for every App; lists the repos the App is installed on. |
| Pull requests | Read & write | Read: list open PRs (especially inspa/* handoffs): number, title, head branch and SHA, state. Write (#576): keep one Inspa summary comment on each PR that has review threads (create it, then edit that same comment in place). |
| Issues | Read & write | GitHub's REST API stores PR conversation comments as issue comments (POST /repos/:o/:r/issues/:pr/comments, PATCH /repos/:o/:r/issues/comments/:id), which need Issues: write. Inspa only creates and edits its own summary comment; it never reads, edits or closes anyone else's issues or comments. |
| Contents | Not requested | Reviewing works on handoffs and review packets, not on source. If a later feature (editing from the browser) needs it, it will be requested separately and documented here. |
One account permission, which each person grants for their own account when they sign in (#1398):
| Account permission | Access | Why |
|---|---|---|
| Email addresses | Read | Sign-in reads the user's primary verified email when their GitHub profile email is private (GET /user/emails, cloud/src/auth/github.ts). Email-bound invites and notification emails need an address. Sign-in goes through the App's client id, where GitHub applies the App's permissions instead of OAuth scopes, so without this permission the lookup is refused and such a user has no email in Inspa. Only that one address is stored; the list is not kept. |
Not requested: Administration, Actions, Checks, Commit statuses, Deployments (no longer: Inspa does not read hosted app previews, the No project hosting docs page), Secrets, Workflows, Members, any other account permission, or any organisation-level permission.
Webhook events: pull_request, plus installation and installation_repositories (GitHub sends those to every App).
Every delivery must carry a valid X-Hub-Signature-256 (HMAC-SHA256 of the raw body with the App's webhook secret, compared in constant time);
missing or bad signatures are rejected before the body is parsed.
The receiving route is POST /webhooks/github (cloud/src/routes/webhooks.ts, #567):
it checks the signature over the exact raw request bytes, answers 401 without touching the database when it fails,
and is exempt from the CSRF same-origin check because it is authenticated by the signature,
not by a session cookie (GitHub sends no Origin).
With GITHUB_WEBHOOK_SECRET unset the route is off (404); an empty secret never verifies anything.
Logs record only the delivery id, event name and outcome, never the payload.
What is posted to GitHub (cloud/src/github/pr-sync.ts, #576):
one comment per PR listing its open review threads (element label from the anchor's component name or visible text, the first comment cut to 140 characters, reply count, author name) and the resolved count.
Never source code or source paths;
@mentions and HTML in reviewers' comments are neutralised so the summary can't ping people or inject markup.
GitHub errors are logged with status and path only and never fail the reviewer's request.
What is stored (cloud/migrations/0004_github.sql): installation and repo ids and names;
per PR its number, title, head branch and SHA, state, draft flag, URL and author login;
per deployment its SHA, ref, environment, preview URL and state (only rows stored before deployments stopped being read).
PR bodies, diffs, file names and file contents are never read from the payload or stored.
Review packets (cloud/migrations/0012_review_packets.sql, #662):
when a designer shares a design session, Cloud stores the packet's prompts, the agent's prose summaries, designer notes,
element/component labels (e.g. PricingCard · src/Pricing.tsx:42),
Design Check counts and screenshots (PNG, JPEG or WebP, ≤ 5 MB each, type sniffed from the bytes; bytes in the packet_blobs table by default).
Never file contents, diffs or source:
the manifest is validated against an allow-list of fields and any diff, patch, source, files, code, html... field anywhere is refused with a 400.
Only members of the workspace can read a packet; only editors can upload one.
Free-plan links expire after 7 days (410 afterwards).
Images are served with their sniffed type, nosniff and a default-src 'none'; sandbox CSP.
Product analytics events (cloud/migrations/0025_events.sql, #663): Cloud's own events table, no third-party tracker.
Each row is an allow-listed event name (workspace.created, invite.created, invite.accepted, thread.created, preview.opened, github.connected),
the workspace and user ids it concerns, a timestamp,
and at most 8 props that must be short ids or enums (≤ 64 chars of letters, digits and _ . : -):
emails, URLs, paths and free text are rejected and the event is dropped (the rejected value is never logged).
Deleting a workspace or user clears its id from these rows.
The same migration stores each GitHub user's login (users.github_login) so INSPA_ADMIN_USERS can name admins by login.
Only those admins can read the aggregate counts (GET /api/admin/metrics, 404 for everyone else).
Self-hosters can set ANALYTICS=off to record nothing.
Cloud no longer frames hosted preview builds of your app (the preview viewer, GET /w/:slug/preview, is gone: the No project hosting docs page).
Preview URLs still appear in two places, a guest link's "Open the preview" and a variant option's frame on the variant board, and the rules for them stay:
- Which previews.
Only
http(s)URLs without credentials, whose host is onPREVIEW_HOST_ALLOWLIST(exact hosts or*.domainfor subdomains;cloud/src/preview-hosts.ts). Default:localhost,127.0.0.1,[::1]in development, nothing in production. - The variant board frames options with a strict CSP (nonce'd inline script and style only,
frame-src= the options' origins,frame-ancestors 'none'), sandboxed frames, and trusts a frame's message only from that frame's own origin and window. - Presence on a preview (#739).
GET /w/:slug/presenceand its heartbeat POSTs need a session andpreview.viewin the workspace (#228): signed out 401, non-member or unknown workspace one 403. Rooms exist only for allowlisted previews; each member gets a random token at join and only that token can move its cursor (wrong token → 410). POSTs pass the CSRF same-origin check. The server validates cursors (finite numbers, shortsrc) and views (URL must stay on the preview's origin).
Please don't open a public issue for a security problem.
Use GitHub's private vulnerability reporting on this repository (Security → Report a vulnerability:
https://github.com/kaiserarg/inspa/security/advisories/new). Include what you found, how to reproduce it, and
what an attacker could do with it. If that link doesn't work (the setting may not be switched on yet), open a
public issue titled "security contact request" with no details, and we'll reach out to arrange a private
channel. We'll acknowledge the report, fix it on a branch, and credit you if you'd like.
Inspa is pre-release, so fixes land on main; there are no older versions to patch.
- GitHub OAuth.
GET /auth/githubsends the user to GitHub with a randomstate, also kept in a 10-minute HttpOnly cookie (inspa_oauth_state,Path=/auth); the callback refuses a missing or different state. Scopes:read:user user:emailonly. When sign-in uses the GitHub App's client id, GitHub ignores scopes and applies the App's permissions: the private-email lookup then relies on the App's "Email addresses: read" account permission (above). The access token is used once to read the profile and is never stored. After sign-in the user lands onnext, which must be a same-site path (/…, never//hostor a URL). - Sessions.
The
inspa_sessioncookie holds a random 256-bit id:HttpOnly,SameSite=Lax,SecurewhenNODE_ENV=production, 30-day lifetime. Thesessionstable stores only its SHA-256, the user and the expiry; expired rows are refused and deleted.POST /auth/signoutdeletes the row. - CSRF.
Every POST/PUT/PATCH/DELETE that uses the session (and sign-out, dev-login) must be same-origin:
if the browser sends
Originit must equalPUBLIC_URL's origin (or the request's own host when unset); otherwiseSec-Fetch-Site, when present, must besame-originornone. Cross-site requests get403 csrf_failed. Combined withSameSite=Lax, a third-party site can't make a signed-in browser mutate. - Roles.
Every API route goes through
requireUser(401) andrequireRole(workspace, action)(403, also for non-members), which use the singlecan(role, action)table. - Dev login.
INSPA_DEV_LOGIN=1addsPOST /auth/dev-login(signs in as a seed user without GitHub). The server refuses to start with it whenNODE_ENV=production.
- What a link opens. An owner creates a guest link for one repo + PR (or branch). Its token (192 random bits) is shown once; only its SHA-256 is stored. Holding it lets anyone join as a guest with a name (email optional).
- Guest sessions are not user sessions.
Joining sets an
inspa_guestcookie (HttpOnly, SameSite=Lax, Secure in production; only its SHA-256 is stored). It never resolves to a user, so every/api/workspaces/...route (repos, PRs, members, invites, other previews) answers 401. Guest routes read only their own link's workspace + repo + PR/branch; another link's token or another PR's thread is 401/404. Guests are never members and never seats. Guest emails are never returned by any route. Guest posts pass the same CSRF check. - Revoke, expire, clean up.
Owners revoke a link (every guest of it loses access at once,
410), and delete guest comments. Links expire per plan (Free 7 days, Team never). Guest posting is rate limited per guest and joining per address (429withRetry-After; in-memory, per process).
For the CLI (inspa login, inspa share), which has no browser cookie (cloud/src/auth/tokens.ts, cloud/src/routes/tokens.ts).
- Storage.
A token's secret is
inp_+ 256 random bits (base64url). It is returned once, in thePOST /api/tokensresponse (Cache-Control: no-store), and never again: theapi_tokenstable (cloud/migrations/0011_api_tokens.sql) stores only its SHA-256, a name, the owner and timestamps. Request logs record the path, never headers, so the secret isn't logged. - Scope.
Authorization: Bearer inp_...on/api/*acts as the token's user, with exactly that user's rights (the samerequireRolechecks as a session). It grants no repo or GitHub access: Cloud holds no GitHub user token to hand out. Browser pages (/w/...,/invite/...) ignore it. - No CSRF check for bearer requests.
Browsers never attach an
Authorizationheader on their own, so a cross-site page can't ride on a token. Cookie requests keep the same-origin check. - Failure is loud.
An unknown, revoked or malformed
Authorizationheader is401, with no fallback to a cookie. - Tokens can't make tokens.
Creating, listing and revoking tokens requires a browser session; a bearer request to
/api/tokensgets403.DELETE /api/tokens/:idrevokes immediately (only your own; others' are404).last_used_atis updated at most once a minute per token.