refactor(tools): remove remaining arbitrary workflow caps
This commit is contained in:
@@ -51,14 +51,12 @@ export const parseBrowserScenarioPolicy = (
|
||||
env.REA_BROWSER_SCENARIO_CDP_ENDPOINTS_JSON,
|
||||
"REA_BROWSER_SCENARIO_CDP_ENDPOINTS_JSON",
|
||||
browserEndpointSchema,
|
||||
16,
|
||||
);
|
||||
if (!cdpEndpoints.ok) return cdpEndpoints;
|
||||
const allowedOrigins = parseBrowserArray(
|
||||
env.REA_BROWSER_SCENARIO_ALLOWED_ORIGINS_JSON,
|
||||
"REA_BROWSER_SCENARIO_ALLOWED_ORIGINS_JSON",
|
||||
browserOriginSchema,
|
||||
32,
|
||||
);
|
||||
if (!allowedOrigins.ok) return allowedOrigins;
|
||||
const allowedEnvironment = parseStringArray(
|
||||
|
||||
+5
-15
@@ -9,19 +9,13 @@ export const parseStringArray = (
|
||||
name: string,
|
||||
): Result<readonly string[], ConfigurationError> => {
|
||||
try {
|
||||
const parsed = z
|
||||
.array(z.string().min(1))
|
||||
.max(128)
|
||||
.safeParse(JSON.parse(encoded));
|
||||
const parsed = z.array(z.string().min(1)).safeParse(JSON.parse(encoded));
|
||||
return parsed.success
|
||||
? ok(parsed.data)
|
||||
: err(
|
||||
new ConfigurationError(
|
||||
parsed.error.issues.some(({ code }) => code === "too_big")
|
||||
? `${name} must encode at most 128 strings`
|
||||
: `${name} must encode an array of strings`,
|
||||
{ cause: parsed.error },
|
||||
),
|
||||
new ConfigurationError(`${name} must encode an array of strings`, {
|
||||
cause: parsed.error,
|
||||
}),
|
||||
);
|
||||
} catch (cause: unknown) {
|
||||
return err(new ConfigurationError(`${name} must be valid JSON`, { cause }));
|
||||
@@ -44,13 +38,9 @@ export const parseBrowserArray = (
|
||||
encoded: string,
|
||||
name: string,
|
||||
itemSchema: z.ZodType<string>,
|
||||
maximum: number,
|
||||
): Result<readonly string[], ConfigurationError> => {
|
||||
try {
|
||||
const parsed = z
|
||||
.array(itemSchema)
|
||||
.max(maximum)
|
||||
.safeParse(JSON.parse(encoded));
|
||||
const parsed = z.array(itemSchema).safeParse(JSON.parse(encoded));
|
||||
return parsed.success
|
||||
? ok([...new Set(parsed.data)].sort())
|
||||
: err(
|
||||
|
||||
@@ -71,14 +71,12 @@ const parseBrowserObservationPolicy = (
|
||||
env.REA_BROWSER_CDP_ENDPOINTS_JSON,
|
||||
"REA_BROWSER_CDP_ENDPOINTS_JSON",
|
||||
browserEndpointSchema,
|
||||
16,
|
||||
);
|
||||
if (!endpoints.ok) return endpoints;
|
||||
const origins = parseBrowserArray(
|
||||
env.REA_BROWSER_ALLOWED_ORIGINS_JSON,
|
||||
"REA_BROWSER_ALLOWED_ORIGINS_JSON",
|
||||
browserOriginSchema,
|
||||
32,
|
||||
);
|
||||
if (!origins.ok) return origins;
|
||||
if (env.REA_BROWSER_OBSERVE_ENABLED !== "true")
|
||||
|
||||
Reference in New Issue
Block a user