@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.
@@ -2530,9 +2530,36 @@ var import_fetch5 = require("@orpc/openapi-client/fetch");
2530
2530
  // src/orpc-client/docs/v2/library-docs/contract.ts
2531
2531
  var import_contract8 = require("@orpc/contract");
2532
2532
  var z13 = __toESM(require("zod"), 1);
2533
+ var ALLOWED_HOSTNAMES = /* @__PURE__ */ new Set(["github.com", "gitlab.com"]);
2534
+ var GithubUrlSchema = z13.string().url().describe(
2535
+ "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>."
2536
+ ).refine(
2537
+ (url) => {
2538
+ try {
2539
+ const parsed = new URL(url);
2540
+ if (parsed.protocol !== "https:") {
2541
+ return false;
2542
+ }
2543
+ if (!ALLOWED_HOSTNAMES.has(parsed.hostname)) {
2544
+ return false;
2545
+ }
2546
+ if (parsed.username || parsed.password) {
2547
+ return false;
2548
+ }
2549
+ return /^\/[\w.-]+\/[\w.-]+(?:\.git)?\/?$/.test(parsed.pathname);
2550
+ } catch {
2551
+ return false;
2552
+ }
2553
+ },
2554
+ { message: "Must be a valid https://github.com/<owner>/<repo> or https://gitlab.com/<owner>/<repo> URL" }
2555
+ );
2556
+ var SafeBranchSchema = z13.string().regex(/^[a-zA-Z0-9._/-]+$/, "Invalid branch name").nullish();
2557
+ var SafePackagePathSchema = z13.string().refine((p) => !p.includes("..") && !p.startsWith("/"), {
2558
+ message: "packagePath must not contain path traversal sequences"
2559
+ }).nullish();
2533
2560
  var LibraryDocsBaseConfigSchema = z13.object({
2534
- branch: z13.string().nullish(),
2535
- packagePath: z13.string().nullish(),
2561
+ branch: SafeBranchSchema,
2562
+ packagePath: SafePackagePathSchema,
2536
2563
  title: z13.string().nullish(),
2537
2564
  slug: z13.string().nullish()
2538
2565
  });
@@ -2543,13 +2570,13 @@ var CppLibraryDocsConfigSchema = LibraryDocsBaseConfigSchema.extend({
2543
2570
  var StartLibraryDocsGenerationInputSchema = z13.discriminatedUnion("language", [
2544
2571
  z13.object({
2545
2572
  orgId: z13.string(),
2546
- githubUrl: z13.string(),
2573
+ githubUrl: GithubUrlSchema,
2547
2574
  language: z13.literal("PYTHON"),
2548
2575
  config: PythonLibraryDocsConfigSchema.nullish()
2549
2576
  }),
2550
2577
  z13.object({
2551
2578
  orgId: z13.string(),
2552
- githubUrl: z13.string(),
2579
+ githubUrl: GithubUrlSchema,
2553
2580
  language: z13.literal("CPP"),
2554
2581
  config: CppLibraryDocsConfigSchema.nullish()
2555
2582
  })