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
changes
varonix345ce2a3c9a2
diff --git a/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsx b/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsxindex 283ba6ff0b..470df5edea 100644--- a/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsx+++ b/frontend/src/layouts/SecretScanningLayout/SecretScanningLayout.tsx@@ -1,11 +1,32 @@+import { useEffect } from "react";import { Outlet } from "@tanstack/react-router";+import { SecretScanningUpgradeIntent, useUpgradeGate } from "@app/components/license/UpgradeGate";+import { useSubscription } from "@app/context";+export const SecretScanningLayout = () => {+ const { subscription } = useSubscription();++ const isSecretScanningGated = subscription?.secretScanning === false;+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();++ useEffect(() => {+ if (!isSecretScanningGated) return;++ openUpgradeGate({+ intent: SecretScanningUpgradeIntent,+ paywallKey: "secret-scanning.product-access"+ });+ }, [isSecretScanningGated, openUpgradeGate]);+return (- <div className="flex h-full w-full flex-col overflow-x-hidden">- <div className="flex-1 overflow-x-hidden overflow-y-auto px-12 pt-10 pb-4">- <Outlet />+ <>+ <div className="flex h-full w-full flex-col overflow-x-hidden">+ <div className="flex-1 overflow-x-hidden overflow-y-auto px-12 pt-10 pb-4">+ <Outlet />+ </div></div>- </div>+ {upgradeGate}+ </>);};diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/DataSourceDetailsCard.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/DataSourceDetailsCard.tsxnew file mode 100644index 0000000000..33856f3bf2--- /dev/null+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/DataSourceDetailsCard.tsx@@ -0,0 +1,158 @@+import { Controller, useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { PlugIcon } from "lucide-react";+import { z } from "zod";++import { createNotification } from "@app/components/notifications";+import {+ Button,+ Card,+ CardContent,+ CardDescription,+ CardFooter,+ CardHeader,+ CardTitle,+ Field,+ FieldContent,+ FieldError,+ FieldLabel,+ Input,+ InputGroup,+ InputGroupAddon,+ InputGroupInput,+ InputGroupText,+ TextArea+} from "@app/components/v3";+import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";+import { SECRET_SCANNING_DATA_SOURCE_CONNECTION_MAP } from "@app/helpers/secretScanningV2";+import {+ TSecretScanningDataSource,+ useUpdateSecretScanningDataSource+} from "@app/hooks/api/secretScanningV2";+import { slugSchema } from "@app/lib/schemas";++const DetailsFormSchema = z.object({+ name: slugSchema({ field: "Name" }),+ description: z.string().trim().max(256, "Cannot exceed 256 characters").nullish()+});++type TDetailsForm = z.infer<typeof DetailsFormSchema>;++type Props = {+ dataSource: TSecretScanningDataSource;+ canEdit: boolean;+};++export const DataSourceDetailsCard = ({ dataSource, canEdit }: Props) => {+ const updateDataSource = useUpdateSecretScanningDataSource();++ const connectionDetails =+ APP_CONNECTION_MAP[SECRET_SCANNING_DATA_SOURCE_CONNECTION_MAP[dataSource.type]];++ const {+ control,+ handleSubmit,+ formState: { isDirty, isSubmitting }+ } = useForm<TDetailsForm>({+ resolver: zodResolver(DetailsFormSchema),+ values: { name: dataSource.name, description: dataSource.description }+ });++ const onSubmit = async (form: TDetailsForm) => {+ await updateDataSource.mutateAsync({+ dataSourceId: dataSource.id,+ type: dataSource.type,+ projectId: dataSource.projectId,+ ...form+ });++ createNotification({ text: `Data source "${form.name}" updated`, type: "success" });+ };++ return (+ <Card>+ <CardHeader>+ <CardTitle>General</CardTitle>+ <CardDescription>How this data source appears across Secret Scanning.</CardDescription>+ </CardHeader>+ <form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-5">+ <CardContent>+ <div className="grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4">+ <Controller+ control={control}+ name="name"+ render={({ field, fieldState: { error } }) => (+ <Field data-invalid={Boolean(error)}>+ <FieldLabel htmlFor="data-source-name">Name</FieldLabel>+ <FieldContent>+ <Input+ {...field}+ id="data-source-name"+ autoComplete="off"+ isError={Boolean(error)}+ disabled={!canEdit}+ />+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}+ />+ {dataSource.connection && (+ <Field>+ <FieldLabel htmlFor="data-source-connection">App Connection</FieldLabel>+ <FieldContent>+ <InputGroup data-disabled="true">+ <InputGroupAddon>+ <PlugIcon />+ </InputGroupAddon>+ <InputGroupInput+ id="data-source-connection"+ value={dataSource.connection.name}+ disabled+ />+ <InputGroupAddon align="inline-end">+ <InputGroupText className="text-xs">{connectionDetails.name}</InputGroupText>+ </InputGroupAddon>+ </InputGroup>+ </FieldContent>+ </Field>+ )}+ <Controller+ control={control}+ name="description"+ render={({ field, fieldState: { error } }) => (+ <Field data-invalid={Boolean(error)} className="col-span-full">+ <FieldLabel htmlFor="data-source-description">Description</FieldLabel>+ <FieldContent>+ <TextArea+ {...field}+ id="data-source-description"+ value={field.value ?? ""}+ placeholder="No description"+ rows={2}+ aria-invalid={Boolean(error)}+ disabled={!canEdit}+ />+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>+ )}+ />+ </div>+ </CardContent>+ {canEdit && (+ <CardFooter className="justify-end">+ <Button+ type="submit"+ variant="ss"+ isPending={isSubmitting}+ isDisabled={!isDirty || isSubmitting}+ >+ Save Changes+ </Button>+ </CardFooter>+ )}+ </form>+ </Card>+ );+};diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/EditDataSourceDetailsDialog.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/EditDataSourceDetailsDialog.tsxdeleted file mode 100644index f660f77816..0000000000--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/EditDataSourceDetailsDialog.tsx+++ /dev/null@@ -1,168 +0,0 @@-import { Controller, useForm } from "react-hook-form";-import { zodResolver } from "@hookform/resolvers/zod";-import { z } from "zod";--import { createNotification } from "@app/components/notifications";-import {- Button,- Dialog,- DialogContent,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,- DiscardChangesAlertDialog,- Field,- FieldContent,- FieldError,- FieldGroup,- FieldLabel,- Input,- TextArea-} from "@app/components/v3";-import {- TSecretScanningDataSource,- useUpdateSecretScanningDataSource-} from "@app/hooks/api/secretScanningV2";-import { useDiscardChangesGuard } from "@app/hooks/useDiscardChangesGuard";-import { slugSchema } from "@app/lib/schemas";--const DetailsFormSchema = z.object({- name: slugSchema({ field: "Name" }),- description: z.string().trim().max(256, "Cannot exceed 256 characters").nullish()-});--type TDetailsForm = z.infer<typeof DetailsFormSchema>;--type Props = {- dataSource: TSecretScanningDataSource;- isOpen: boolean;- onOpenChange: (isOpen: boolean) => void;-};--export const EditDataSourceDetailsDialog = ({ dataSource, isOpen, onOpenChange }: Props) => {- const updateDataSource = useUpdateSecretScanningDataSource();-- const {- control,- handleSubmit,- reset,- formState: { isDirty, isSubmitting }- } = useForm<TDetailsForm>({- resolver: zodResolver(DetailsFormSchema),- values: { name: dataSource.name, description: dataSource.description }- });-- const close = () => {- reset();- onOpenChange(false);- };-- const { confirmDiscard, isDiscardDialogOpen, requestDiscard, setIsDiscardDialogOpen } =- useDiscardChangesGuard({ isDirty, onDiscard: close });-- const onSubmit = async (form: TDetailsForm) => {- await updateDataSource.mutateAsync({- dataSourceId: dataSource.id,- type: dataSource.type,- projectId: dataSource.projectId,- ...form- });-- createNotification({ text: `Data source "${form.name}" updated`, type: "success" });- onOpenChange(false);- };-- return (- <>- <Dialog- open={isOpen}- onOpenChange={(open) => {- if (open) {- onOpenChange(true);- return;- }- requestDiscard();- }}- >- <DialogContent className="max-w-lg" isPending={isSubmitting}>- <DialogHeader>- <DialogTitle>Edit Details</DialogTitle>- <DialogDescription>- How this data source appears across Secret Scanning.- </DialogDescription>- </DialogHeader>- <form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-4">- <FieldGroup>- <Controller- control={control}- name="name"- render={({ field, fieldState: { error } }) => (- <Field data-invalid={Boolean(error)}>- <FieldLabel htmlFor="data-source-name">Name</FieldLabel>- <FieldContent>- <Input- {...field}- id="data-source-name"- autoComplete="off"- isError={Boolean(error)}- />- <FieldError errors={[error]} />- </FieldContent>- </Field>- )}- />- <Controller- control={control}- name="description"- render={({ field, fieldState: { error } }) => (- <Field data-invalid={Boolean(error)}>- <FieldLabel htmlFor="data-source-description">- Description (Optional)- </FieldLabel>- <FieldContent>- <TextArea- {...field}- id="data-source-description"- value={field.value ?? ""}- placeholder="Describe what this data source scans..."- rows={3}- aria-invalid={Boolean(error)}- />- <FieldError errors={[error]} />- </FieldContent>- </Field>- )}- />- </FieldGroup>- <DialogFooter>- <Button- type="button"- variant="ghost"- onClick={requestDiscard}- isDisabled={isSubmitting}- >- Cancel- </Button>- <Button- type="submit"- variant="ss"- isPending={isSubmitting}- isDisabled={!isDirty || isSubmitting}- >- Save Changes- </Button>- </DialogFooter>- </form>- </DialogContent>- </Dialog>- <DiscardChangesAlertDialog- open={isDiscardDialogOpen}- onOpenChange={setIsDiscardDialogOpen}- onDiscard={confirmDiscard}- title="Discard Changes?"- description="Your changes to this data source's details will be lost."- />- </>- );-};diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningDataSourceSettings.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningDataSourceSettings.tsxindex 0c62369cca..118c1ee69f 100644--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningDataSourceSettings.tsx+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningDataSourceSettings.tsx@@ -1,4 +1,4 @@-import { PencilIcon, TrashIcon } from "lucide-react";+import { TrashIcon } from "lucide-react";import { createNotification } from "@app/components/notifications";import { ProjectPermissionCan } from "@app/components/permissions";@@ -11,9 +11,6 @@ import {CardDescription,CardHeader,CardTitle,- Detail,- DetailLabel,- DetailValue,Field,FieldContent,FieldDescription,@@ -23,11 +20,9 @@ import {} from "@app/components/v3";import { ProjectPermissionSub, useProjectPermission } from "@app/context";import { ProjectPermissionSecretScanningDataSourceActions } from "@app/context/ProjectPermissionContext/types";-import { APP_CONNECTION_MAP } from "@app/helpers/appConnections";import {doesDataSourceSupportDiscovery,RESOURCE_DESCRIPTION_HELPER,- SECRET_SCANNING_DATA_SOURCE_CONNECTION_MAP,SECRET_SCANNING_DATA_SOURCE_MAP} from "@app/helpers/secretScanningV2";import { usePopUp } from "@app/hooks";@@ -37,7 +32,7 @@ import {} from "@app/hooks/api/secretScanningV2";import { DataSourceConfigDisplay } from "./DataSourceConfigDisplay";-import { EditDataSourceDetailsDialog } from "./EditDataSourceDetailsDialog";+import { DataSourceDetailsCard } from "./DataSourceDetailsCard";type TScanToggleName = "isHistoricalScanEnabled" | "isScanNewCommitsEnabled" | "isDiscoveryEnabled";@@ -53,18 +48,13 @@ export const SecretScanningDataSourceSettings = ({ dataSource, onDeleted }: PropProjectPermissionSub.SecretScanningDataSources);- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([- "deleteDataSource",- "editDetails"- ] as const);+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["deleteDataSource"] as const);const updateDataSource = useUpdateSecretScanningDataSource();const { name: platform } = SECRET_SCANNING_DATA_SOURCE_MAP[dataSource.type];const { pluralNoun, pluralTitle } = RESOURCE_DESCRIPTION_HELPER[dataSource.type];const supportsDiscovery = doesDataSourceSupportDiscovery(dataSource);- const connectionDetails =- APP_CONNECTION_MAP[SECRET_SCANNING_DATA_SOURCE_CONNECTION_MAP[dataSource.type]];const handleToggle = async (name: TScanToggleName, label: string, isEnabled: boolean) => {await updateDataSource.mutateAsync({@@ -109,46 +99,7 @@ export const SecretScanningDataSourceSettings = ({ dataSource, onDeleted }: Propreturn (<><div className="flex flex-col gap-5">- <Card>- <CardHeader>- <CardTitle>General</CardTitle>- <CardDescription>How this data source appears across Secret Scanning.</CardDescription>- <CardAction>- <Button- variant="outline"- isDisabled={!canEdit}- onClick={() => handlePopUpOpen("editDetails")}- >- <PencilIcon />- Edit- </Button>- </CardAction>- </CardHeader>- <CardContent>- <div className="grid grid-cols-1 gap-5 md:grid-cols-2">- <Detail>- <DetailLabel>Name</DetailLabel>- <DetailValue>{dataSource.name}</DetailValue>- </Detail>- {dataSource.connection && (- <Detail>- <DetailLabel>{connectionDetails.name} Connection</DetailLabel>- <DetailValue>{dataSource.connection.name}</DetailValue>- </Detail>- )}- <Detail className="md:col-span-2">- <DetailLabel>Description</DetailLabel>- <DetailValue>- {dataSource.description ? (- <p className="whitespace-pre-wrap">{dataSource.description}</p>- ) : (- <span className="text-muted">None</span>- )}- </DetailValue>- </Detail>- </div>- </CardContent>- </Card>+ <DataSourceDetailsCard dataSource={dataSource} canEdit={canEdit} /><Card><CardHeader>@@ -209,11 +160,6 @@ export const SecretScanningDataSourceSettings = ({ dataSource, onDeleted }: Prop</CardHeader></Card></div>- <EditDataSourceDetailsDialog- dataSource={dataSource}- isOpen={popUp.editDetails.isOpen}- onOpenChange={(isOpen) => handlePopUpToggle("editDetails", isOpen)}- /><DeleteSecretScanningDataSourceModaldataSource={dataSource}isOpen={popUp.deleteDataSource.isOpen}