Skip to content

armgit / mso

Public Imported from GitHub
0

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.

fix(infra): allow bounded Dokploy public env values

Rahmanb9fe9b39d7d5
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index badc51aa..034e1f44 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -13,6 +13,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Fixed**
+- `infra` allow bounded Dokploy public env values
- `mcp` preserve compact integration headroom
- `infra` expose bounded Dokploy integration operations
- `infra` support modern pinned DNS lookups
diff --git a/lib/infra/connection-dispatch-public-env.test.ts b/lib/infra/connection-dispatch-public-env.test.ts
new file mode 100644
index 00000000..ca61eee7
--- /dev/null
+++ b/lib/infra/connection-dispatch-public-env.test.ts
@@ -0,0 +1,21 @@
+import { expect, it, vi } from "vitest";
+vi.mock("./clients", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("./clients")>();
+ return { ...actual, upsertDokployPublicBuildEnv: vi.fn(async (args) => ({ ...args, changed: true, redeployQueued: true })) };
+});
+vi.mock("./connection-service", async (importOriginal) => {
+ const actual = await importOriginal<typeof import("./connection-service")>();
+ return {
+ ...actual,
+ resolveIntegration: vi.fn(async () => ({ user:"alice",id:"default",source:"direct",authMethod:"direct",provider:"dokploy" })),
+ withIntegrationSelection: vi.fn(async (_selector, fn) => fn()),
+ };
+});
+const { executeIntegrationAction } = await import("./connection-dispatch");
+it("allows only the bounded public-env value seam", async () => {
+ await expect(executeIntegrationAction({user:"alice",provider:"dokploy",connection:"default",operation:"dokploy.application.publicEnv.upsert",confirm:true,arguments:{applicationId:"ABCDEFGH1234",key:"NEXT_PUBLIC_CONVEX_URL",value:"https://api.example.com"}})).resolves.toMatchObject({result:{changed:true}});
+ await expect(executeIntegrationAction({user:"alice",provider:"dokploy",connection:"default",operation:"dokploy.application.publicEnv.upsert",confirm:true,arguments:{applicationId:"ABCDEFGH1234",key:"NEXT_PUBLIC_X",value:"x",token:"secret"}})).rejects.toMatchObject({code:"invalid_tool_arguments"});
+});
+it("keeps secret-shaped value fields rejected for every other operation", async () => {
+ await expect(executeIntegrationAction({user:"alice",provider:"dokploy",connection:"default",operation:"dokploy.projects.list",confirm:true,arguments:{value:"x"}})).rejects.toMatchObject({code:"secret_input_forbidden"});
+});
diff --git a/lib/infra/connection-dispatch.ts b/lib/infra/connection-dispatch.ts
index 3b3f7aaf..d6241623 100644
--- a/lib/infra/connection-dispatch.ts
+++ b/lib/infra/connection-dispatch.ts
@@ -22,10 +22,15 @@ export async function manageIntegrationAction(raw:Record<string,unknown>){
return authorizeIntegration(identity(a.provider,"provider"),selectionFrom(a),{authConfigId:typeof a.authConfigId==="string"?identity(a.authConfigId):undefined,brokerConnection:typeof a.brokerConnection==="string"?identity(a.brokerConnection):undefined,createManaged:a.createManaged===true});
}
export async function executeIntegrationAction(raw:Record<string,unknown>){
- const a=safeActionInput(raw);metadataOnly(a);
+ const a=safeActionInput(raw),operation=String(a.operation);
+ if(operation==="dokploy.application.publicEnv.upsert"){
+ const {arguments:operationArgs,...meta}=a;metadataOnly(meta);
+ const args=operationArgs;if(!args||typeof args!=="object"||Array.isArray(args))throw new IntegrationError("invalid_tool_arguments");
+ if(Object.keys(args).some(k=>!["applicationId","key","value"].includes(k)))throw new IntegrationError("invalid_tool_arguments");
+ }else metadataOnly(a);
if(Object.keys(a).some(k=>!["user","provider","connection","operation","arguments","tool","confirm"].includes(k)))throw new IntegrationError("invalid_execution_fields");
const user=identity(a.user,"user"),provider=identity(a.provider,"provider"),connection=identity(a.connection,"connection"),selection={user,connection};
- const route=await resolveIntegration(provider,selection),operation=String(a.operation);
+ const route=await resolveIntegration(provider,selection);
if(operation==="route")return route;
if(operation==="verify")return withIntegrationSelection(selection,()=>{if(!isInfraProviderId(provider))throw new IntegrationError("unknown_provider");return doctorInfraProvider(provider);});
if(a.confirm!==true)throw new IntegrationError("confirmation_required",403);