fix(coolify): strip is_build_time from env writes; add reveal + GCS
Coolify v4's POST/PATCH /applications/{uuid}/envs only accepts key,
value, is_preview, is_literal, is_multiline, is_shown_once. Sending
is_build_time triggers a 422 "This field is not allowed." — it's now
a derived read-only flag (is_buildtime) computed from Dockerfile ARG
usage. Breaks agents trying to upsert env vars.
Three-layer fix so this can't regress:
- lib/coolify.ts: COOLIFY_ENV_WRITE_FIELDS whitelist enforced at the
network boundary, regardless of caller shape
- app/api/workspaces/[slug]/apps/[uuid]/envs: stops forwarding the
field; returns a deprecation warning when callers send it; GET
reads both is_buildtime and is_build_time for version parity
- app/api/mcp/route.ts: same treatment in the MCP dispatcher;
AI_CAPABILITIES.md doc corrected
Also bundles (not related to the above):
- Workspace API keys are now revealable from settings. New
key_encrypted column stores AES-256-GCM(VIBN_SECRETS_KEY, token).
POST /api/workspaces/[slug]/keys/[keyId]/reveal returns plaintext
for session principals only; API-key principals cannot reveal
siblings. Legacy keys stay valid for auth but can't reveal.
- P5.3 Object storage: lib/gcp/storage.ts + lib/workspace-gcs.ts
idempotently provision a per-workspace GCS bucket, service
account, IAM binding and HMAC key. New POST /api/workspaces/
[slug]/storage/buckets endpoint. Migration script + smoke test
included. Proven end-to-end against prod master-ai-484822.
Made-with: Cursor
This commit is contained in:
@@ -406,15 +406,25 @@ async function toolAppsEnvsUpsert(principal: Principal, params: Record<string, a
|
||||
);
|
||||
}
|
||||
await getApplicationInProject(appUuid, projectUuid);
|
||||
// Coolify v4 rejects `is_build_time` on POST/PATCH (it's a derived
|
||||
// read-only flag now). Silently drop it here so agents that still send
|
||||
// it don't get a surprise 422. See lib/coolify.ts upsertApplicationEnv
|
||||
// for the hard enforcement at the network boundary.
|
||||
const result = await upsertApplicationEnv(appUuid, {
|
||||
key,
|
||||
value,
|
||||
is_preview: !!params.is_preview,
|
||||
is_build_time: !!params.is_build_time,
|
||||
is_literal: !!params.is_literal,
|
||||
is_multiline: !!params.is_multiline,
|
||||
is_shown_once: !!params.is_shown_once,
|
||||
});
|
||||
return NextResponse.json({ result });
|
||||
const body: Record<string, unknown> = { result };
|
||||
if (params.is_build_time !== undefined) {
|
||||
body.warnings = [
|
||||
'is_build_time is ignored — Coolify derives build-vs-runtime from Dockerfile ARG usage. Omit this field going forward.',
|
||||
];
|
||||
}
|
||||
return NextResponse.json(body);
|
||||
}
|
||||
|
||||
async function toolAppsEnvsDelete(principal: Principal, params: Record<string, any>) {
|
||||
|
||||
Reference in New Issue
Block a user