Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improve naming

Thiago Araujo da Silva8ea365f4a373
diff --git a/backend/src/services/alert/alert-channel-config-fns.ts b/backend/src/services/alert/alert-channel-config-fns.ts
index d89214cd4b..526ccc6978 100644
--- a/backend/src/services/alert/alert-channel-config-fns.ts
+++ b/backend/src/services/alert/alert-channel-config-fns.ts
@@ -34,7 +34,7 @@ export const mergeChannelConfigWithStored = (
const definition = ALERT_CHANNEL_REGISTRY[channelType as AlertChannelType];
if (!definition) return incomingConfig;
- definition.assertKeptSecretsAllowed?.(incomingConfig, existingConfig);
+ definition.assertStoredSecretsReusable?.(incomingConfig, existingConfig);
const merged: Record<string, unknown> = { ...incomingConfig };
definition.secretFields.forEach((field) => {
diff --git a/backend/src/services/alert/alert-channel-types.ts b/backend/src/services/alert/alert-channel-types.ts
index 3757713d16..5704ba5ff2 100644
--- a/backend/src/services/alert/alert-channel-types.ts
+++ b/backend/src/services/alert/alert-channel-types.ts
@@ -80,7 +80,10 @@ export type TAlertChannelDefinition = {
secretFields: string[];
configSchema: z.ZodTypeAny;
maxTargetsPerRun?: number;
- assertKeptSecretsAllowed?: (incomingConfig: Record<string, unknown>, storedConfig: Record<string, unknown>) => void;
+ assertStoredSecretsReusable?: (
+ incomingConfig: Record<string, unknown>,
+ storedConfig: Record<string, unknown>
+ ) => void;
send: (ctx: TAlertChannelSendContext) => Promise<TChannelResult>;
};
@@ -161,7 +164,7 @@ const WebhookChannelHeaderSchema = z
})
.refine(
(header) => httpHeaderValueRegex.test(header.value),
- (header) => ({ message: `Header '${header.key}' ${UNSENDABLE_CHARACTER_MESSAGE}`, path: ["value"] })
+ (header) => ({ message: `The value for header '${header.key}' ${UNSENDABLE_CHARACTER_MESSAGE}`, path: ["value"] })
);
export const WebhookChannelConfigSchema = z
diff --git a/backend/src/services/alert/channels/alert-channel-registry.ts b/backend/src/services/alert/channels/alert-channel-registry.ts
index 5cb1e6034c..2b242d34c6 100644
--- a/backend/src/services/alert/channels/alert-channel-registry.ts
+++ b/backend/src/services/alert/channels/alert-channel-registry.ts
@@ -10,7 +10,7 @@ import {
import { sendEmailNotification } from "./alert-channel-email-fns";
import { PAGERDUTY_MAX_INCIDENTS_PER_RUN, sendPagerDutyNotification } from "./alert-channel-pagerduty-fns";
import { sendSlackNotification } from "./alert-channel-slack-fns";
-import { assertWebhookKeptSecretsAllowed, sendWebhookNotification } from "./alert-channel-webhook-fns";
+import { assertWebhookUrlUnchangedForKeptCredentials, sendWebhookNotification } from "./alert-channel-webhook-fns";
export const ALERT_CHANNEL_REGISTRY: Record<AlertChannelType, TAlertChannelDefinition> = {
[AlertChannelType.EMAIL]: {
@@ -32,7 +32,7 @@ export const ALERT_CHANNEL_REGISTRY: Record<AlertChannelType, TAlertChannelDefin
directed: false,
secretFields: ["signingSecret", ...Object.values(WEBHOOK_AUTH_SECRET_FIELD_BY_TYPE)],
configSchema: WebhookChannelConfigSchema,
- assertKeptSecretsAllowed: assertWebhookKeptSecretsAllowed,
+ assertStoredSecretsReusable: assertWebhookUrlUnchangedForKeptCredentials,
send: sendWebhookNotification
},
[AlertChannelType.PAGERDUTY]: {
diff --git a/backend/src/services/alert/channels/alert-channel-webhook-fns.ts b/backend/src/services/alert/channels/alert-channel-webhook-fns.ts
index bed50ab681..cd174369de 100644
--- a/backend/src/services/alert/channels/alert-channel-webhook-fns.ts
+++ b/backend/src/services/alert/channels/alert-channel-webhook-fns.ts
@@ -69,7 +69,7 @@ const normalizeUrl = (url: unknown): string | null => {
}
};
-export const assertWebhookKeptSecretsAllowed = (
+export const assertWebhookUrlUnchangedForKeptCredentials = (
incomingConfig: Record<string, unknown>,
storedConfig: Record<string, unknown>
) => {
diff --git a/backend/src/services/alert/channels/alert-channels.test.ts b/backend/src/services/alert/channels/alert-channels.test.ts
index 419aeabf07..65e23456a2 100644
--- a/backend/src/services/alert/channels/alert-channels.test.ts
+++ b/backend/src/services/alert/channels/alert-channels.test.ts
@@ -16,7 +16,7 @@ import { buildPagerDutyEvent } from "./alert-channel-pagerduty-fns";
import { ALERT_CHANNEL_REGISTRY } from "./alert-channel-registry";
import { buildSlackPayload } from "./alert-channel-slack-fns";
import {
- assertWebhookKeptSecretsAllowed,
+ assertWebhookUrlUnchangedForKeptCredentials,
buildWebhookPayload,
sendWebhookNotification
} from "./alert-channel-webhook-fns";
@@ -284,7 +284,7 @@ describe("WebhookChannelConfigSchema headers", () => {
test("names the header whose value can't be sent", () => {
const result = withHeaders([{ key: "X-Env", value: "prod\u200b" }]);
expect(result.error?.issues[0].message).toBe(
- "Header 'X-Env' has a character that can't be sent in an HTTP header, such as an emoji, a control character, or an invisible space. Re-enter the value"
+ "The value for header 'X-Env' has a character that can't be sent in an HTTP header, such as an emoji, a control character, or an invisible space. Re-enter the value"
);
});
});
@@ -354,7 +354,7 @@ describe("WebhookChannelConfigSchema authentication", () => {
});
});
-describe("assertWebhookKeptSecretsAllowed", () => {
+describe("assertWebhookUrlUnchangedForKeptCredentials", () => {
const stored = {
url: "https://api.example.com/sources/abc",
authType: WebhookAuthType.BEARER,
@@ -363,7 +363,7 @@ describe("assertWebhookKeptSecretsAllowed", () => {
test("refuses to keep saved credentials when the URL changed, even on the same host", () => {
expect(() =>
- assertWebhookKeptSecretsAllowed(
+ assertWebhookUrlUnchangedForKeptCredentials(
{ url: "https://api.example.com/sources/attacker", authType: WebhookAuthType.BEARER },
stored
)
@@ -374,7 +374,7 @@ describe("assertWebhookKeptSecretsAllowed", () => {
test("allows a changed URL when the credentials are entered again", () => {
expect(() =>
- assertWebhookKeptSecretsAllowed(
+ assertWebhookUrlUnchangedForKeptCredentials(
{ url: "https://other.example.com/hook", authType: WebhookAuthType.BEARER, authCredentials: "new" },
stored
)
@@ -383,7 +383,7 @@ describe("assertWebhookKeptSecretsAllowed", () => {
test("keeps saved credentials when only the host case differs", () => {
expect(() =>
- assertWebhookKeptSecretsAllowed(
+ assertWebhookUrlUnchangedForKeptCredentials(
{ url: "https://API.example.com/sources/abc", authType: WebhookAuthType.BEARER },
stored
)
@@ -392,7 +392,7 @@ describe("assertWebhookKeptSecretsAllowed", () => {
test("keeps the signing secret on a URL change, since it is never sent", () => {
expect(() =>
- assertWebhookKeptSecretsAllowed(
+ assertWebhookUrlUnchangedForKeptCredentials(
{ url: "https://other.example.com/hook" },
{ url: "https://example.com/hook", signingSecret: "s3cr3t" }
)