Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
change UI
Thiago Araujo da Silvaf24bc9017c2d
diff --git a/docs/documentation/platform/identities/machine-identities.mdx b/docs/documentation/platform/identities/machine-identities.mdxindex cbaba6e7fd..d6dcceea4f 100644--- a/docs/documentation/platform/identities/machine-identities.mdx+++ b/docs/documentation/platform/identities/machine-identities.mdx@@ -189,7 +189,7 @@ Each alert sends notifications to between 1 and 10 channels:| **Email** | Users and groups in your organization, up to 20 per channel. If someone joins a group after you add the group, they also get the notifications. || **Slack** | An [Incoming Webhook](https://api.slack.com/messaging/webhooks) URL that uses HTTPS and has the exact hostname `hooks.slack.com` || **PagerDuty** | An [Events API v2](https://developer.pagerduty.com/docs/events-api-v2-overview) integration key (a 32-character hex string). Infisical opens one incident per expiring credential, and adds repeated changes of the same kind to the same auth method to one open incident. |-| **Webhook** | An HTTPS URL, with an optional [signing secret](#verify-webhook-signatures), authentication (bearer token, basic auth, or API key header), and custom headers. If you change the URL, enter the credentials again, because Infisical only sends them to the URL they were saved with. |+| **Webhook** | An HTTPS URL, with an optional [signing secret](#verify-webhook-signatures), authentication (bearer token, basic auth, or API key), and custom headers. If you change the URL, enter the credentials again, because Infisical only sends them to the URL they were saved with. |### Webhook payloaddiff --git a/docs/documentation/platform/pki/applications/alerting/webhook-alerts.mdx b/docs/documentation/platform/pki/applications/alerting/webhook-alerts.mdxindex 34d57cfd1f..d62018fc26 100644--- a/docs/documentation/platform/pki/applications/alerting/webhook-alerts.mdx+++ b/docs/documentation/platform/pki/applications/alerting/webhook-alerts.mdx@@ -16,10 +16,10 @@ A webhook channel on a certificate [alert](/documentation/platform/pki/applicatiSelect **Add Channel** > **Webhook** and enter the **URL** of your endpoint. The URL must use HTTPS.</Step><Step>- Optionally, select **Add signing secret** and enter a secret, so your endpoint can [verify the signature](#verify-the-signature) of each request.+ If your endpoint requires authentication, under **Authentication**, select **Bearer token**, **Basic auth**, or **API key**, and enter the [credentials](#authentication) it expects.</Step><Step>- Optionally, select **Add authentication** and enter the [credentials](#authentication) your endpoint expects.+ Optionally, select **Add signing secret** and enter a secret, so your endpoint can [verify the signature](#verify-the-signature) of each request.</Step><Step>Optionally, select **Add header** to send [custom headers](#custom-headers) with each request.@@ -40,9 +40,9 @@ A channel can have one authentication method, which Infisical sends as a header|------|----------------|-----------------------------|| **Bearer token** | A token | `Authorization: Bearer <token>` || **Basic auth** | A username and a password | `Authorization: Basic <base64 of username:password>` |-| **API key header** | A header name, such as `X-API-Key`, and the key | `<header name>: <key>` |+| **API key** | A header name, such as `X-API-Key`, and the key | `<header name>: <key>` |-For an `Authorization` scheme other than `Bearer`, such as `GenieKey <key>`, select **API key header**, enter `Authorization` as the header name, and enter the full value, including the scheme.+For an `Authorization` scheme other than `Bearer`, such as `GenieKey <key>`, select **API key**, enter `Authorization` as the header name, and enter the full value, including the scheme.Infisical doesn't show saved credentials again. When you edit the channel, leave a field blank to keep its saved value. If you change the URL, enter the credentials again, because Infisical only sends them to the URL they were saved with.diff --git a/frontend/src/hooks/api/alerts/types.ts b/frontend/src/hooks/api/alerts/types.tsindex a43f9e2bde..0a446a4ca6 100644--- a/frontend/src/hooks/api/alerts/types.ts+++ b/frontend/src/hooks/api/alerts/types.ts@@ -29,6 +29,7 @@ export const WEBHOOK_AUTH_FIELDS: Record<WebhookAuthType,{label: string;+ description: string;name?: { field: "basicUsername" | "authHeaderName"; label: string; placeholder: string };secret: {field: "authCredentials" | "basicPassword" | "authHeaderValue";@@ -39,15 +40,18 @@ export const WEBHOOK_AUTH_FIELDS: Record<> = {[WebhookAuthType.Bearer]: {label: "Bearer token",+ description: "Sends the token as Authorization: Bearer <token>.",secret: { field: "authCredentials", label: "Token", hasSaved: "hasAuthCredentials" }},[WebhookAuthType.Basic]: {label: "Basic auth",+ description: "Sends the username and password as Authorization: Basic <credentials>.",name: { field: "basicUsername", label: "Username", placeholder: "Username" },secret: { field: "basicPassword", label: "Password", hasSaved: "hasBasicPassword" }},[WebhookAuthType.Header]: {- label: "API key header",+ label: "API key",+ description: "Sends the key in the header you name, such as X-API-Key.",name: { field: "authHeaderName", label: "Header name", placeholder: "X-API-Key" },secret: { field: "authHeaderValue", label: "API key", hasSaved: "hasAuthHeaderValue" }}diff --git a/frontend/src/views/Alerts/ChannelCard.tsx b/frontend/src/views/Alerts/ChannelCard.tsxindex bc12531936..e4d2724a9c 100644--- a/frontend/src/views/Alerts/ChannelCard.tsx+++ b/frontend/src/views/Alerts/ChannelCard.tsx@@ -223,8 +223,8 @@ export const ChannelCard = ({<FieldError errors={[channelErrors?.url]} /></FieldContent></Field>- <WebhookSigningSecretField index={index} /><WebhookAuthenticationField index={index} />+ <WebhookSigningSecretField index={index} /><WebhookHeadersField index={index} /></>)}diff --git a/frontend/src/views/Alerts/ChannelSecretInput.tsx b/frontend/src/views/Alerts/ChannelSecretInput.tsxindex 22cc7546a0..87b14a8acd 100644--- a/frontend/src/views/Alerts/ChannelSecretInput.tsx+++ b/frontend/src/views/Alerts/ChannelSecretInput.tsx@@ -10,6 +10,7 @@ type Props = {id: string;placeholder?: string;isError?: boolean;+ isWarning?: boolean;registration: UseFormRegisterReturn;ariaLabel?: string;};@@ -18,13 +19,14 @@ export const ChannelSecretInput = ({id,placeholder,isError,+ isWarning,registration,ariaLabel}: Props) => {const [isRevealed, setIsRevealed] = useState(false);return (- <InputGroup>+ <InputGroup className={isWarning ? "border-warning/60" : undefined}><InputGroupInput{...registration}id={id}diff --git a/frontend/src/views/Alerts/WebhookAuthenticationField.tsx b/frontend/src/views/Alerts/WebhookAuthenticationField.tsxindex 04a60f8999..4817279ccc 100644--- a/frontend/src/views/Alerts/WebhookAuthenticationField.tsx+++ b/frontend/src/views/Alerts/WebhookAuthenticationField.tsx@@ -1,19 +1,16 @@-import { Controller, useFormContext, useWatch } from "react-hook-form";-import { PlusIcon, TrashIcon } from "lucide-react";+import { useFormContext, useWatch } from "react-hook-form";-import { FieldLabelWithTooltip } from "@app/components/secret-rotations-v2/forms/shared";import {- Button,Field,FieldContent,+ FieldDescription,FieldError,- IconButton,+ FieldLabel,Input,- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger} from "@app/components/v3";import {isWebhookUrlChanged,@@ -24,6 +21,10 @@ import {import { ChannelSecretInput, KEEP_PLACEHOLDER } from "./ChannelSecretInput";+const NO_AUTH = "none";++const REENTER_PLACEHOLDER = "Re-enter for new URL";+type Props = {index: number;};@@ -37,105 +38,72 @@ export const WebhookAuthenticationField = ({ index }: Props) => {} = useFormContext<TChannelsForm>();const channel = useWatch({ control, name: `channels.${index}` });const channelErrors = errors.channels?.[index];- const authType = channel?.authType;-- const setAuthType = (type?: WebhookAuthType) =>- setValue(`channels.${index}.authType`, type, { shouldDirty: true });-- const label = (- <FieldLabelWithTooltip tooltip="Credentials sent with each request, for endpoints that require a token, password, or API key.">- Authentication <span className="text-muted">(optional)</span>- </FieldLabelWithTooltip>- );-- if (!authType) {- return (- <Field>- {label}- <FieldContent>- <Button- type="button"- variant="outline"- size="xs"- className="self-start"- onClick={() => setAuthType(WebhookAuthType.Bearer)}- >- <PlusIcon className="size-3.5" />- Add authentication- </Button>- </FieldContent>- </Field>- );- }-- const { name, secret } = WEBHOOK_AUTH_FIELDS[authType];const isUrlChanged = isWebhookUrlChanged(channel);- const hasSavedSecret = Boolean(channel.id && channel[secret.hasSaved]);return (<Field>- {label}+ <FieldLabel>Authentication</FieldLabel><FieldContent>- <div className="flex flex-col gap-2">- <div className="flex items-start gap-2">- <Controller- control={control}- name={`channels.${index}.authType`}- render={({ field }) => (- <Select value={field.value} onValueChange={field.onChange}>- <SelectTrigger className="w-full" aria-label="Authentication type">- <SelectValue />- </SelectTrigger>- <SelectContent position="popper">- {Object.values(WebhookAuthType).map((type) => (- <SelectItem key={type} value={type}>- {WEBHOOK_AUTH_FIELDS[type].label}- </SelectItem>- ))}- </SelectContent>- </Select>- )}- />- <IconButton- aria-label="Remove authentication"- variant="outline"- onClick={() => setAuthType(undefined)}- >- <TrashIcon className="size-4" />- </IconButton>- </div>- <div className="flex items-start gap-2">- {name && (- <Field className="w-2/5">- <Input- key={name.field}- aria-label={name.label}- placeholder={name.placeholder}- isError={Boolean(channelErrors?.[name.field])}- {...register(`channels.${index}.${name.field}`)}- />- <FieldError errors={[channelErrors?.[name.field]]} />- </Field>- )}- <Field className="grow">- <ChannelSecretInput- key={secret.field}- id={`channel-${index}-${secret.field}`}- ariaLabel={secret.label}- placeholder={hasSavedSecret && !isUrlChanged ? KEEP_PLACEHOLDER : secret.label}- isError={Boolean(channelErrors?.[secret.field])}- registration={register(`channels.${index}.${secret.field}`)}- />- <FieldError errors={[channelErrors?.[secret.field]]} />- </Field>- </div>- {hasSavedSecret && isUrlChanged && (- <p className="text-xs text-muted">- The URL changed, so enter the {secret.label.toLowerCase()} again. Saved credentials- are only sent to the URL they were saved with.- </p>- )}- </div>+ <Tabs+ value={channel?.authType ?? NO_AUTH}+ onValueChange={(value) =>+ setValue(+ `channels.${index}.authType`,+ value === NO_AUTH ? undefined : (value as WebhookAuthType),+ { shouldDirty: true }+ )+ }+ >+ <TabsList variant="filled" aria-label="Authentication type" className="w-full">+ <TabsTrigger value={NO_AUTH}>None</TabsTrigger>+ {Object.values(WebhookAuthType).map((type) => (+ <TabsTrigger key={type} value={type}>+ {WEBHOOK_AUTH_FIELDS[type].label}+ </TabsTrigger>+ ))}+ </TabsList>+ <TabsContent value={NO_AUTH} className="mt-0">+ <FieldDescription>Requests are sent without authentication.</FieldDescription>+ </TabsContent>+ {Object.values(WebhookAuthType).map((type) => {+ const { description, name, secret } = WEBHOOK_AUTH_FIELDS[type];+ const hasSavedSecret = Boolean(channel?.id && channel[secret.hasSaved]);+ const needsReentry = hasSavedSecret && isUrlChanged;+ let secretPlaceholder = secret.label;+ if (hasSavedSecret)+ secretPlaceholder = needsReentry ? REENTER_PLACEHOLDER : KEEP_PLACEHOLDER;++ return (+ <TabsContent key={type} value={type} className="mt-0 flex flex-col gap-2">+ <div className="flex items-start gap-2">+ {name && (+ <Field className={type === WebhookAuthType.Basic ? "min-w-0 flex-1" : "w-2/5"}>+ <Input+ aria-label={name.label}+ placeholder={name.placeholder}+ isError={Boolean(channelErrors?.[name.field])}+ {...register(`channels.${index}.${name.field}`)}+ />+ <FieldError errors={[channelErrors?.[name.field]]} />+ </Field>+ )}+ <Field className="min-w-0 flex-1">+ <ChannelSecretInput+ id={`channel-${index}-${secret.field}`}+ ariaLabel={secret.label}+ placeholder={secretPlaceholder}+ isError={Boolean(channelErrors?.[secret.field])}+ isWarning={needsReentry && !channel[secret.field]}+ registration={register(`channels.${index}.${secret.field}`)}+ />+ <FieldError errors={[channelErrors?.[secret.field]]} />+ </Field>+ </div>+ <FieldDescription>{description}</FieldDescription>+ </TabsContent>+ );+ })}+ </Tabs></FieldContent></Field>);