@fern-api/fdr-sdk 1.1.7-45ebcd86eb → 1.1.7-97cbb284fe

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2493,9 +2493,36 @@ import { OpenAPILink as OpenAPILink5 } from "@orpc/openapi-client/fetch";
2493
2493
  // src/orpc-client/docs/v2/library-docs/contract.ts
2494
2494
  import { oc as oc5 } from "@orpc/contract";
2495
2495
  import * as z13 from "zod";
2496
+ var ALLOWED_HOSTNAMES = /* @__PURE__ */ new Set(["github.com", "gitlab.com"]);
2497
+ var GithubUrlSchema = z13.string().url().describe(
2498
+ "HTTPS URL of a GitHub or GitLab repository. Currently only github.com and gitlab.com are supported. Must match the pattern https://github.com/<owner>/<repo> or https://gitlab.com/<owner>/<repo>."
2499
+ ).refine(
2500
+ (url) => {
2501
+ try {
2502
+ const parsed = new URL(url);
2503
+ if (parsed.protocol !== "https:") {
2504
+ return false;
2505
+ }
2506
+ if (!ALLOWED_HOSTNAMES.has(parsed.hostname)) {
2507
+ return false;
2508
+ }
2509
+ if (parsed.username || parsed.password) {
2510
+ return false;
2511
+ }
2512
+ return /^\/[\w.-]+\/[\w.-]+(?:\.git)?\/?$/.test(parsed.pathname);
2513
+ } catch {
2514
+ return false;
2515
+ }
2516
+ },
2517
+ { message: "Must be a valid https://github.com/<owner>/<repo> or https://gitlab.com/<owner>/<repo> URL" }
2518
+ );
2519
+ var SafeBranchSchema = z13.string().regex(/^[a-zA-Z0-9._/-]+$/, "Invalid branch name").nullish();
2520
+ var SafePackagePathSchema = z13.string().refine((p) => !p.includes("..") && !p.startsWith("/"), {
2521
+ message: "packagePath must not contain path traversal sequences"
2522
+ }).nullish();
2496
2523
  var LibraryDocsBaseConfigSchema = z13.object({
2497
- branch: z13.string().nullish(),
2498
- packagePath: z13.string().nullish(),
2524
+ branch: SafeBranchSchema,
2525
+ packagePath: SafePackagePathSchema,
2499
2526
  title: z13.string().nullish(),
2500
2527
  slug: z13.string().nullish()
2501
2528
  });
@@ -2506,13 +2533,13 @@ var CppLibraryDocsConfigSchema = LibraryDocsBaseConfigSchema.extend({
2506
2533
  var StartLibraryDocsGenerationInputSchema = z13.discriminatedUnion("language", [
2507
2534
  z13.object({
2508
2535
  orgId: z13.string(),
2509
- githubUrl: z13.string(),
2536
+ githubUrl: GithubUrlSchema,
2510
2537
  language: z13.literal("PYTHON"),
2511
2538
  config: PythonLibraryDocsConfigSchema.nullish()
2512
2539
  }),
2513
2540
  z13.object({
2514
2541
  orgId: z13.string(),
2515
- githubUrl: z13.string(),
2542
+ githubUrl: GithubUrlSchema,
2516
2543
  language: z13.literal("CPP"),
2517
2544
  config: CppLibraryDocsConfigSchema.nullish()
2518
2545
  })