Threat model

This model covers the Clank framework, generated authenticated applications, CLI, control plane, deployment artifact path, managed ingress, service drivers, and backup system.

17 min read3,558 wordsClank 0.22.1

This model covers the Clank framework, generated authenticated applications, CLI, control plane, deployment artifact path, managed ingress, service drivers, and backup system.

Assets

  • account credentials, sessions, passkeys, recovery tokens, agent OAuth grants, and CLI tokens;
  • organization membership, project permissions, audit history, and deployment authority;
  • application source/artifacts, migrations, secrets, databases, files, email, jobs, and webhooks;
  • control-plane master keys, encrypted backups, release history, usage history, billing entitlements, and signing/provenance data;
  • availability and integrity of active application processes and routes.

Principals

  • anonymous browser or agent;
  • authenticated application user;
  • registered public MCP client acting through a user-approved, scoped OAuth grant;
  • organization owner, admin, developer, or viewer;
  • allowlisted control-plane platform administrator;
  • browser account approving a CLI device;
  • account-wide or project-scoped CLI token;
  • deployment control-plane process;
  • authenticated deployment worker;
  • deployed application process/container;
  • machine, container, database, DNS, email, object-storage, and TLS operators.

Trust boundaries

  1. Browser/agent to application HTTP, MCP, OAuth, and live-stream APIs.
  2. Browser to auth, recovery, MFA, and passkey ceremonies.
  3. CLI to browser-approved device flow and control-plane bearer API.
  4. Artifact bytes to extraction, migration, candidate startup, and activation.
  5. Control plane to application process/container and project filesystem.
  6. Managed ingress to host routing and application upstream.
  7. Framework to external email, file, job, webhook, database, billing, and provisioning providers.
  8. Live database to encrypted backup repository and restore target.
  9. Git source to CI, attestation, GitHub release, and npm publication.
  10. Trusted application source through the TSX compiler to generated executable modules.
  11. Web mutation to durable queue and leased worker/scheduler to external side effects.

Primary abuse cases

ThreatRepresentative attackPrincipal controlsResidual responsibility
Account takeoverCredential stuffing, reset replay, stolen session, cloned authenticatorScrypt, generic login errors, shared HMAC-keyed control-plane rate limits, single-use recovery, MFA, WebAuthn verification/counters, revocationUpstream abuse controls, bot defense, email security, user/device risk policy
Cross-site actionCSRF, forged Origin, cross-site device approvalStrict cookies, CSRF token, Fetch Metadata/origin checksCorrect proxy scheme/host configuration and CSP
Agent credential abuseMalicious dynamic client, authorization-code interception, refresh replay, token confused with another API or tenantExact HTTPS/loopback redirects, PKCE S256, explicit consent, resource indicators and audience checks, short access lifetime, hashed tokens, refresh rotation, bounded encrypted single-successor adaptive handoff chain, strict-mode family revocation, read/write scopes, MCP-only bearer resolution, per-user grant inbox with monotonic scope reduction and immediate revocationAdaptive recovery cannot distinguish a legitimate lagging client replica from a thief holding the same predecessor bearer token; its authority converges on the unspent successor's existing scope, resource, client, family, and expiry through at most 64 links. Choose strict mode for replay-driven family revocation. Client identity remains self-asserted, so users must review names/scopes; endpoint TLS, agent-host security, and edge registration limits remain operational responsibilities
Agent action abusePrompt injection or compromised client invokes hidden/destructive tools, guesses a write tool with a read token, or submits adversarial argumentsAuthenticated tool discovery, mutation scope enforcement before dispatch, agent: false, destructive annotations, shared runtime schemas/authorization/ownership/transactions, bounded messages, generic failuresDomain authorization and confirmation inside handlers; annotations guide clients but are not security controls
Tenant escapeGuess project/user IDs, reuse scoped token, stale membershipOwned SQL, membership/role checks, project/scope checks on every request, revocationDomain-specific row/resource authorization
Privilege escalationAdmin grants excess scopes, removes last owner, uses viewer token to deployRole matrix, scope intersection, last-owner protection, auditPeriodic access review and separation of duties
Platform-admin abuseWorkspace admin assumes global authority, stolen CLI token lists tenants, stale allowlist retains accessSeparate operator role, exact startup reconciliation, browser-only global APIs, same-origin sessions, bounded redacted directoryProtect operator email accounts, require strong authenticators, review the allowlist and global audit trail
Impersonation abuseOperator silently edits tenant data, targets another operator, replays a support token, or denies accessing an accountRecent-auth and CSRF gate, exact target confirmation, required reason, admin/self/disabled-target denial, hashed 15-minute session-bound capability, safe-method-only effective identity, visible banner, real-actor start/stop auditLimit the operator allowlist, alert on support sessions, require ticket-linked reasons and customer approval where policy or law requires it
Invitation replay or disclosureReuse a superseded token, create an uninvited account while signup is closed, scrape pending addresses or audit metadata, flood active invitations, leak links through request logs, or duplicate a retryHashed email-bound single-use account-creation capability, pre-hash origin check, transactional consume/membership, failed-account cleanup, atomic replacement/revocation, administrator-only pending metadata, developer audit redaction, 100-active cap, fragment links, encrypted transactional outbox, cross-instance leases, idempotency, ciphertext erasure, auditProtect invited mailboxes and mail-provider credentials; provider-accepted messages cannot be recalled
Artifact compromiseTraversal, symlink, decompression bomb, digest swap, malicious install hookBounded deterministic bundle, path/type/mode validation, SHA-256 verification, no remote install/build hooksReview trusted source and isolate runtime execution
Migration/data lossEdited history, unsafe SQL, failed migration, destructive rollbackImmutable ledger, restricted SQL, quiesced backup, transactional apply, safety restore, confirmationSchema review, off-host backups, restore drills
Preview data leak or quota bypassBranch deploy copies raw production data/secrets, weakens sanitization in pull-request code, nests children, or creates unbounded temporary runtimesEmpty default; active-production-bound table/row/transform policy; unconditional credential/job purge; per-preview HMAC; integrity, vacuum, staging overwrite, migration, and health gates; separate IDs/hostnames; nested-preview denial; ordinary quotas and bounded TTL cleanupReview every explicit keep, prefer synthetic fixtures, remove previews when CI closes, and monitor project capacity
Historical value disclosure or destructive rewindA deleted/changed secret survives in document history, another owner enumerates revisions, or restore overwrites a newer edit and erases evidenceSame owner scope as current reads; bounded snapshot/page retention; schema revalidation; exact revision cursor; expected current version/deletion state; append-only compensating restore; unconditional history purge in sanitized previewsChoose retention for data sensitivity, keep app SQLite/backups private, expose history actions only to intended roles, and redact secrets before writing them as ordinary document fields
Pull-request deployment identity abuseCommit a broad token, replay a workflow JWT, rename/recycle a repository, substitute a workflow or target branch, target production or another pull request, or run untrusted code in the control planeGitHub Actions OIDC with fixed issuer/JWKS and RS256, exact HTTPS audience, immutable repository ID plus name, workflow path/SHA, trusted cleanup ref, event/ref/time checks, hashed one-time JWT ID, 15-minute pull-N token, production/sibling denial, cleanup revocation, isolated-runtime gate, pinned actions, secretless workflowsProtect GitHub administrators and trusted-base workflow review, keep pull-request runtimes isolated, monitor exchange audit, and accept that fork policy may withhold OIDC
Traffic quota bypass or privacy leakRace monthly admission, route around ingress, stream undeclared bytes, or turn usage dimensions into request/user trackingImmediate SQLite admission transaction, fixed workspace/project/month rows, metadata-minimal policy input, fail-closed decisions, bounded retention, explicit known-transfer semanticsKeep app ports private; enforce edge connection/body/response/DDoS limits; do not treat known transfer as total egress or a monetary record
Billing entitlement forgery or replayForge checkout, substitute an account/plan/Price, replay or reorder a webhook, future-date state, use a project token to inspect billing, or turn cancellation into destructive deletionBrowser-only CSRF checkout/portal, durable attempt and session binding, exact provider/customer/subscription/plan identity, fixed-origin bounded Stripe adapter, raw-body HMAC and delivery-time validation, live/test separation, event digest replay/conflict ledger, monotonic subscription state, account-token scope checks, fail-closed snapshots, non-destructive admissionProtect provider keys/dashboard/webhook configuration, test tax/refund/dispute flows, monitor delivery failures, review operator grants, and meet business/legal billing obligations
Queue inspectionJob payloads, results, exception text, owner/group identity, worker or lease credentials copied into the control planeAllowlisted metadata-only reads, bounded responses, presence-only error flags, conditional RBAC mutations, payload-free audit/eventsKeep detailed diagnostics in private app telemetry; review operator access
Secret disclosureAPI response/log leak, filesystem exposure, package publicationAES-GCM, no secret reads, recursive log redaction, private umask, npm package auditKMS, rotation, OS/operator access, provider logging
SSRF/proxy confusionAttacker-chosen upstream, scheme-relative path, duplicate host, hop-header smugglingLoopback/allowlist upstreams, target origin assigned before path, exact unique hosts, Connection-nominated header stripping, manual redirectsNetwork egress policy and trusted DNS/TLS edge
Domain/certificate takeoverReassign pending hostname, spoof TXT, route elsewhere, trigger certificates for arbitrary SNIExact random TXT proof, immutable cross-project assignment, separate routing state, reserved namespaces, indexed TLS allow check restricted to deployed sitesPrivate edge link, CAA/ACME policy, certificate storage and CA monitoring
Worker split brainExpired worker completes after reassignmentAuthenticated leases, monotonic fences, idempotent durable operationsHighly available backing store and supervisor integration
Runner enrollment theft or replayReuse a provisioning link, enroll the wrong region, race a legitimate node, or use a CLI token as operator authorityBrowser-only recent-auth administrator creation, CSRF, exact node/region binding, high-entropy digest-only token, expiry, transactional reservation, single-use commit, active-token cap, credential rotation, secret-free auditDeliver the one-time token through a trusted channel, remove it after enrollment, edge-rate-limit the coordinator, and protect runner hosts
Provider bridge takeoverSteal a provider token, replay a reconcile, downgrade a generation, smuggle a release/runtime, or leak a provider errorSeparate high-entropy bearer, HTTPS/private-network guidance, fixed protocols, strict headers, bounded binary body, fresh artifact/capsule validation and desired-state binding, no coordinator credentials, durable operation/generation/fence state, generic errorsRotate/scoped provider tokens, network admission, provider audit and isolation
Docker client environment injectionName an application secret DOCKER_HOST, LD_PRELOAD, or another process/transport control so the host-side launch client executes or connects under application influenceDocker CLI inherits one inert encoded runtime envelope rather than application-named variables; the in-container Node bootstrap decodes and deletes it before application import; executable/PATH/HOME remain operator-controlled; values stay out of argumentsProtect the Docker socket and runner host, restrict who can change runner configuration, and treat privileged host/container administrators as trusted
Provider container escape or secret persistenceEscape a shared container boundary, inspect another tenant, leave an old process reachable after provider restart, or persist a capsule secret in Docker configurationImmutable image digest by default, read-only exact release/root, project-only writable data, non-root uid/gid, dropped capabilities, no-new-privileges, CPU/memory/PID/tmpfs/log limits, loopback-only web publish, stdin-only post-loader environment delivery, exact owner labels, verified orphan removal, no process adoption, close-race fencingDocker daemon/kernel/provider host remain trusted; protect the socket, enforce egress/tenant network and disk policy, use rootless/user namespaces and LSM/seccomp, patch promptly, and move hostile tiers to dedicated VMs or microVMs
Remote ingress confusionSend public traffic to an old generation, spoof provider binding headers, escape a provider route with a scheme-relative/encoded traversal path, race activation/authentication or a late response, or expose its route tokenExact desired/observed release-generation-node activation, allowlisted HTTPS edge origin/path, overwritten binding headers, provider-side exact project/protocol/generation/token-digest validation, loopback-only target, pre-auth request lease, overlapping generations, revoke-before-drain, generation-scoped/race-fenced circuits, reserved header stripping, generic failuresKeep the provider hop private and application ports unreachable; drill node outage and route revocation, and do not bypass managed ingress
Runtime placement disclosureCache or log a capsule, expose secret values in headers/errors, substitute another project's data, or place data on a compromised hostExact current node/operation lease, canonical operation selection, post-load lease recheck, whole/section SHA-256, strict project/release/generation binding, no-store binary bodies, secrets only in the body, generic failuresProvider hosts are trusted application compute; require private TLS transport, host isolation, provider log suppression, backup/restore drills, and secret rotation after compromise
Provider diagnostics disclosure or confusionRead another generation's output, return forged resource totals, expose Docker/container/environment identity, infer cross-project activity from shared capacity, or grow diagnostics memory/body without boundSeparate generation-derived control token, exact running state, private allowlisted origin, no redirects/encoding, strict response identity/schema/aggregate checks, post-transfer placement recheck, 128 KiB/1,000-entry memory tail, 512 KiB body cap, no container IDs/paths/environment, configured-secret redaction, exact shared filesystem capacity restricted to platform-administrator browser sessionsApplications must not log unregistered secrets or personal data; protect the provider TLS hop and Docker logs; use infrastructure telemetry for historical data
Provider job disclosure or stale mutationRead payloads/errors from another tenant or generation, operate a replaced database, smuggle fields through a provider response, or race a worker transitionGeneration-derived control token, private allowlisted origin, lifecycle serialization, project-root path confinement, read-only inspection, strict length/media/identity/schema checks, post-transfer placement recheck, conditional SQLite writes, payload-free responses/events/auditProtect provider TLS and node access; use application-authorized logs for error detail; retry only the fixed current-generation failure
Runner overcommit or unsafe data failoverConcurrent placement exceeds a node, a heartbeat lowers capacity below assigned work, a network partition leaves the old SQLite writer alive, or node-local data is silently activated elsewhereTransactional process-slot reservation, durable per-placement demand, required capability/region checks, capacity-shrink rejection, portable-only automatic reassignment, stateful pinning, browser-admin/recent-auth recovery, exact revoked source and backup confirmation, two risk acknowledgements, verified encrypted recovery point, old-ingress removal, higher-generation target observation, auditPhysically or network-fence the source before affirming recovery; revocation only fences Clank credentials. Size slots for real CPU/memory limits, keep recovery objects in a separate failure domain, and drill stateful node recovery
Provider lifecycle reordering or stale replayStart background effects before data commit, restore SQLite beneath a live candidate, publish before complete health, replay an old fence, or substitute an operation/capsule at one generationCapsule rehash/decode before durable intent, exact operation/generation/fence state, drain-before-stop, candidate cleanup before rollback, journal retention when cleanup is uncertain, deferred workers/scheduler, ingress-last activation, exact idempotent retryOne writer per provider root, stateful node pinning, encrypted independent backups, restore/deletion drills, and application-level idempotency for unavoidable startup/external effects
Provider data corruptionCrash between database/metadata writes, change a stored path, replace another project, follow a storage link, or lose rollback bytes during cleanupIndependent capsule/desired binding, per-project state, exact scoped metadata, owner-only real paths, SQLite integrity checks, apply/rollback journals, atomic state commit, one referenced safety snapshot, explicit confirmationsDurable disks, filesystem/operator security, encrypted independent backups, and restore drills
Application job duplicationWorker performs a remote effect, then times out or crashes before recording successTransactional enqueue, renewable random-token leases, stale-settlement fencing, bounded retry/dead letter, deterministic cron keys, rollout quiescingIdempotent handlers/provider keys, cooperative aborts, shared durable volume, queue monitoring
Durable-object retry or storage abuseReuse an expired key, replay a prior incarnation's result, force cleanup across another namespace, hide a committed result behind maintenance failure, or create unbounded attacker-selected IDs and retry recordsExact retention lookup, lifecycle-cleared ledgers, namespace-scoped best-effort cleanup, atomic state/result commit, tombstone-accounted namespace ceilings, per-object retry ceilings, UTF-8-bounded diagnostics, renewable leases, and revision fencingAuthorize exact object IDs, rate-limit public creation, use provider idempotency for external effects, monitor capacity, and keep state on one durable SQLite placement
Workflow graph drift or confused dependencyA new release reinterprets an active graph, a step reads an undeclared result, duplicate reconcilers enqueue twice, or failed siblings continueRevision-bound graph/schema/mapper contract; explicit acyclic edges; transactionally idempotent step enqueue; owner-scoped start keys; fail-closed propagation and child cancellation; bounded durable run/step/event stateKeep step side effects idempotent, expose starts through authorized mutations, review graph changes like migrations, and monitor failed retained runs
Browser journey credential or navigation abuseAn agent embeds a password, escapes the application origin, attaches to a remote debugging endpoint, records private field values, or supplies executable test dataEnvironment-only secret references; literal password denial in the Chrome driver; same-origin navigation; loopback-only CDP; isolated sandboxed browser profiles; bounded steps, files, waits, reports, DOM inspection, and exception text; value/query redaction; owner-only atomic artifactsUse synthetic least-privilege test accounts, protect CI environment variables and artifacts, review trusted JavaScript journey modules, and keep Chrome patched
Blueprint registry substitution or rollbackReplace a reusable app plan, publish under another owner, serve an older catalog, redirect installation, escape the registry path, smuggle executable configuration, or leak a signing keySeparate Ed25519 publisher/registry roles; exact namespace/origin scopes; normalized data-only blueprint; canonical signed metadata and SHA-256 digests; exact SemVer without tags; explicit revocations and minimum sequences; same-origin traversal-safe paths; bounded no-redirect JSON; full re-verification before ordinary generationBootstrap trust out of band, protect offline private keys, persist highest accepted sequence, update revocations, secure registry TLS/DNS/availability, and still review generated product behavior
Collaboration room escape or presence abuseA signed-in user joins another document, reuses another participant's connection ID, sends cross-site updates, floods cursors, or places private data in presenceExact-room authorization on every request; private principal binding; random connection IDs that are not authorization; existing CSRF verification; same-origin and Fetch Metadata checks; bounded rooms/connections/data/depth/rate/idle leases; no-store transport; aggregate-only diagnosticsKeep authorization object-specific, never place secrets or hidden records in peer-visible presence, use sticky routing or a reviewed shared adapter for multi-process presence, and persist important state through backend mutations
Product analytics identity or inference leakRecord personal content as event properties, bypass consent, recover a raw subject, isolate one person's behavior in a time bucket, retain data forever, or exhaust app storageAggregate-safe finite schemas; explicit consent and DNT; domain-separated HMAC pseudonyms; no raw-event read API; unique-subject cohort suppression; bounded range/buckets/funnel scans/retention/capacity; subject erasure; memory-only browser queueStore consent authoritatively, rate-limit same-origin ingestion, protect and retain the analytics HMAC secret, include backups in erasure policy, and expose only role-appropriate aggregate queries
Backup tampering or omissionCiphertext/catalog/manifest alteration, incomplete object promotion, duplicate schedulers, missed recovery point, restore wrong copyAES-GCM envelope, catalog and manifest HMAC, bounded chunk SHA-256, durable leased scheduling, local fallback, repository binding, bounded retention, explicit confirmationMonitoring, separate key custody, independent object repository, restore drills
Object-storage compromiseRedirect credentials, alter stored bytes/metadata, return an oversized body, reinterpret an old release through a new bucket, reuse broad bucket authority, or delete another environment's objectsHTTPS origin validation, SigV4 signed payload/headers, redirect refusal, strict content-addressed keys, persisted repository identity, independent bounds and SHA-256, generic errors, optional namespace prefixBucket-scoped credentials/policy, environment separation, provider audit/retention, client-side encryption, growth/integrity alerts, retry monitoring across the external/local cleanup boundary
Managed-bucket escape or upload abuseChoose another owner, forge/replay an upload URL, race quota, spoof an image type, replace a current object with a partial generation, enumerate private storage keys, or retain abandoned uploadsAuth/OAuth-derived owner only; CSRF/origin-gated management; operation/resource/owner/expiry-bound HMAC capabilities; transactional active-plus-reserved project/bucket/owner quotas; offset-locked resumable staging; signature/dimension/type/length/SHA checks; immutable generation swap; opaque public IDs; startup/pre-reservation expiry sweepKeep signing and S3 credentials private, use private visibility for controlled content, add edge request/rate limits, configure a reviewed image transformer, back up catalog and bytes together, and monitor storage growth/orphans
Destructive project actionStolen scoped token, developer error, path substitution, partial site deletionOwner/admin account principal, scoped-token denial, CSRF, exact slug confirmation, separate data-loss acknowledgement, durable lock, derived symlink-safe paths, token revocation, retained audit eventAccount-token protection, off-platform copy deletion, legal retention policy, deletion drills
Audit repudiation or tenant disclosureHide a destructive event, read another workspace, reuse stale elevated scopeNon-cascading organization attribution, current membership/role joins, project-token intersection, bounded cursor pagination, no audit mutation API, deleted-target retentionTrusted SQLite admins can alter local rows; replicate or sign events independently when operator tampering is in scope
Supply-chain compromiseMutable CI action, leaked npm token, package includes local stateCommit-pinned actions, least privilege, OIDC trusted publishing, attestation, package allowlist, zero dependenciesGitHub/npm account security and protected release environment
Compiler boundary confusionTreat attacker-controlled data as TSX source or assume generated code is sandboxedCompiler accepts project source only, performs no build-time evaluation, and emits reviewable modulesNever compile request/database values; isolate mutually untrusted app execution
Denial of serviceChunked oversized request, CBOR/artifact bomb, repeated retained releases, scrypt/device-code exhaustion, high-cardinality limiter keys, failing upstream, unbounded metric labels, site/domain exhaustionStreaming byte/count/time bounds, CBOR depth/collection limits, per-project artifact count/byte ceilings, password queue, bounded durable auth and traffic rate-limit state, circuits, transactional monthly quotas, fixed-cardinality metrics, leases/retriesEdge rate limits, whole-volume monitoring, compute quotas, autoscaling, capacity planning

Explicit assumptions

  • The operating-system administrator and master-key holder are trusted.
  • The process runner executes trusted applications. Use Docker or stronger isolation for mutually untrusted deployers.
  • TypeScript and TSX files are trusted executable application source. The compiler is not a sanitizer for attacker-controlled data.
  • OAuth authenticates the approving user and client grant; it does not make model-generated tool arguments trustworthy.
  • TLS termination, certificate/key custody, ACME issuer policy, DDoS protection, WAF rules, and public network policy are external to the core package. Clank only decides hostname eligibility.
  • An application process can read its own decrypted environment and database.
  • SQLite is a strong single-node transactional default, not a globally replicated database.
  • External drivers are trusted only to the authority represented by their narrowly scoped token and endpoint.

Review triggers

Repeat this threat review when adding a credential type, raw HTML path, file parser, public protocol, proxy rule, external provider, database engine, runner, multi-node coordinator, privileged role, destructive action, or release channel.