cipherstash/stack/stash-managed-platforms

Claude Code and agent skill by cipherstash/stack

Trust tier 2
  • community
  • ext:[{"type":"plugin","description":"Custom plugin integration"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Implement CipherStash encryption on a managed AI app platform — Lovable, v0, Bolt, Replit, and anything else with no developer-controlled shell, an edge/Workers runtime, a database role that is not `postgres`, and schema changes only through the platform's own migration tool. Covers the one fact that decides whether the product works there at all (use `@cipherstash/stack` with the `wasm-inline` entry — `@cipherstash/protect` is the deprecated predecessor and its native module will not load), ru…

Install

npx vskill@latest install cipherstash/stack/stash-managed-platforms

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as cipherstash/stack/stash-managed-platforms.

CipherStash on Managed AI App Platforms

Read this first: it does work here

If you are on Lovable, v0, Bolt, Replit, or a similar hosted builder, and you have found @cipherstash/protect and inferred from its @cipherstash/protect-ffi dependency that CipherStash needs a native Rust addon and therefore cannot run on an edge runtime — that inference is about the wrong package.

  • `@cipherstash/stack` is the current package. Import the @cipherstash/stack/wasm-inline entry. It carries the WASM build of the same engine as a base64 blob inside the JS: no native binding, no separate .wasm fetch, nothing for a bundler to externalise, no --allow-ffi.
  • `@cipherstash/protect` is the deprecated predecessor. Its native FFI will not load in a Worker or an Edge Function. Do not install it, and do not use it to decide what the product can do.

An agent working on one of these platforms previously spent a full turn concluding CipherStash was impossible in a Lovable project before finding stash and the WASM entry. Nothing about that conclusion was true. Everything below is the rest of what that turn had to discover.

The stash-edge skill is the full guide to the WASM entry (per-runtime import specifiers, the client surface, how one schema module is shared across both entries). This page covers what is specific to managed platforms.

When to Use This Skill

Use it when the environment has any of these four properties — they travel together and each one changes the setup:

  1. No shell the developer controls. Commands run in an ephemeral sandbox, or not at all.
  2. An edge / Workers runtime for server code.
  3. A database role that is not `postgres` and is not a member of it (Lovable's is sandbox_exec).
  4. Database changes only through the platform's migration tool, not a psql session.

Do not use it for a normal Node deployment on a VM or a container — that is stash-deployment.

The CLI authenticates headlessly. Use it.

The most common wrong turn after the WASM one is assuming the CLI cannot log in without a browser on the machine, and reaching for a raw EQL .sql release asset instead. The device flow is designed for exactly this case.

bash
stash auth login --json --region us-east-1

--json emits newline-delimited JSON on stdout, one object per line, and deliberately does not open a browser — the human opens the URL, not the agent's host. The first event, authorization_required, carries verificationUri / verificationUriComplete and a userCode; print it and ask the person to approve it. Credentials are written to ~/.cipherstash, which exists fine inside a sandbox.

Three things to get right:

  • `--region` is required in a non-TTY. Without it (or STASH_REGION) the region picker cannot render and the command exits region_required. stash auth regions --json lists the valid slugs.
  • After printing `authorization_required` the command blocks, polling until approval or expiry (~900 s). Run it as a background task with a generous timeout — do not treat the pause as a hang.
  • Authenticate before `stash init`. An unauthenticated init tries to start a login of its own.

Then drive everything else through the CLI: stash manifest --json is the authoritative command surface, and --json modes exist on the commands an agent needs. Never cat anything under ~/.cipherstash — the CLI reads it for you, and its contents are secrets.

Deployment credentials: stash env

The four CS_* variables a deployed app needs are minted in one command:

bash
stash env --name my-app-prod --write .env.production.local

--name is required in a non-interactive run. Without --write the dotenv block goes to stdout and progress UI goes to stderr, so redirecting into a file or piping into a secret store is safe. With --write the file is mode 0600, and an existing file is refused non-interactively rather than silently overwritten. The access key is shown exactly once.

Put those four values into the platform's backend-secrets UI. That is the whole story on these platforms and it works as-is — stash-auth is canonical for what each variable is and how the strategies use them.

The database role is not postgres, and that is fine

stash eql install completes as a non-postgres role. Only three owner-scoped ALTER DEFAULT PRIVILEGES FOR ROLE postgres statements are skipped, and they are optional: they cover EQL objects postgres might later create outside stash tooling, and stash re-grants every object on each install and upgrade. The CLI prints the skipped statements under "Optional SQL — requires postgres" for an operator who wants to apply them another way.

Check before you install, and pass the report to the human rather than guessing:

bash
stash eql preflight --json

It reports current_user, superuser, membership of postgres (never blocking), CREATE on the database and on public, pgcrypto presence and placement, whether the role can create an operator class, and whether the EQL schemas already exist. Each blocked row names the statement it blocks. Exit 1 means a genuine blocker.

Two of its answers change what you write afterwards:

  • `ORE operator class: not creatable` — declare ordered columns types.*Ord, never types.*OrdOre. See the capability matrix in stash-encryption; the short version is that the ORE domains get an always-raising CHECK on such a database, so writes to them fail.
  • `pgcrypto` outside `extensions` / `public` aborts the bundle for any role, superuser included.
Getting the SQL applied through the platform's migration tool

Where you cannot hold a connection open — or where the platform replays a migrations directory and would wipe a direct install — generate a migration instead of installing:

bash
stash eql migration --supabase # writes into supabase/migrations/
stash eql migration --drizzle # a Drizzle custom migration

On a Supabase-backed platform this is the only durable option: supabase db reset replays supabase/migrations/ and discards anything a direct eql install did. The generated Supabase migration wraps the owner-scoped statements in a pg_has_role guard, so it applies cleanly whatever role the platform's migration runner uses — a non-member role skips them instead of aborting the whole migration.

Then commit the migration through the platform's Git sync and let its own migrate step apply it.

When the platform caps command time

Some platforms kill any command after a fixed ceiling (Lovable: 600 seconds). The EQL v3 bundle is ~2.6 MB / ~6,300 SQL statements, and psql -f sends one statement per protocol round trip — over a pooled connection that is tens of milliseconds each, which blows past the ceiling and kills the install partway, leaving schemas and domains created but functions and operators missing. Retrying the same command hits the same wall.

  • Prefer stash eql install or the generated migration over replaying the raw bundle with

psql -f.

  • If you must apply raw SQL under a ceiling, split the bundle at top-level statement boundaries

(dollar-quote aware) into chunks of well under 128 KB and apply each chunk as a single command (psql -c "<chunk>") — one round trip per chunk instead of per statement. ~27 chunks applies in seconds.

  • Cleaning up a half-install may fail with ownership errors: the broken objects are owned by the

platform's app role, not postgres. Grant the app role to the cleaning role (e.g. GRANT sandbox_exec TO postgres on Lovable) before dropping and re-applying.

Grant the Data API roles after installing

The EQL install grants nothing to Supabase's PostgREST roles. Every function-form call from the Data API — including a SECURITY INVOKER RPC that wraps EQL predicates — fails with a permission error until you run, as part of the same migration:

sql
GRANT USAGE ON SCHEMA eql_v3 TO authenticated, anon, service_role;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA eql_v3 TO authenticated, anon, service_role;

GRANT ... ON ALL FUNCTIONS covers only the functions that exist when it runs — a later stash eql upgrade that adds functions is not covered. Re-run the grants after every upgrade, or make them durable up front with ALTER DEFAULT PRIVILEGES IN SCHEMA eql_v3 GRANT EXECUTE ON FUNCTIONS TO authenticated, anon, service_role; (run as the role that performs the installs).

Fresh releases are blocked by install cooldowns

Managed platforms and modern runtimes ship supply-chain guards that refuse packages published within the last ~24 hours: Lovable sets minimumReleaseAge in bunfig.toml, Deno ≥ 2.9 has --minimum-dependency-age. Installing a CipherStash release on its publish day fails with a "version too new" style refusal, not a helpful message. Add the packages to the platform's exclude list (minimumReleaseAgeExcludes in bunfig.toml: @cipherstash/stack, @cipherstash/eql, @cipherstash/protect-ffi) — and say in your report that you relaxed a supply-chain guard to do it. If you can wait a day, wait instead.

What survives PostgREST

If the app talks to the database through Supabase's Data API rather than a Postgres connection, the predicate surface is narrower than the type surface. Agents guess wrong in both directions on this, so take it from the table:

Through PostgRESTWorks?
eq, neq, in, match()✅ — the adapter encrypts each filter value with the full storage path
gt, gte, lt, lte✅ on range-capable domains (*_ord, text_search)
order()✅ on OPE-backed ordering columns only (*_ord, text_ord, text_search)
matches() — encrypted free-text❌ needs @@ with an eql_v3.query_* cast PostgREST cannot emit
encrypted contains() / selectorEq() / selectorNe()❌ needs an eql_v3.query_json cast, likewise

The wrapper fails fast on the unsupported ones rather than silently returning wrong rows. Do not reach for like / ilike / raw cs as substitutes — they are not equivalent and will not match encrypted data.

When you need free-text or encrypted-JSON predicates, the query has to go through something that can emit a cast: Drizzle, Prisma Next, or hand-written SQL in an RPC (stash-postgres has the raw forms). stash-supabase is canonical for the adapter's full behaviour, including the security note about filter operands travelling in GET query strings.

encryptedSupabase in a Worker: declare your schemas

The rule: declare your schemas and it runs anywhere; omit them and we discover them for you, which needs a database connection and is therefore Node-only.

By default encryptedSupabase derives every column's encryption config by introspecting the database, which needs a Postgres connection — unavailable in a Worker or an Edge Function. Passing schemas skips introspection entirely, so there is nothing left to connect to:

typescript
import { encryptedSupabase } from '@cipherstash/stack-supabase/wasm-inline'
// Either entry may author these: `@cipherstash/stack/eql/v3` and
// `@cipherstash/stack/wasm-inline` resolve one declaration of the column
// classes, so `schemas` accepts both. The engine is WASM either way.
import { encryptedTable, types } from '@cipherstash/stack/eql/v3'
const users = encryptedTable('users', {
email: types.TextSearch('email'),
age: types.IntegerOrd('age'),
})
const supabase = await encryptedSupabase(supabaseClient, {
schemas: { users }, // no databaseUrl — nothing introspects
config: { workspaceCrn, accessKey, clientId, clientKey },
})

Three things must all be right, and each fails independently:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
156
Repository forks
7
7-day trend score
25

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • pluginCustom plugin integration

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/cipherstash/stack/stash-managed-platforms/badge)](https://verified-skill.com/skills/cipherstash/stack/stash-managed-platforms)

Something wrong with this skill or its page? Tell us.