Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
feat(infra): add private Convex env presence checks
Rahman0e40cf6560ac
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex a18387a1..6c72beae 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Added**+- `infra` add private Convex env presence checks- `infra` add safe Dokploy deployment recovery- `infra` manage Convex Cloud custom domains safely- `infra` add bounded Dokploy public env rolloutdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex b6b3ee4d..3c7e6447 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -2799,3 +2799,8 @@ Screenshot evidence previously lived in unrelated scratch directories or only in- Added bounded deployment-history and redacted deployment-log reads for Dokploy applications, using the official `deployment.all` / `deployment.readLogs` APIs.- Added `dokploy.git.recover`: for an application currently configured as a Dokploy GitHub source, derive a public HTTPS GitHub URL only from its existing validated owner/repository metadata, preserve branch/build path/watch paths/submodule settings, verify the source became generic `git`, then queue one redeploy. No arbitrary Git/SSH URL input is accepted.- Internal provider diagnostics remain out of the compact MCP schema; only the bounded deployment list/log and recovery operations are exposed.++### 2026-09-06 — Convex environment presence checks+- Added `convex.env.presence`, a bounded deployment-admin read that accepts 1–32 exact environment variable names and returns only boolean presence for those requested names.+- The operation creates a short-lived deploy key scoped only to `deployment:env:view`, always revokes it, never returns environment values, and never exposes unrequested environment-variable names.+- Used the presence-only check to confirm CareerPack production has both `AUTH_GOOGLE_ID` and `AUTH_GOOGLE_SECRET`; therefore its custom `convexSite` remains non-canonical until the Google OAuth redirect URI is migrated.diff --git a/lib/infra/connection-dispatch.ts b/lib/infra/connection-dispatch.tsindex 4c067820..16052448 100644--- a/lib/infra/connection-dispatch.ts+++ b/lib/infra/connection-dispatch.ts@@ -3,7 +3,7 @@ import { integrationQuery, withIntegrationSelection, resolveIntegration } from "import { authorizeIntegration, composioConnectionCall } from "./connection-external";import { IntegrationError, identity, metadataOnly, type ConnectionSelector } from "./identity";import { importConvexCliPersonalConnection } from "./convex-cli-import";-import { listConvexCustomDomains, ensureConvexCustomDomain, getConvexCanonicalUrls, setConvexCanonicalUrl } from "./convex-cloud";+import { listConvexCustomDomains, ensureConvexCustomDomain, getConvexCanonicalUrls, setConvexCanonicalUrl, getConvexEnvPresence } from "./convex-cloud";import { doctorInfraProvider, ensureDokployProject, listDokployApplications, listDokployDeployments, readDokployDeploymentLogs, recoverDokployPublicGithubToHttpsGit, listDokployProjects, listCloudflareZones, upsertCloudflareDns, upsertDokployPublicBuildEnv, upsertHostingerDns, listHostingerMailOrders, getHostingerMailPlan, listHostingerMail, listHostingerMailLogs, mutateHostingerMail } from "./clients";import { isInfraProviderId } from "./catalog";export const safeActionInput=(input:Record<string,unknown>)=>Object.fromEntries(Object.entries(input).filter(([key])=>key!=="workflow_id"));@@ -47,6 +47,7 @@ export async function executeIntegrationAction(raw:Record<string,unknown>){"convex.customDomains.list":{provider:"convex-cloud",fields:["deploymentName"],run:()=>listConvexCustomDomains(String((args as Record<string,unknown>).deploymentName))},"convex.customDomain.ensure":{provider:"convex-cloud",fields:["deploymentName","domain","requestDestination"],run:()=>ensureConvexCustomDomain(args as {deploymentName:string;domain:string;requestDestination:"convexCloud"|"convexSite"})},"convex.canonical.get":{provider:"convex-cloud",fields:["deploymentName"],run:()=>getConvexCanonicalUrls(String((args as Record<string,unknown>).deploymentName))},+ "convex.env.presence":{provider:"convex-cloud",fields:["deploymentName","names"],run:()=>getConvexEnvPresence(args as {deploymentName:string;names:string[]})},"convex.canonical.set":{provider:"convex-cloud",fields:["deploymentName","requestDestination","url"],run:()=>setConvexCanonicalUrl(args as {deploymentName:string;requestDestination:"convexCloud"|"convexSite";url?:string|null})},"cloudflare.zones.list":{provider:"cloudflare",fields:[],run:()=>listCloudflareZones()},"cloudflare.dns.upsert":{provider:"cloudflare",fields:["name","type","content","ttl","proxied"],run:()=>upsertCloudflareDns(args as Parameters<typeof upsertCloudflareDns>[0])},diff --git a/lib/infra/convex-cloud.ts b/lib/infra/convex-cloud.tsindex 54cd33ef..aaad2bfa 100644--- a/lib/infra/convex-cloud.ts+++ b/lib/infra/convex-cloud.ts@@ -6,3 +6,5 @@ export {getConvexCanonicalUrls,setConvexCanonicalUrl,} from "./convex-canonical";++export { getConvexEnvPresence } from "./convex-env-presence";diff --git a/lib/infra/convex-env-presence.test.ts b/lib/infra/convex-env-presence.test.tsnew file mode 100644index 00000000..bee8d895--- /dev/null+++ b/lib/infra/convex-env-presence.test.ts@@ -0,0 +1,12 @@+import { afterEach, beforeEach, expect, it, vi } from "vitest";+import { promises as fs } from "node:fs";+import os from "node:os";+import path from "node:path";+const PAT="pat_synthetic_12345678901234567890",KEY="prod:happy-otter-123|synthetic_deploy_key_1234567890";+let root:string;+beforeEach(async()=>{root=await fs.mkdtemp(path.join(os.tmpdir(),"mso-convex-env-"));process.env.OS_INFRA_STORE=path.join(root,"infra.json");vi.resetModules();});+afterEach(async()=>{delete process.env.OS_INFRA_STORE;await fs.rm(root,{recursive:true,force:true});vi.resetModules();});+async function seeded(){const {integrationManage}=await import("./connection-manage");await integrationManage({action:"user.create",user:"alice",confirm:true});await integrationManage({action:"connection.create",user:"alice",provider:"convex-cloud",connection:"admin",authMethod:"personal",source:"direct",confirm:true});const {withIntegrationSelection}=await import("./connection-service"),{setInfraProvider}=await import("./store");await withIntegrationSelection({user:"alice",connection:"admin"},()=>setInfraProvider("convex-cloud",{personalToken:PAT}));return withIntegrationSelection;}+const json=(body:unknown,status=200)=>new Response(JSON.stringify(body),{status,headers:{"content-type":"application/json"}});+it("returns only requested presence booleans and always deletes the view-only key",async()=>{const withSelection=await seeded();let deleted=false;const fetchImpl=vi.fn(async(input:RequestInfo|URL,init?:RequestInit)=>{const url=String(input);if(url.endsWith("/create_deploy_key")){expect(JSON.parse(String(init?.body))).toMatchObject({allowedActions:["deployment:env:view"]});return json({deployKey:KEY});}if(url.endsWith("/list_environment_variables")){expect(new Headers(init?.headers).get("authorization")).toBe(`Convex ${KEY}`);return json({environmentVariables:{AUTH_GOOGLE_ID:"client-id-secret-value",OTHER_SECRET:"top-secret"}});}if(url.endsWith("/delete_deploy_key")){deleted=true;return json({});}return json({error:"unexpected"},500);});const {getConvexEnvPresence}=await import("./convex-env-presence");const result=await withSelection({user:"alice",connection:"admin"},()=>getConvexEnvPresence({deploymentName:"happy-otter-123",names:["AUTH_GOOGLE_ID","AUTH_GOOGLE_SECRET"]},fetchImpl));expect(result).toEqual({deploymentName:"happy-otter-123",presence:{AUTH_GOOGLE_ID:true,AUTH_GOOGLE_SECRET:false}});expect(JSON.stringify(result)).not.toContain("client-id-secret-value");expect(JSON.stringify(result)).not.toContain("OTHER_SECRET");expect(deleted).toBe(true);});+it("refuses broad or malformed name requests",async()=>{const {getConvexEnvPresence}=await import("./convex-env-presence");await expect(getConvexEnvPresence({deploymentName:"happy-otter-123",names:[]})).rejects.toMatchObject({code:"invalid_convex_env_names"});await expect(getConvexEnvPresence({deploymentName:"happy-otter-123",names:["BAD-NAME"]})).rejects.toMatchObject({code:"invalid_convex_env_names"});});diff --git a/lib/infra/convex-env-presence.ts b/lib/infra/convex-env-presence.tsnew file mode 100644index 00000000..5a805362--- /dev/null+++ b/lib/infra/convex-env-presence.ts@@ -0,0 +1,88 @@+import { randomUUID } from "node:crypto";+import { obj } from "./http";+import { IntegrationError } from "./identity";+import { readInfraProvider } from "./store";+import {+ convexAuthHeaders,+ convexCheckedJson,+ convexDeploymentName,+ convexDeploymentUrl,+ convexManagementUrl,+ type FetchLike,+} from "./convex-cloud-core";++const ENV_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;+function requestedNames(value: unknown): string[] {+ if (!Array.isArray(value) || value.length < 1 || value.length > 32)+ throw new IntegrationError("invalid_convex_env_names");+ const names = [...new Set(value.map((item) => (typeof item === "string" ? item.trim() : "")))];+ if (names.some((name) => !ENV_NAME.test(name)))+ throw new IntegrationError("invalid_convex_env_names");+ return names;+}+async function personalToken(): Promise<string> {+ const token = (await readInfraProvider("convex-cloud")).personalToken;+ if (!token) throw new IntegrationError("convex_personal_token_required", 409);+ return token;+}+export async function getConvexEnvPresence(+ input: { deploymentName: string; names: string[] },+ fetchImpl: FetchLike = fetch,+) {+ const deployment = convexDeploymentName(input.deploymentName),+ names = requestedNames(input.names),+ token = await personalToken(),+ keyName = `mso-env-presence-${randomUUID()}`;+ const created = obj(+ await convexCheckedJson(+ "convex_cloud",+ convexManagementUrl(deployment, "create_deploy_key"),+ {+ method: "POST",+ headers: convexAuthHeaders(token, "Bearer"),+ body: JSON.stringify({ name: keyName, allowedActions: ["deployment:env:view"] }),+ },+ fetchImpl,+ ),+ );+ const deployKey = created.deployKey;+ if (typeof deployKey !== "string" || deployKey.length < 20 || /[\x00-\x20\x7f]/.test(deployKey))+ throw new IntegrationError("invalid_convex_deploy_key_response", 502);+ let body: unknown, primary: unknown;+ try {+ body = await convexCheckedJson(+ "convex_deployment",+ convexDeploymentUrl(deployment, "list_environment_variables"),+ { method: "GET", headers: convexAuthHeaders(deployKey, "Convex") },+ fetchImpl,+ );+ } catch (error) {+ primary = error;+ }+ try {+ await convexCheckedJson(+ "convex_cloud",+ convexManagementUrl(deployment, "delete_deploy_key"),+ {+ method: "POST",+ headers: convexAuthHeaders(token, "Bearer"),+ body: JSON.stringify({ id: keyName }),+ },+ fetchImpl,+ );+ } catch {+ throw new IntegrationError(+ primary ? "convex_operation_and_ephemeral_cleanup_failed" : "convex_ephemeral_cleanup_failed",+ 502,+ );+ }+ if (primary) throw primary;+ const vars = obj(body).environmentVariables;+ if (!vars || typeof vars !== "object" || Array.isArray(vars))+ throw new IntegrationError("invalid_convex_environment_response", 502);+ const keys = new Set(Object.keys(vars));+ return {+ deploymentName: deployment,+ presence: Object.fromEntries(names.map((name) => [name, keys.has(name)])),+ };+}diff --git a/lib/mcp/tools-integrations.ts b/lib/mcp/tools-integrations.tsindex 8620945b..3e62dd86 100644--- a/lib/mcp/tools-integrations.ts+++ b/lib/mcp/tools-integrations.ts@@ -22,7 +22,7 @@ export const INTEGRATION_TOOLS:McpTool[]=[{name:"integration_execute",title:"Use an Exact Integration Connection",scope:"exec",annotations:{readOnlyHint:false,destructiveHint:true,openWorldHint:true},audit:{action:"infra.write",targetArg:"connection"},limit:{key:"integration.execute",max:30,windowMs:60000},description:"Execute using an explicit user/provider/named connection. Verify or inspect its route; bounded direct operations reject external backends. Composio tool execution requires an ACTIVE matching connected account and a toolkit-prefixed tool. Native-MCP returns the provider route without copying OAuth tokens. Non-verification operations require confirm=true. No credentials in arguments.",chatgptDescription:"Run one bounded named-integration operation.",- inputSchema:S({...BASE,operation:{type:"string",enum:["route","verify","dokploy.projects.list","dokploy.applications.list","dokploy.deployments.list","dokploy.deployment.logs","dokploy.git.recover","dokploy.application.publicEnv.upsert","dokploy.project.ensure","convex.customDomains.list","convex.customDomain.ensure","convex.canonical.get","convex.canonical.set","cloudflare.zones.list","cloudflare.dns.upsert","hostinger.dns.upsert","hostinger.mail.orders.list","hostinger.mail.plan.get","hostinger.mail.list","hostinger.mail.logs.list","hostinger.mail.mutate","composio.tool"]},confirm:{type:"boolean"},tool:{type:"string",maxLength:180},arguments:{type:"object",additionalProperties:true}},["user","provider","connection","operation"]),outputSchema:OUTPUT,+ inputSchema:S({...BASE,operation:{type:"string",enum:["route","verify","dokploy.projects.list","dokploy.applications.list","dokploy.deployments.list","dokploy.deployment.logs","dokploy.git.recover","dokploy.application.publicEnv.upsert","dokploy.project.ensure","convex.customDomains.list","convex.customDomain.ensure","convex.canonical.get","convex.env.presence","convex.canonical.set","cloudflare.zones.list","cloudflare.dns.upsert","hostinger.dns.upsert","hostinger.mail.orders.list","hostinger.mail.plan.get","hostinger.mail.list","hostinger.mail.logs.list","hostinger.mail.mutate","composio.tool"]},confirm:{type:"boolean"},tool:{type:"string",maxLength:180},arguments:{type:"object",additionalProperties:true}},["user","provider","connection","operation"]),outputSchema:OUTPUT,meta:{ui:{visibility:["model","app"]},"openai/widgetAccessible":true},run:async a=>({result:await executeIntegrationAction(a)}),},];