Skip to content

Automate browser based workflows with AI

fix(persistent-sessions): final video sync budget must outlive the ffmpeg chain (SKY-10680) (#6519)

Celal Zamanoğlu9bdceef10184
diff --git a/skyvern-frontend/src/util/env.test.ts b/skyvern-frontend/src/util/env.test.ts
index 0d3d9dc44..004fc1ac4 100644
--- a/skyvern-frontend/src/util/env.test.ts
+++ b/skyvern-frontend/src/util/env.test.ts
@@ -1,6 +1,3 @@
-import { readFile } from "node:fs/promises";
-import path from "node:path";
-
import { afterEach, describe, expect, it, vi } from "vitest";
async function loadEnv(apiKey: string | null = null, streamingMode = "") {
@@ -47,53 +44,6 @@ describe("getCredentialParam", () => {
});
});
-describe("getRuntimeApiKey", () => {
- // Built via join so this test file never contains the sentinel verbatim
- // either — entrypoint-skyvernui.sh sed-replaces every occurrence in built
- // assets, and the source guard below must stay meaningful.
- const dockerSentinel = ["__SKYVERN_API_KEY", "_PLACEHOLDER__"].join("");
-
- afterEach(() => {
- vi.unstubAllEnvs();
- vi.resetModules();
- window.sessionStorage.clear();
- });
-
- it("returns the build-time API key", async () => {
- const { getRuntimeApiKey } = await loadEnv("eyJhbGciOiJIUzI1NiJ9.real.key");
-
- expect(getRuntimeApiKey()).toBe("eyJhbGciOiJIUzI1NiJ9.real.key");
- });
-
- it("treats the .env.example placeholder as missing", async () => {
- const { getRuntimeApiKey } = await loadEnv("YOUR_API_KEY");
-
- expect(getRuntimeApiKey()).toBe(null);
- });
-
- it("treats an un-replaced docker placeholder as missing", async () => {
- const { getRuntimeApiKey } = await loadEnv(dockerSentinel);
-
- expect(getRuntimeApiKey()).toBe(null);
- });
-
- // Regression guard for the v1.0.34–v1.0.40 docker auth outage:
- // entrypoint-skyvernui.sh sed-replaces EVERY occurrence of the docker
- // sentinel in the built bundle with the real API key. When the full
- // sentinel appeared verbatim in this module (inside the placeholder
- // deny-list), the real key replaced it there too, so the key became a
- // member of its own deny-list and the UI sent no x-api-key header at all
- // (403 "Invalid credentials" on every request).
- it("never spells out the full docker placeholder sentinel in module source", async () => {
- const source = await readFile(
- path.join(process.cwd(), "src/util/env.ts"),
- "utf-8",
- );
-
- expect(source.includes(dockerSentinel)).toBe(false);
- });
-});
-
describe("browserStreamingMode", () => {
afterEach(() => {
vi.unstubAllEnvs();
diff --git a/skyvern-frontend/src/util/env.ts b/skyvern-frontend/src/util/env.ts
index a76d2c5a6..1e85996e3 100644
--- a/skyvern-frontend/src/util/env.ts
+++ b/skyvern-frontend/src/util/env.ts
@@ -80,13 +80,12 @@ function getRuntimeApiKey(): string | null {
// Treat placeholder / example values as missing so they are never sent
// as real credentials (e.g. from .env.example or an un-replaced Docker placeholder).
- // The Docker sentinel is matched by its suffix on purpose: the prebuilt-image
- // entrypoint sed-replaces every occurrence of the full sentinel in the bundle
- // with the real API key, so spelling it out here would put the real key in its
- // own deny-list and strip the x-api-key header from every request.
- const isPlaceholder =
- candidate === "YOUR_API_KEY" || candidate?.endsWith("_PLACEHOLDER__");
- runtimeApiKey = candidate && isPlaceholder ? null : candidate;
+ const PLACEHOLDER_VALUES = [
+ "YOUR_API_KEY",
+ "__SKYVERN_API_KEY_PLACEHOLDER__",
+ ];
+ runtimeApiKey =
+ candidate && PLACEHOLDER_VALUES.includes(candidate) ? null : candidate;
return runtimeApiKey;
}