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 Baton build SHA metadata

Rahman3905164eb628
diff --git a/lib/infra/dokploy.test.ts b/lib/infra/dokploy.test.ts
index 411ea6a1..6a8e0826 100644
--- a/lib/infra/dokploy.test.ts
+++ b/lib/infra/dokploy.test.ts
@@ -19,8 +19,15 @@ describe("Dokploy public build environment editing", () => {
expect(upsertPublicEnvText("VITE_CONVEX_URL=https://api.example.com\n", "VITE_CONVEX_URL", "https://api.example.com").changed).toBe(false);
});
+ it("allows approved public release metadata without opening arbitrary server keys", () => {
+ expect(upsertPublicEnvText("BATON_BUILD_SHA=old\nAPI_SECRET=keep-private\n", "BATON_BUILD_SHA", "abc123")).toEqual({
+ changed: true,
+ env: "BATON_BUILD_SHA=abc123\nAPI_SECRET=keep-private\n",
+ });
+ });
+
it("refuses secret/server keys, multiline values, and ambiguous duplicate keys", () => {
- expect(() => upsertPublicEnvText("", "DATABASE_URL", "postgres://example")).toThrow(/only public browser/i);
+ expect(() => upsertPublicEnvText("", "DATABASE_URL", "postgres://example")).toThrow(/only public browser build variables or approved public release metadata/i);
expect(() => upsertPublicEnvText("", "NEXT_PUBLIC_VALUE", "one\ntwo")).toThrow(/invalid public environment value/i);
expect(() => upsertPublicEnvText("VITE_X=1\nVITE_X=2\n", "VITE_X", "3")).toThrow(/duplicate VITE_X/i);
});
diff --git a/lib/infra/dokploy.ts b/lib/infra/dokploy.ts
index 6b1d46c3..d83acfc0 100644
--- a/lib/infra/dokploy.ts
+++ b/lib/infra/dokploy.ts
@@ -67,7 +67,7 @@ export async function ensureDokployProject(name: string): Promise<{ projectId: s
const DOKPLOY_ID = /^[A-Za-z0-9_-]{8,80}$/;
-const PUBLIC_BUILD_ENV = /^(?:NEXT_PUBLIC_|VITE_|PUBLIC_|REACT_APP_|EXPO_PUBLIC_)[A-Z0-9_]+$/;
+const PUBLIC_BUILD_ENV = /^(?:BATON_BUILD_SHA|(?:NEXT_PUBLIC_|VITE_|PUBLIC_|REACT_APP_|EXPO_PUBLIC_)[A-Z0-9_]+)$/;
function dokployId(value: string, label: string): string {
const clean = value.trim();
@@ -120,7 +120,7 @@ function quotePublicEnvValue(value: string): string {
export function upsertPublicEnvText(source: string, key: string, value: string): { env: string; changed: boolean } {
const cleanKey = key.trim();
- if (!PUBLIC_BUILD_ENV.test(cleanKey)) throw new Error("only public browser build environment variables may be changed through this operation");
+ if (!PUBLIC_BUILD_ENV.test(cleanKey)) throw new Error("only public browser build variables or approved public release metadata may be changed through this operation");
const encoded = quotePublicEnvValue(value);
const lines = source.replace(/\r\n/g, "\n").split("\n");
const escaped = cleanKey.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");