mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
fix: Increase valid user-supplied URL length to 1024 (#12585)
* fix: Increase valid user-supplied URL length to 1024 * fix: Wrap URL length migration in a transaction Wrap the multi-column changeColumn operations in a transaction so a failure on any column rolls back the whole migration rather than leaving the database partially migrated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import { useTranslation, Trans } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
import { randomString } from "@shared/random";
|
||||
import { TeamPreference } from "@shared/types";
|
||||
import { WebhookSubscriptionValidation } from "@shared/validations";
|
||||
import type WebhookSubscription from "~/models/WebhookSubscription";
|
||||
import Button from "~/components/Button";
|
||||
import Input from "~/components/Input";
|
||||
@@ -229,6 +230,7 @@ function WebhookSubscriptionForm({ handleSubmit, webhookSubscription }: Props) {
|
||||
required
|
||||
flex
|
||||
pattern={isCloudHosted ? "https://.*" : "https?://.*"}
|
||||
maxLength={WebhookSubscriptionValidation.maxUrlLength}
|
||||
placeholder="https://…"
|
||||
label={t("URL")}
|
||||
error={
|
||||
@@ -238,7 +240,10 @@ function WebhookSubscriptionForm({ handleSubmit, webhookSubscription }: Props) {
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
{...register("url", { required: true })}
|
||||
{...register("url", {
|
||||
required: true,
|
||||
maxLength: WebhookSubscriptionValidation.maxUrlLength,
|
||||
})}
|
||||
/>
|
||||
<Input
|
||||
flex
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import { z } from "zod";
|
||||
import { WebhookSubscriptionValidation } from "@shared/validations";
|
||||
import env from "@server/env";
|
||||
import { WebhookSubscription } from "@server/models";
|
||||
import { BaseSchema } from "@server/routes/api/schema";
|
||||
|
||||
const webhookUrl = z
|
||||
.url()
|
||||
.max(WebhookSubscriptionValidation.maxUrlLength, {
|
||||
error: `Webhook url must be ${WebhookSubscriptionValidation.maxUrlLength} characters or less`,
|
||||
})
|
||||
.refine((val) => !env.isCloudHosted || val.startsWith("https://"), {
|
||||
error: "Webhook url must use https",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user