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
feat: redesign data source flow
Matheus Nogueira216fc6c537f6
diff --git a/backend/src/db/migrations/20261014170000_secret-scanning-data-source-scan-options.ts b/backend/src/db/migrations/20261014170000_secret-scanning-data-source-scan-options.tsnew file mode 100644index 0000000000..854497d259--- /dev/null+++ b/backend/src/db/migrations/20261014170000_secret-scanning-data-source-scan-options.ts@@ -0,0 +1,43 @@+import { Knex } from "knex";++import { TableName } from "../schemas";++const NEW_COLUMNS = ["isHistoricalScanEnabled", "isScanNewCommitsEnabled", "isDiscoveryEnabled"] as const;++export async function up(knex: Knex): Promise<void> {+ const hasColumns = await Promise.all(+ NEW_COLUMNS.map((column) => knex.schema.hasColumn(TableName.SecretScanningDataSource, column))+ );+ if (hasColumns.every(Boolean)) return;++ await knex.schema.alterTable(TableName.SecretScanningDataSource, (t) => {+ if (!hasColumns[0]) t.boolean("isHistoricalScanEnabled").notNullable().defaultTo(true);+ if (!hasColumns[1]) t.boolean("isScanNewCommitsEnabled").notNullable().defaultTo(true);+ if (!hasColumns[2]) t.boolean("isDiscoveryEnabled").notNullable().defaultTo(true);+ });++ // isAutoScanEnabled gated both the initial full scan and push-triggered scans, so both new flags inherit it.+ // Discovery was implicit in an include list of ["*"], which also picks up repositories added later.+ await knex(TableName.SecretScanningDataSource).update({+ isHistoricalScanEnabled: knex.raw(`COALESCE("isAutoScanEnabled", true)`),+ isScanNewCommitsEnabled: knex.raw(`COALESCE("isAutoScanEnabled", true)`),+ isDiscoveryEnabled: knex.raw(+ `COALESCE(config->'includeRepos' @> '["*"]'::jsonb OR config->'includeProjects' @> '["*"]'::jsonb, false)`+ )+ });+}++export async function down(knex: Knex): Promise<void> {+ const hasColumns = await Promise.all(+ NEW_COLUMNS.map((column) => knex.schema.hasColumn(TableName.SecretScanningDataSource, column))+ );+ const existingColumns = NEW_COLUMNS.filter((_, index) => hasColumns[index]);+ if (!existingColumns.length) return;++ // The analytics view selects these columns, and Postgres won't drop a column a view uses. The next+ // regeneration recreates the view without them.+ await knex.raw(`DROP VIEW IF EXISTS analytics.??`, [TableName.SecretScanningDataSource]);+ await knex.schema.alterTable(TableName.SecretScanningDataSource, (t) => {+ t.dropColumns(...existingColumns);+ });+}diff --git a/backend/src/db/sanitized-schema.yaml b/backend/src/db/sanitized-schema.yamlindex 1f166ad370..5e399f25e5 100644--- a/backend/src/db/sanitized-schema.yaml+++ b/backend/src/db/sanitized-schema.yaml@@ -1119,6 +1119,9 @@ tables:- createdAt- updatedAt- isDisconnected+ - isHistoricalScanEnabled+ - isScanNewCommitsEnabled+ - isDiscoveryEnabled- name: secret_scanning_findingssource: public.secret_scanning_findingsdiff --git a/backend/src/db/schemas/secret-scanning-data-sources.ts b/backend/src/db/schemas/secret-scanning-data-sources.tsindex d79b45e790..5b4465a7fb 100644--- a/backend/src/db/schemas/secret-scanning-data-sources.ts+++ b/backend/src/db/schemas/secret-scanning-data-sources.ts@@ -22,7 +22,10 @@ export const SecretScanningDataSourcesSchema = z.object({projectId: z.string(),createdAt: z.date(),updatedAt: z.date(),- isDisconnected: z.boolean().default(false)+ isDisconnected: z.boolean().default(false),+ isHistoricalScanEnabled: z.boolean().default(true),+ isScanNewCommitsEnabled: z.boolean().default(true),+ isDiscoveryEnabled: z.boolean().default(true)});export type TSecretScanningDataSources = z.infer<typeof SecretScanningDataSourcesSchema>;diff --git a/backend/src/ee/routes/v2/secret-scanning-v2-routers/secret-scanning-v2-endpoints.ts b/backend/src/ee/routes/v2/secret-scanning-v2-routers/secret-scanning-v2-endpoints.tsindex a7d4e39c70..9f49c3df5b 100644--- a/backend/src/ee/routes/v2/secret-scanning-v2-routers/secret-scanning-v2-endpoints.ts+++ b/backend/src/ee/routes/v2/secret-scanning-v2-routers/secret-scanning-v2-endpoints.ts@@ -41,12 +41,18 @@ export const registerSecretScanningEndpoints = <config: Partial<I["config"]>;description?: string | null;isAutoScanEnabled?: boolean;+ isHistoricalScanEnabled?: boolean;+ isScanNewCommitsEnabled?: boolean;+ isDiscoveryEnabled?: boolean;}>;updateSchema: z.ZodType<{name?: string;config?: Partial<I["config"]>;description?: string | null;isAutoScanEnabled?: boolean;+ isHistoricalScanEnabled?: boolean;+ isScanNewCommitsEnabled?: boolean;+ isDiscoveryEnabled?: boolean;}>;responseSchema: z.ZodTypeAny;}) => {diff --git a/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-schemas.ts b/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-schemas.tsindex 75c1d9d05d..00f1c0d810 100644--- a/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-schemas.ts+++ b/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-schemas.ts@@ -26,7 +26,6 @@ export const BitbucketDataSourceConfigSchema = z.object({.max(256).refine((value) => value === "*" || BasicRepositoryRegex.test(value), "Invalid repository name format"))- .nonempty("One or more repositories required").max(100, "Cannot configure more than 100 repositories").default(["*"]).describe(SecretScanningDataSources.CONFIG.BITBUCKET.includeRepos)diff --git a/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-service.ts b/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-service.tsindex c565de2777..76790dd195 100644--- a/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-service.ts+++ b/backend/src/ee/services/secret-scanning-v2/bitbucket/bitbucket-secret-scanning-service.ts@@ -50,7 +50,7 @@ export const bitbucketSecretScanningService = (return;}- const { isAutoScanEnabled, encryptedCredentials, projectId } = dataSource;+ const { isScanNewCommitsEnabled, encryptedCredentials, projectId } = dataSource;const { includeRepos } = parsedConfig.data;if (!encryptedCredentials) {@@ -87,9 +87,9 @@ export const bitbucketSecretScanningService = (return;}- if (!isAutoScanEnabled) {+ if (!isScanNewCommitsEnabled) {logger.info(- `secretScanningV2PushEvent: Bitbucket - ignoring due to auto scan disabled [dataSourceId=${dataSource.id}] [workspaceUuid=${repository.workspace.uuid}]`+ `secretScanningV2PushEvent: Bitbucket - ignoring due to scanning new commits being disabled [dataSourceId=${dataSource.id}] [workspaceUuid=${repository.workspace.uuid}]`);return;}diff --git a/backend/src/ee/services/secret-scanning-v2/github/github-secret-scanning-schemas.ts b/backend/src/ee/services/secret-scanning-v2/github/github-secret-scanning-schemas.tsindex fbe2215dce..1f146e363c 100644--- a/backend/src/ee/services/secret-scanning-v2/github/github-secret-scanning-schemas.ts+++ b/backend/src/ee/services/secret-scanning-v2/github/github-secret-scanning-schemas.ts@@ -21,7 +21,6 @@ export const GitHubDataSourceConfigSchema = z.object({.max(256).refine((value) => value === "*" || BasicRepositoryRegex.test(value), "Invalid repository name format"))- .nonempty("One or more repositories required").max(100, "Cannot configure more than 100 repositories").default(["*"]).describe(SecretScanningDataSources.CONFIG.GITHUB.includeRepos)diff --git a/backend/src/ee/services/secret-scanning-v2/github/github-secret-scanning-service.ts b/backend/src/ee/services/secret-scanning-v2/github/github-secret-scanning-service.tsindex bde557f895..9cd88a3a86 100644--- a/backend/src/ee/services/secret-scanning-v2/github/github-secret-scanning-service.ts+++ b/backend/src/ee/services/secret-scanning-v2/github/github-secret-scanning-service.ts@@ -65,12 +65,12 @@ export const githubSecretScanningService = (return;}- const { isAutoScanEnabled } = dataSource;+ const { isScanNewCommitsEnabled } = dataSource;const { includeRepos } = parsedConfig.data;- if (!isAutoScanEnabled) {+ if (!isScanNewCommitsEnabled) {logger.info(- `secretScanningV2PushEvent: GitHub - ignoring due to auto scan disabled [dataSourceId=${dataSource.id}] [installationId=${installation.id}]`+ `secretScanningV2PushEvent: GitHub - ignoring due to scanning new commits being disabled [dataSourceId=${dataSource.id}] [installationId=${installation.id}]`);return;}diff --git a/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-schemas.ts b/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-schemas.tsindex 1c91037ab2..fde9c1917b 100644--- a/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-schemas.ts+++ b/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-schemas.ts@@ -26,7 +26,6 @@ export const GitLabDataSourceConfigSchema = z.discriminatedUnion("scope", [.max(256).refine((value) => value === "*" || GitLabProjectRegex.test(value), "Invalid project name format"))- .nonempty("One or more projects required").max(100, "Cannot configure more than 100 projects").default(["*"]).describe(SecretScanningDataSources.CONFIG.GITLAB.includeProjects)diff --git a/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-service.ts b/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-service.tsindex 6860c47c20..295513ffa6 100644--- a/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-service.ts+++ b/backend/src/ee/services/secret-scanning-v2/gitlab/gitlab-secret-scanning-service.ts@@ -47,7 +47,7 @@ export const gitlabSecretScanningService = (return;}- const { isAutoScanEnabled, encryptedCredentials, projectId } = dataSource;+ const { isScanNewCommitsEnabled, encryptedCredentials, projectId } = dataSource;const config = parsedConfig.data;if (!encryptedCredentials) {@@ -79,9 +79,9 @@ export const gitlabSecretScanningService = (return;}- if (!isAutoScanEnabled) {+ if (!isScanNewCommitsEnabled) {logger.info(- `secretScanningV2PushEvent: GitLab - ignoring due to auto scan disabled [dataSourceId=${dataSource.id}] [projectId=${payload.project.id}]`+ `secretScanningV2PushEvent: GitLab - ignoring due to scanning new commits being disabled [dataSourceId=${dataSource.id}] [projectId=${payload.project.id}]`);return;}diff --git a/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-fns.ts b/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-fns.tsindex 62da25c6e4..3dfa4fdf8b 100644--- a/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-fns.ts+++ b/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-fns.ts@@ -28,8 +28,14 @@ import { BadRequestError } from "@app/lib/errors";import { titleCaseToCamelCase } from "@app/lib/fn";import { logger } from "@app/lib/logger";+import { GitLabDataSourceScope } from "./gitlab/gitlab-secret-scanning-enums";import { SecretScanningDataSource, SecretScanningFindingSeverity } from "./secret-scanning-v2-enums";-import { TCloneRepository, TGetFindingsPayload, TSecretScanningDataSourceListItem } from "./secret-scanning-v2-types";+import {+ TCloneRepository,+ TGetFindingsPayload,+ TSecretScanningDataSourceInput,+ TSecretScanningDataSourceListItem+} from "./secret-scanning-v2-types";const SECRET_SCANNING_SOURCE_LIST_OPTIONS: Record<SecretScanningDataSource, TSecretScanningDataSourceListItem> = {[SecretScanningDataSource.GitHub]: GITHUB_SECRET_SCANNING_DATA_SOURCE_LIST_OPTION,@@ -41,6 +47,24 @@ export const listSecretScanningDataSourceOptions = () => {return Object.values(SECRET_SCANNING_SOURCE_LIST_OPTIONS).sort((a, b) => a.name.localeCompare(b.name));};+export const doesDataSourceIncludeResources = (dataSource: TSecretScanningDataSourceInput) => {+ switch (dataSource.type) {+ case SecretScanningDataSource.GitHub:+ case SecretScanningDataSource.Bitbucket:+ return dataSource.config.includeRepos.length > 0;+ case SecretScanningDataSource.GitLab:+ return dataSource.config.scope === GitLabDataSourceScope.Project || dataSource.config.includeProjects.length > 0;+ default:+ return true;+ }+};++// GitLab discovery relies on group-level webhooks, so a project-scoped data source cannot discover new projects.+export const doesDataSourceSupportDiscovery = ({ type, config }: { type: string; config?: unknown }) =>+ !(+ type === SecretScanningDataSource.GitLab && (config as { scope?: string })?.scope === GitLabDataSourceScope.Project+ );+// The scanner exits 77 when it wrote findings; that is a successful scan, not a failure.const SCAN_FINDINGS_EXIT_CODE = 77;diff --git a/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-schemas.ts b/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-schemas.tsindex 53b5e4ad93..baedfb0103 100644--- a/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-schemas.ts+++ b/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-schemas.ts@@ -60,11 +60,16 @@ export const BaseCreateSecretScanningDataSourceSchema = ({connectionId: isConnectionRequired? z.string().uuid().describe(SecretScanningDataSources.CREATE(type).connectionId): z.undefined(),- isAutoScanEnabled: z+ isAutoScanEnabled: z.boolean().optional().describe(SecretScanningDataSources.CREATE(type).isAutoScanEnabled),+ isHistoricalScanEnabled: z.boolean().optional()- .default(true)- .describe(SecretScanningDataSources.CREATE(type).isAutoScanEnabled)+ .describe(SecretScanningDataSources.CREATE(type).isHistoricalScanEnabled),+ isScanNewCommitsEnabled: z+ .boolean()+ .optional()+ .describe(SecretScanningDataSources.CREATE(type).isScanNewCommitsEnabled),+ isDiscoveryEnabled: z.boolean().optional().describe(SecretScanningDataSources.CREATE(type).isDiscoveryEnabled)});export const BaseUpdateSecretScanningDataSourceSchema = (type: SecretScanningDataSource) =>@@ -76,7 +81,16 @@ export const BaseUpdateSecretScanningDataSourceSchema = (type: SecretScanningDat.max(256, "Description cannot exceed 256 characters").nullish().describe(SecretScanningDataSources.UPDATE(type).description),- isAutoScanEnabled: z.boolean().optional().describe(SecretScanningDataSources.UPDATE(type).isAutoScanEnabled)+ isAutoScanEnabled: z.boolean().optional().describe(SecretScanningDataSources.UPDATE(type).isAutoScanEnabled),+ isHistoricalScanEnabled: z+ .boolean()+ .optional()+ .describe(SecretScanningDataSources.UPDATE(type).isHistoricalScanEnabled),+ isScanNewCommitsEnabled: z+ .boolean()+ .optional()+ .describe(SecretScanningDataSources.UPDATE(type).isScanNewCommitsEnabled),+ isDiscoveryEnabled: z.boolean().optional().describe(SecretScanningDataSources.UPDATE(type).isDiscoveryEnabled)});export const GitRepositoryScanFindingDetailsSchema = z.object({diff --git a/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-service.ts b/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-service.tsindex 8f703d16db..3fd56b9959 100644--- a/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-service.ts+++ b/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-service.ts@@ -19,7 +19,11 @@ import {import { githubSecretScanningService } from "@app/ee/services/secret-scanning-v2/github/github-secret-scanning-service";import { SecretScanningFindingStatus } from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-enums";import { SECRET_SCANNING_FACTORY_MAP } from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-factory";-import { listSecretScanningDataSourceOptions } from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-fns";+import {+ doesDataSourceIncludeResources,+ doesDataSourceSupportDiscovery,+ listSecretScanningDataSourceOptions+} from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-fns";import {SECRET_SCANNING_DATA_SOURCE_CONNECTION_MAP,SECRET_SCANNING_DATA_SOURCE_NAME_MAP@@ -226,9 +230,26 @@ export const secretScanningV2ServiceFactory = ({};const createSecretScanningDataSource = async (- payload: TCreateSecretScanningDataSourceDTO,+ { isAutoScanEnabled, ...dto }: TCreateSecretScanningDataSourceDTO,actor: OrgServiceActor) => {+ const supportsDiscovery = doesDataSourceSupportDiscovery(dto);++ if (dto.isDiscoveryEnabled && !supportsDiscovery)+ throw new BadRequestError({+ message: "Discovering new projects requires a GitLab group scope. Select a group or turn off discovery."+ });++ const isScanNewCommitsEnabled = dto.isScanNewCommitsEnabled ?? isAutoScanEnabled ?? true;+ const payload = {+ ...dto,+ isHistoricalScanEnabled: dto.isHistoricalScanEnabled ?? isAutoScanEnabled ?? true,+ isScanNewCommitsEnabled,+ isDiscoveryEnabled: dto.isDiscoveryEnabled ?? supportsDiscovery,+ // Kept in sync for instances still reading the legacy flag during a rolling deploy.+ isAutoScanEnabled: isScanNewCommitsEnabled+ };+const plan = await licenseService.getPlan(actor.orgId);if (!plan.secretScanning)@@ -311,7 +332,11 @@ export const secretScanningV2ServiceFactory = ({});- if (payload.isAutoScanEnabled) {+ // A data source created with an empty include list has nothing to scan yet; queueing would only fail.+ if (+ payload.isHistoricalScanEnabled &&+ doesDataSourceIncludeResources(payload as TSecretScanningDataSourceInput)+ ) {try {await secretScanningV2Queue.queueDataSourceFullScan({@@ -342,9 +367,18 @@ export const secretScanningV2ServiceFactory = ({};const updateSecretScanningDataSource = async (- { type, dataSourceId, ...payload }: TUpdateSecretScanningDataSourceDTO,+ { type, dataSourceId, isAutoScanEnabled, ...dto }: TUpdateSecretScanningDataSourceDTO,actor: OrgServiceActor) => {+ const isScanNewCommitsEnabled = dto.isScanNewCommitsEnabled ?? isAutoScanEnabled;+ const payload = {+ ...dto,+ isHistoricalScanEnabled: dto.isHistoricalScanEnabled ?? isAutoScanEnabled,+ isScanNewCommitsEnabled,+ // Kept in sync for instances still reading the legacy flag during a rolling deploy.+ isAutoScanEnabled: isScanNewCommitsEnabled+ };+const plan = await licenseService.getPlan(actor.orgId);if (!plan.secretScanning)@@ -394,6 +428,11 @@ export const secretScanningV2ServiceFactory = ({kmsService});+ if (payload.isDiscoveryEnabled && !doesDataSourceSupportDiscovery(dataSource))+ throw new BadRequestError({+ message: "Discovering new projects requires a GitLab group scope. Select a group or turn off discovery."+ });+if (payload.config) {await factory.validateConfigUpdate({dataSource: {diff --git a/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-types.ts b/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-types.tsindex 681e09b41d..90e5207613 100644--- a/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-types.ts+++ b/backend/src/ee/services/secret-scanning-v2/secret-scanning-v2-types.ts@@ -107,6 +107,9 @@ export type TCreateSecretScanningDataSourceDTO = Pick<connectionId?: string;type: SecretScanningDataSource;isAutoScanEnabled?: boolean;+ isHistoricalScanEnabled?: boolean;+ isScanNewCommitsEnabled?: boolean;+ isDiscoveryEnabled?: boolean;config: Partial<TSecretScanningDataSourceInput["config"]>;};diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex e77e42a2a8..ff76b3cbe0 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -3959,7 +3959,10 @@ export const SecretScanningDataSources = {connectionId: `The ID of the ${APP_CONNECTION_NAME_MAP[SECRET_SCANNING_DATA_SOURCE_CONNECTION_MAP[type]]} Connection to use for this Data Source.`,- isAutoScanEnabled: `Whether scans should be automatically performed when a ${autoScanDescription.verb} occurs to ${autoScanDescription.noun} associated with this Data Source.`,+ isAutoScanEnabled: `Deprecated: use isHistoricalScanEnabled and isScanNewCommitsEnabled. Sets both when they are not provided.`,+ isHistoricalScanEnabled: `Whether a full scan of existing history runs for ${autoScanDescription.noun} when this Data Source is created. Defaults to true.`,+ isScanNewCommitsEnabled: `Whether a scan runs when a ${autoScanDescription.verb} occurs to ${autoScanDescription.noun} associated with this Data Source. Defaults to true.`,+ isDiscoveryEnabled: `Whether ${autoScanDescription.noun} added to the provider after setup are scanned automatically. Defaults to true, except for GitLab project scope, which does not support it.`,config: `The configuration parameters to use for this Data Source.`};},@@ -3971,7 +3974,10 @@ export const SecretScanningDataSources = {dataSourceId: `The ID of the ${typeName} Data Source to be updated.`,name: `The updated name of the ${typeName} Data Source. Must be slug-friendly.`,description: `The updated description of the ${typeName} Data Source.`,- isAutoScanEnabled: `Whether scans should be automatically performed when a ${autoScanDescription.verb} occurs to ${autoScanDescription.noun} associated with this Data Source.`,+ isAutoScanEnabled: `Deprecated: use isHistoricalScanEnabled and isScanNewCommitsEnabled. Sets both when they are not provided.`,+ isHistoricalScanEnabled: `Whether a full scan of existing history runs for ${autoScanDescription.noun} when this Data Source is created.`,+ isScanNewCommitsEnabled: `Whether a scan runs when a ${autoScanDescription.verb} occurs to ${autoScanDescription.noun} associated with this Data Source.`,+ isDiscoveryEnabled: `Whether ${autoScanDescription.noun} added to the provider after setup are scanned automatically. Not supported for GitLab project scope.`,config: `The updated configuration parameters to use for this Data Source.`};},@@ -3990,10 +3996,12 @@ export const SecretScanningDataSources = {}),CONFIG: {GITHUB: {- includeRepos: 'The repositories to include when scanning. Defaults to all repositories (["*"]).'+ includeRepos:+ 'The repositories to include when scanning. Use ["*"] for all repositories or an empty list for none. Defaults to all repositories (["*"]).'},GITLAB: {- includeProjects: 'The projects to include when scanning. Defaults to all projects (["*"]).',+ includeProjects:+ 'The projects to include when scanning. Use ["*"] for all projects or an empty list for none. Defaults to all projects (["*"]).',scope: "The GitLab scope scanning should occur at (project or group level).",projectId: "The ID of the project to scan.",projectName: "The name of the project to scan.",@@ -4002,7 +4010,8 @@ export const SecretScanningDataSources = {},BITBUCKET: {workspaceSlug: "The workspace to scan.",- includeRepos: 'The repositories to include when scanning. Defaults to all repositories (["*"]).'+ includeRepos:+ 'The repositories to include when scanning. Use ["*"] for all repositories or an empty list for none. Defaults to all repositories (["*"]).'}}};diff --git a/frontend/src/components/secret-scanning/CreateSecretScanningDataSourceModal.tsx b/frontend/src/components/secret-scanning/CreateSecretScanningDataSourceModal.tsxdeleted file mode 100644index bc9a981c22..0000000000--- a/frontend/src/components/secret-scanning/CreateSecretScanningDataSourceModal.tsx+++ /dev/null@@ -1,148 +0,0 @@-import { useEffect, useState } from "react";-import { useNavigate, useRouterState } from "@tanstack/react-router";--import { TSecretScanningDataSourceForm } from "@app/components/secret-scanning/forms/schemas";-import { Modal, ModalContent } from "@app/components/v2";-import { DocumentationLinkBadge } from "@app/components/v3";-import {- SecretScanningDataSource,- TSecretScanningDataSource-} from "@app/hooks/api/secretScanningV2";--import { SecretScanningDataSourceForm } from "./forms";-import { SecretScanningDataSourceModalHeader } from "./SecretScanningDataSourceModalHeader";-import {- SecretScanningDataSourcePopupContext,- useSecretScanningDataSourcePopupRegistry-} from "./SecretScanningDataSourcePopupContext";-import { SecretScanningDataSourceSelect } from "./SecretScanningDataSourceSelect";--type Props = {- isOpen: boolean;- onOpenChange: (isOpen: boolean) => void;-};--type ContentProps = {- onComplete: (dataSource: TSecretScanningDataSource) => void;- selectedDataSource: SecretScanningDataSource | null;- setSelectedDataSource: (selectedDataSource: SecretScanningDataSource | null) => void;- initialFormData?: Partial<TSecretScanningDataSourceForm>;- onCancel: () => void;-};--const Content = ({- setSelectedDataSource,- selectedDataSource,- onCancel,- ...props-}: ContentProps) => {- if (selectedDataSource) {- return (- <SecretScanningDataSourceForm onCancel={onCancel} type={selectedDataSource} {...props} />- );- }-- return <SecretScanningDataSourceSelect onSelect={setSelectedDataSource} />;-};--export const CreateSecretScanningDataSourceModal = ({ onOpenChange, isOpen, ...props }: Props) => {- const popupRegistry = useSecretScanningDataSourcePopupRegistry();- const [selectedDataSource, setSelectedDataSource] = useState<SecretScanningDataSource | null>(- null- );- const [initialFormData, setInitialFormData] = useState<Partial<TSecretScanningDataSourceForm>>();-- const {- location: {- search: { connectionId, connectionName, ...search },- pathname- }- } = useRouterState();-- const navigate = useNavigate();-- useEffect(() => {- if (connectionId && connectionName) {- const storedFormData = localStorage.getItem("secretScanningDataSourceFormData");-- if (!storedFormData) return;-- let form: Partial<TSecretScanningDataSourceForm> = {};- try {- form = JSON.parse(storedFormData) as TSecretScanningDataSourceForm;- } catch {- return;- } finally {- localStorage.removeItem("secretScanningDataSourceFormData");- }-- onOpenChange(true);-- setSelectedDataSource(form.type ?? null);-- setInitialFormData({- ...form,- connection: { id: connectionId, name: connectionName }- });-- navigate({- to: pathname,- search- });- }- }, [connectionId, connectionName]);-- const resetModal = () => {- setSelectedDataSource(null);- setInitialFormData(undefined);- };-- return (- <Modal- isOpen={isOpen}- onOpenChange={(open) => {- if (!open) {- resetModal();- }- onOpenChange(open);- }}- >- {/* z-50 (not the v2 default z-[60]) so the inline "Create Connection" Sheet and its v3 Select- menus (all z-50, portaled later) stack above this modal instead of being buried behind it,- while the backdrop still covers page chrome up to z-50 by portal order. */}- <ModalContent- onEscapeKeyDown={popupRegistry.onEscapeKeyDown}- overlayClassName="z-50"- title={- selectedDataSource ? (- <SecretScanningDataSourceModalHeader isConfigured={false} type={selectedDataSource} />- ) : (- <div className="flex items-center gap-x-2 text-label">- Add Data Source- <DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/secret-scanning/overview" />- </div>- )- }- className={selectedDataSource ? "z-50 max-w-2xl" : "z-50 max-w-3xl"}- subTitle={- selectedDataSource ? undefined : "Select a data source to configure secret scanning for."- }- bodyClassName="overflow-visible"- >- <SecretScanningDataSourcePopupContext.Provider value={popupRegistry.onPopupOpenChange}>- <Content- onComplete={() => {- resetModal();- onOpenChange(false);- }}- onCancel={resetModal}- selectedDataSource={selectedDataSource}- setSelectedDataSource={setSelectedDataSource}- initialFormData={initialFormData}- {...props}- />- </SecretScanningDataSourcePopupContext.Provider>- </ModalContent>- </Modal>- );-};diff --git a/frontend/src/components/secret-scanning/CreateSecretScanningDataSourceSheet.tsx b/frontend/src/components/secret-scanning/CreateSecretScanningDataSourceSheet.tsxnew file mode 100644index 0000000000..d8a0a67560--- /dev/null+++ b/frontend/src/components/secret-scanning/CreateSecretScanningDataSourceSheet.tsx@@ -0,0 +1,103 @@+import { useCallback, useEffect, useState } from "react";+import { useNavigate, useRouterState } from "@tanstack/react-router";++import { TSecretScanningDataSourceForm } from "@app/components/secret-scanning/forms/schemas";+import { DiscardChangesAlertDialog, Sheet, SheetContent } from "@app/components/v3";+import { useDiscardChangesGuard } from "@app/hooks/useDiscardChangesGuard";++import { CreateSecretScanningDataSourceForm } from "./forms";+import {+ SecretScanningDataSourcePopupContext,+ useSecretScanningDataSourcePopupRegistry+} from "./SecretScanningDataSourcePopupContext";++type Props = {+ isOpen: boolean;+ onOpenChange: (isOpen: boolean) => void;+};++export const CreateSecretScanningDataSourceSheet = ({ isOpen, onOpenChange }: Props) => {+ const popupRegistry = useSecretScanningDataSourcePopupRegistry();+ const [initialFormData, setInitialFormData] = useState<Partial<TSecretScanningDataSourceForm>>();+ const [isDirty, setIsDirty] = useState(false);++ const {+ location: {+ search: { connectionId, connectionName, ...search },+ pathname+ }+ } = useRouterState();++ const navigate = useNavigate();++ useEffect(() => {+ if (connectionId && connectionName) {+ const storedFormData = localStorage.getItem("secretScanningDataSourceFormData");++ if (!storedFormData) return;++ let form: Partial<TSecretScanningDataSourceForm> = {};+ try {+ form = JSON.parse(storedFormData) as TSecretScanningDataSourceForm;+ } catch {+ return;+ } finally {+ localStorage.removeItem("secretScanningDataSourceFormData");+ }++ setInitialFormData({+ ...form,+ connection: { id: connectionId, name: connectionName }+ });+ onOpenChange(true);++ navigate({+ to: pathname,+ search+ });+ }+ }, [connectionId, connectionName]);++ const closeSheet = useCallback(() => {+ setInitialFormData(undefined);+ setIsDirty(false);+ onOpenChange(false);+ }, [onOpenChange]);++ const { confirmDiscard, isDiscardDialogOpen, requestDiscard, setIsDiscardDialogOpen } =+ useDiscardChangesGuard({ isDirty, onDiscard: closeSheet });++ return (+ <>+ <Sheet+ open={isOpen}+ onOpenChange={(open) => {+ if (open) {+ onOpenChange(true);+ return;+ }+ requestDiscard();+ }}+ >+ <SheetContent size="wide" onEscapeKeyDown={popupRegistry.onEscapeKeyDown}>+ <SecretScanningDataSourcePopupContext.Provider value={popupRegistry.onPopupOpenChange}>+ <CreateSecretScanningDataSourceForm+ initialType={initialFormData?.type}+ initialFormData={initialFormData}+ onComplete={closeSheet}+ onCancel={requestDiscard}+ onDirtyChange={setIsDirty}+ />+ </SecretScanningDataSourcePopupContext.Provider>+ </SheetContent>+ </Sheet>+ <DiscardChangesAlertDialog+ open={isDiscardDialogOpen}+ onOpenChange={setIsDiscardDialogOpen}+ onDiscard={confirmDiscard}+ title="Discard Data Source Setup?"+ description="Your progress configuring this data source will be lost."+ />+ </>+ );+};diff --git a/frontend/src/components/secret-scanning/SecretScanningDataSourceSelect.tsx b/frontend/src/components/secret-scanning/SecretScanningDataSourceSelect.tsxdeleted file mode 100644index 30db0ca153..0000000000--- a/frontend/src/components/secret-scanning/SecretScanningDataSourceSelect.tsx+++ /dev/null@@ -1,84 +0,0 @@-import { faWrench } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";--import { HoverCard, HoverCardContent, HoverCardTrigger, Loader } from "@app/components/v3";-import { ProviderIcon } from "@app/components/v3/platform/ProviderIcon";-import { SECRET_SCANNING_DATA_SOURCE_MAP } from "@app/helpers/secretScanningV2";-import {- SecretScanningDataSource,- useSecretScanningDataSourceOptions-} from "@app/hooks/api/secretScanningV2";--type Props = {- onSelect: (type: SecretScanningDataSource) => void;-};--export const SecretScanningDataSourceSelect = ({ onSelect }: Props) => {- const { isPending, data: dataSourceOptions } = useSecretScanningDataSourceOptions();-- if (isPending) {- return (- <div className="flex h-full flex-col items-center justify-center py-2.5">- <Loader size="md" label="Loading data source options" />- <p className="mt-4 text-sm text-muted">Loading options...</p>- </div>- );- }-- return (- <div className="grid grid-cols-3 gap-2">- {dataSourceOptions?.map(({ type }) => {- const { image, name, size } = SECRET_SCANNING_DATA_SOURCE_MAP[type];-- return (- <button- type="button"- key={type}- onClick={() => onSelect(type)}- className="group relative flex h-28 cursor-pointer flex-col items-center justify-center rounded-md border border-border-control bg-surface-hover p-4 duration-200 hover:bg-surface-active"- >- <ProviderIcon icon={image} width={size} className="mt-auto" alt={`${name} logo`} />- <div className="mt-auto max-w-xs text-center text-xs font-medium text-label-cool duration-200 group-hover:text-foreground-cool">- {name}- </div>- </button>- );- })}- <HoverCard openDelay={50}>- <HoverCardTrigger asChild>- <div className="group relative flex h-28 flex-col items-center justify-center rounded-md border border-dashed border-border-control bg-surface-raised p-4 hover:bg-surface-base/50">- <FontAwesomeIcon className="mt-auto text-3xl" icon={faWrench} />- <div className="mt-auto max-w-xs text-center text-xs font-medium text-label-cool duration-200 group-hover:text-foreground-cool">- Coming Soon- </div>- </div>- </HoverCardTrigger>- <HoverCardContent side="bottom">- <p className="mb-2">Infisical is constantly adding support for more services.</p>- <p>- {`If you don't see the third-party- service you're looking for,`}{" "}- <a- target="_blank"- className="underline hover:text-label"- href="https://community.infisical.com"- rel="noopener noreferrer"- >- let us know in the community forum- </a>{" "}- or{" "}- <a- target="_blank"- className="underline hover:text-label"- href="https://github.com/Infisical/infisical/discussions"- rel="noopener noreferrer"- >- make a request on GitHub- </a>- .- </p>- </HoverCardContent>- </HoverCard>- </div>- );-};diff --git a/frontend/src/components/secret-scanning/forms/CreateSecretScanningDataSourceForm.tsx b/frontend/src/components/secret-scanning/forms/CreateSecretScanningDataSourceForm.tsxnew file mode 100644index 0000000000..d5bf88a390--- /dev/null+++ b/frontend/src/components/secret-scanning/forms/CreateSecretScanningDataSourceForm.tsx@@ -0,0 +1,377 @@+import { useEffect, useState } from "react";+import { FieldPath, FormProvider, useForm, useWatch } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";++import { createNotification } from "@app/components/notifications";+import {+ Button,+ DocumentationLinkBadge,+ Loader,+ SheetDescription,+ SheetFooter,+ SheetHeader,+ SheetTitle,+ Stepper,+ StepperList,+ StepperStep+} from "@app/components/v3";+import { ProviderIcon } from "@app/components/v3/platform/ProviderIcon";+import { useProject } from "@app/context";+import {+ doesDataSourceSupportDiscovery,+ RESOURCE_DESCRIPTION_HELPER,+ SECRET_SCANNING_DATA_SOURCE_MAP+} from "@app/helpers/secretScanningV2";+import {+ SecretScanningDataSource,+ TSecretScanningDataSource,+ useSecretScanningDataSourceOptions+} from "@app/hooks/api/secretScanningV2";+import { useCreateSecretScanningDataSource } from "@app/hooks/api/secretScanningV2/mutations";+import { GitLabDataSourceScope } from "@app/hooks/api/secretScanningV2/types/gitlab-data-source";++import { SecretScanningDataSourceSchema, TSecretScanningDataSourceForm } from "./schemas";+import {+ SecretScanningDataSourceConnectionFields,+ SecretScanningDataSourceScanFields+} from "./SecretScanningDataSourceConfigFields";+import { SecretScanningDataSourceDetailsFields } from "./SecretScanningDataSourceDetailsFields";+import { SecretScanningDataSourceReviewFields } from "./SecretScanningDataSourceReviewFields";++type TFormField = FieldPath<TSecretScanningDataSourceForm>;++enum FormStep {+ Provider = 0,+ Connection = 1,+ Scan = 2,+ Details = 3,+ Review = 4+}++const getDefaultConfig = (type: SecretScanningDataSource) => {+ switch (type) {+ case SecretScanningDataSource.GitHub:+ return { includeRepos: [] };+ case SecretScanningDataSource.Bitbucket:+ return { workspaceSlug: "", includeRepos: [] };+ case SecretScanningDataSource.GitLab:+ return { scope: GitLabDataSourceScope.Project };+ default:+ throw new Error(`Unhandled data source type: ${type}`);+ }+};++const getDefaultValues = (type: SecretScanningDataSource) =>+ ({+ type,+ isHistoricalScanEnabled: true,+ isScanNewCommitsEnabled: true,+ isDiscoveryEnabled: doesDataSourceSupportDiscovery({ type, config: getDefaultConfig(type) }),+ config: getDefaultConfig(type)+ }) as TSecretScanningDataSourceForm;++const CONNECTION_STEP_FIELDS: Record<SecretScanningDataSource, TFormField[]> = {+ [SecretScanningDataSource.GitHub]: ["connection"],+ [SecretScanningDataSource.Bitbucket]: ["connection", "config.workspaceSlug"],+ [SecretScanningDataSource.GitLab]: [+ "connection",+ "config.scope",+ "config.projectId",+ "config.groupId"+ ]+};++const CONNECTION_STEP_INFO: Record<SecretScanningDataSource, string> = {+ [SecretScanningDataSource.GitHub]:+ "The App Connection is how Secret Scanning reads your GitHub repositories. It cannot be changed after the data source is created.",+ [SecretScanningDataSource.Bitbucket]:+ "The App Connection is how Secret Scanning reads your Bitbucket repositories, and the workspace tells it where to look. The connection cannot be changed after the data source is created.",+ [SecretScanningDataSource.GitLab]:+ "The App Connection is how Secret Scanning reads your GitLab projects. Group scope relies on group-level webhooks, so it is the only scope that picks up projects added later. Connection and scope cannot be changed after the data source is created."+};++const getSteps = (type: SecretScanningDataSource) => {+ const { name: platform } = SECRET_SCANNING_DATA_SOURCE_MAP[type];+ const { pluralNoun, verb } = RESOURCE_DESCRIPTION_HELPER[type];++ return [+ {+ name: "Provider",+ description: platform,+ title: "Choose a Provider",+ subtitle: "Pick the platform this data source will scan.",+ info: "",+ fields: [] as TFormField[]+ },+ {+ name: "Connection",+ description: "Connection and scope",+ title: `Connect to ${platform}`,+ subtitle: "Choose the App Connection and, if needed, narrow its scope.",+ info: CONNECTION_STEP_INFO[type],+ fields: CONNECTION_STEP_FIELDS[type]+ },+ {+ name: "Scan Options",+ description: "Scan behavior",+ title: "Configure Scanning",+ subtitle: "Decide when this data source gets scanned.",+ info: `Historical scan checks existing history once ${pluralNoun} are enabled. Scan New Commits keeps watching each ${verb}. Discovery automatically enables newly added ${pluralNoun}.`,+ fields: [+ "isHistoricalScanEnabled",+ "isScanNewCommitsEnabled",+ "isDiscoveryEnabled"+ ] as TFormField[]+ },+ {+ name: "Details",+ description: "Name and description",+ title: "Name This Data Source",+ subtitle: "Give the data source a name your team will recognize.",+ info: "This name appears in the data source list, in findings, and in audit logs.",+ fields: ["name", "description"] as TFormField[]+ },+ {+ name: "Review",+ description: "Confirm configuration",+ title: "Review and Create",+ subtitle: "Confirm the details below, then create the data source.",+ info: "You can change scan options, name, and description later from the data source's settings.",+ fields: [] as TFormField[]+ }+ ];+};++const ProviderCard = ({+ type,+ onClick+}: {+ type: SecretScanningDataSource;+ onClick: () => void;+}) => {+ const { name, image } = SECRET_SCANNING_DATA_SOURCE_MAP[type];+ const { pluralNoun } = RESOURCE_DESCRIPTION_HELPER[type];++ return (+ <button+ type="button"+ onClick={onClick}+ className="group flex cursor-pointer flex-col gap-3 rounded-md border border-border bg-card p-4 text-left transition-colors hover:border-border-strong hover:bg-surface-hover/50"+ >+ <div className="flex items-start justify-between gap-2">+ <div className="flex h-9 w-9 items-center justify-center rounded-md bg-surface-hover">+ <ProviderIcon icon={image} alt={`${name} logo`} className="h-6 w-6 object-contain" />+ </div>+ <span className="text-[10px] font-medium tracking-wider text-muted uppercase">+ Version Control+ </span>+ </div>+ <div className="flex flex-col gap-1">+ <p className="text-sm font-semibold text-foreground">{name}</p>+ <p className="text-xs leading-relaxed text-muted">+ Scan {pluralNoun} hosted on {name} for leaked secrets.+ </p>+ </div>+ </button>+ );+};++const ProviderFields = ({ onSelect }: { onSelect: (type: SecretScanningDataSource) => void }) => {+ const { isPending, data: options } = useSecretScanningDataSourceOptions();++ if (isPending) return <Loader size="md" label="Loading data source options" />;++ return (+ <div className="grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3">+ {options?.map(({ type }) => (+ <ProviderCard key={type} type={type} onClick={() => onSelect(type)} />+ ))}+ </div>+ );+};++type Props = {+ initialType?: SecretScanningDataSource;+ initialFormData?: Partial<TSecretScanningDataSourceForm>;+ onComplete: (dataSource: TSecretScanningDataSource) => void;+ onCancel: () => void;+ onDirtyChange: (isDirty: boolean) => void;+};++export const CreateSecretScanningDataSourceForm = ({+ initialType = SecretScanningDataSource.GitHub,+ initialFormData,+ onComplete,+ onCancel,+ onDirtyChange+}: Props) => {+ const { currentProject } = useProject();+ const createDataSource = useCreateSecretScanningDataSource();++ const [step, setStep] = useState(initialFormData ? FormStep.Connection : FormStep.Provider);++ const formMethods = useForm<TSecretScanningDataSourceForm>({+ resolver: zodResolver(SecretScanningDataSourceSchema),+ defaultValues: { ...getDefaultValues(initialType), ...initialFormData },+ // Step validation uses trigger(), which does not put the form into its submitted state.+ // Validate changes from the start so a field's error clears as soon as it is corrected.+ mode: "onChange",+ reValidateMode: "onChange"+ });++ const {+ control,+ handleSubmit,+ reset,+ trigger,+ formState: { isDirty, isSubmitting }+ } = formMethods;++ const type = useWatch({ control, name: "type" });+ const hasUnsavedChanges = isDirty || Boolean(initialFormData);++ useEffect(() => {+ onDirtyChange(hasUnsavedChanges);+ return () => onDirtyChange(false);+ }, [hasUnsavedChanges, onDirtyChange]);++ const steps = getSteps(type);+ const currentStep = steps[step];+ const isFinalStep = step === FormStep.Review;+ const { name: platform, image } = SECRET_SCANNING_DATA_SOURCE_MAP[type];+ const { pluralNoun } = RESOURCE_DESCRIPTION_HELPER[type];++ const onSubmit = async ({ connection, ...formData }: TSecretScanningDataSourceForm) => {+ const dataSource = await createDataSource.mutateAsync({+ ...formData,+ connectionId: connection?.id,+ projectId: currentProject.id+ });++ createNotification({+ text: `${platform} data source "${dataSource.name}" created`,+ type: "success"+ });+ onComplete(dataSource);+ };++ const handleNext = async () => {+ if (isFinalStep) {+ await handleSubmit(onSubmit)();+ return;+ }++ if (!(await trigger(currentStep.fields))) return;++ setStep((prev) => prev + 1);+ };++ const handleBack = () => {+ if (step === FormStep.Provider) {+ onCancel();+ return;+ }++ setStep((prev) => prev - 1);+ };++ return (+ <FormProvider {...formMethods}>+ <SheetHeader>+ <div className="flex items-start gap-3">+ <ProviderIcon icon={image} alt="" className="size-9 object-contain" />+ <div className="flex flex-col gap-1">+ <div className="flex items-center gap-2">+ <SheetTitle>{platform} Data Source</SheetTitle>+ <DocumentationLinkBadge+ href={`https://infisical.com/docs/documentation/platform/secret-scanning/${type}`}+ />+ </div>+ <SheetDescription>+ Connect a {platform} data source to scan its {pluralNoun}.+ </SheetDescription>+ </div>+ </div>+ </SheetHeader>++ <form+ className="flex min-h-0 flex-1 overflow-hidden"+ onSubmit={(e) => {+ e.preventDefault();+ handleNext();+ }}+ id="create-secret-scanning-data-source-form"+ >+ {step !== FormStep.Provider && (+ <aside className="flex w-56 shrink-0 flex-col gap-4 overflow-y-auto border-r border-border p-5">+ <p className="text-xs font-medium tracking-wider text-muted uppercase">Setup Steps</p>+ <Stepper activeStep={step} onStepChange={setStep}>+ <StepperList>+ {steps.map((s, index) => (+ <StepperStep+ key={s.name}+ index={index}+ title={s.name}+ description={s.description}+ />+ ))}+ </StepperList>+ </Stepper>+ </aside>+ )}++ <div className="flex min-w-0 flex-1 flex-col gap-6 overflow-y-auto px-8 py-6">+ <div className="flex flex-col gap-1">+ <h3 className="text-lg text-foreground">{currentStep.title}</h3>+ <p className="text-sm text-accent">{currentStep.subtitle}</p>+ </div>++ {step === FormStep.Provider && (+ <ProviderFields+ onSelect={(newType) => {+ if (newType !== type) reset(getDefaultValues(newType));+ setStep(FormStep.Connection);+ }}+ />+ )}+ {step === FormStep.Connection && <SecretScanningDataSourceConnectionFields />}+ {step === FormStep.Scan && <SecretScanningDataSourceScanFields />}+ {step === FormStep.Details && <SecretScanningDataSourceDetailsFields />}+ {step === FormStep.Review && <SecretScanningDataSourceReviewFields />}+ </div>++ {step !== FormStep.Provider && (+ <aside className="hidden w-64 shrink-0 flex-col gap-3 overflow-y-auto border-l border-border p-5 lg:flex">+ <p className="text-xs font-medium tracking-wider text-muted uppercase">+ Step {step + 1} · {currentStep.name}+ </p>+ <p className="text-sm font-medium text-foreground">What this step does</p>+ <p className="text-sm leading-relaxed text-accent">{currentStep.info}</p>+ </aside>+ )}+ </form>++ <SheetFooter className="items-center justify-between border-t">+ <span className="text-xs text-muted">+ Step {step + 1} of {steps.length}+ </span>+ <div className="flex gap-2">+ <Button variant="outline" onClick={handleBack} isDisabled={isSubmitting}>+ {step === FormStep.Provider ? "Cancel" : "Back"}+ </Button>+ {step !== FormStep.Provider && (+ <Button+ variant="project"+ type="submit"+ form="create-secret-scanning-data-source-form"+ isPending={isSubmitting}+ isDisabled={isSubmitting}+ >+ {isFinalStep ? "Create Data Source" : "Continue"}+ </Button>+ )}+ </div>+ </SheetFooter>+ </FormProvider>+ );+};diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/BitbucketDataSourceConfigFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/BitbucketDataSourceConfigFields.tsxindex 73efcd0e89..4de2bc0bc8 100644--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/BitbucketDataSourceConfigFields.tsx+++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/BitbucketDataSourceConfigFields.tsx@@ -1,183 +1,88 @@-import { useEffect, useState } from "react";+import { useState } from "react";import { Controller, useFormContext, useWatch } from "react-hook-form";-import { MultiValue, SingleValue } from "react-select";-import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { FilterableSelect, FormControl, Select, SelectItem, Tooltip } from "@app/components/v2";-import { useDebounce } from "@app/hooks";import {- TBitbucketRepo,- TBitbucketWorkspace,- useBitbucketConnectionListRepositories,- useBitbucketConnectionListWorkspaces-} from "@app/hooks/api/appConnections/bitbucket";+ Combobox,+ Field,+ FieldContent,+ FieldDescription,+ FieldError,+ FieldLabel+} from "@app/components/v3";+import { useDebounce } from "@app/hooks";+import { useBitbucketConnectionListWorkspaces } from "@app/hooks/api/appConnections/bitbucket";import { SecretScanningDataSource } from "@app/hooks/api/secretScanningV2";import { TSecretScanningDataSourceForm } from "../schemas";import { SecretScanningDataSourceConnectionField } from "../SecretScanningDataSourceConnectionField";-enum ScanMethod {- AllRepositories = "all-repositories",- SelectRepositories = "select-repositories"-}+type TBitbucketForm = TSecretScanningDataSourceForm & {+ type: SecretScanningDataSource.Bitbucket;+};-export const BitbucketDataSourceConfigFields = () => {- const { control, watch, setValue } = useFormContext<- TSecretScanningDataSourceForm & {- type: SecretScanningDataSource.Bitbucket;- }- >();+export const BitbucketDataSourceConnectionFields = () => {+ const { control, setValue } = useFormContext<TBitbucketForm>();const [workspaceSearch, setWorkspaceSearch] = useState("");const [debouncedWorkspaceSearch] = useDebounce(workspaceSearch, 300);const connectionId = useWatch({ control, name: "connection.id" });- const isUpdate = Boolean(watch("id"));-- const selectedWorkspaceSlug = useWatch({ control, name: "config.workspaceSlug" });+ const isUpdate = Boolean(useWatch({ control, name: "id" }));- const { data: workspaces, isPending: areWorkspacesLoading } =+ const { data: workspaces = [], isPending: areWorkspacesLoading } =useBitbucketConnectionListWorkspaces(connectionId, debouncedWorkspaceSearch || undefined, {enabled: Boolean(connectionId)});- const { data: repositories, isPending: areRepositoriesLoading } =- useBitbucketConnectionListRepositories(connectionId, selectedWorkspaceSlug, undefined, {- enabled: Boolean(connectionId) && Boolean(selectedWorkspaceSlug)- });-- const includeRepos = watch("config.includeRepos");-- const scanMethod =- !includeRepos || includeRepos[0] === "*"- ? ScanMethod.AllRepositories- : ScanMethod.SelectRepositories;-- useEffect(() => {- if (!includeRepos) {- setValue("config.includeRepos", ["*"]);- }- }, [includeRepos, setValue]);-return (<><SecretScanningDataSourceConnectionFieldisUpdate={isUpdate}- onChange={() => {- if (scanMethod === ScanMethod.SelectRepositories) {- setValue("config.workspaceSlug", "");- setValue("config.includeRepos", []);- }- }}+ onChange={() => setValue("config.workspaceSlug", "")}/><Controllername="config.workspaceSlug"control={control}render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Workspace"- helperText={- <Tooltip- className="max-w-md"- content={<>Ensure that your connection has the correct permissions.</>}- >- <div>- <span>Don't see the workspaces you're looking for?</span>{" "}- <FontAwesomeIcon icon={faCircleInfo} className="text-muted" />- </div>- </Tooltip>- }- >- <FilterableSelect- menuPlacement="top"- isLoading={areWorkspacesLoading && Boolean(connectionId)}- isDisabled={!connectionId}- value={value ? { slug: value } : null}- onChange={(newValue) => {- onChange((newValue as SingleValue<TBitbucketWorkspace>)?.slug);- if (scanMethod === ScanMethod.SelectRepositories) {- setValue("config.includeRepos", []);+ <Field data-invalid={Boolean(error)}>+ <FieldLabel+ id="secret-scanning-bitbucket-workspace-label"+ htmlFor="secret-scanning-bitbucket-workspace"+ >+ Workspace+ </FieldLabel>+ <FieldContent>+ <Combobox+ id="secret-scanning-bitbucket-workspace"+ aria-labelledby="secret-scanning-bitbucket-workspace-label"+ aria-describedby="secret-scanning-bitbucket-workspace-help"+ isError={Boolean(error)}+ isLoading={areWorkspacesLoading && Boolean(connectionId)}+ isDisabled={!connectionId}+ isClearable={false}+ value={value || null}+ onValueChange={onChange}+ onInputValueChange={setWorkspaceSearch}+ shouldFilter={false}+ includeMissingSelectedOptions={!workspaceSearch}+ options={workspaces.map((workspace) => workspace.slug)}+ placeholder="Search for a workspace..."+ searchAriaLabel="Search workspaces"+ getOptionLabel={(option) => option}+ getOptionValue={(option) => option}+ emptyMessage={(inputValue) =>+ inputValue ? "No workspaces found matching your search." : "No workspaces found."}- }}- onInputChange={(newValue) => setWorkspaceSearch(newValue)}- filterOption={null}- options={workspaces}- placeholder="Search for a workspace..."- getOptionLabel={(option) => option.slug}- getOptionValue={(option) => option.slug}- noOptionsMessage={({ inputValue }) =>- inputValue ? "No workspaces found matching your search." : "No workspaces found."- }- />- </FormControl>+ modal+ />+ <FieldDescription id="secret-scanning-bitbucket-workspace-help">+ Bitbucket requires a workspace to know where to look for repositories.+ </FieldDescription>+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>)}/>- <FormControl label="Scan Repositories">- <Select- value={scanMethod}- onValueChange={(val) => {- setValue("config.includeRepos", val === ScanMethod.AllRepositories ? ["*"] : []);- }}- className="w-full border border-border-strong capitalize"- position="popper"- dropdownContainerClassName="max-w-none"- isDisabled={!connectionId}- >- {Object.values(ScanMethod).map((method) => {- return (- <SelectItem className="capitalize" value={method} key={method}>- {method.replace("-", " ")}- </SelectItem>- );- })}- </Select>- </FormControl>- {scanMethod === ScanMethod.SelectRepositories && (- <Controller- name="config.includeRepos"- control={control}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Include Repositories"- helperText={- <Tooltip- className="max-w-md"- content={<>Ensure that your connection has the correct permissions.</>}- >- <div>- <span>Don't see the repository you're looking for?</span>{" "}- <FontAwesomeIcon icon={faCircleInfo} className="text-muted" />- </div>- </Tooltip>- }- >- <FilterableSelect- menuPlacement="top"- isLoading={areRepositoriesLoading && Boolean(connectionId)}- isDisabled={!connectionId || !selectedWorkspaceSlug}- isMulti- value={repositories?.filter((repository) =>- (value as string[]).includes(repository.full_name)- )}- onChange={(newValue) => {- onChange(- newValue ? (newValue as MultiValue<TBitbucketRepo>).map((p) => p.full_name) : []- );- }}- options={repositories}- placeholder="Select repositories..."- getOptionLabel={(option) => option.full_name}- getOptionValue={(option) => option.full_name}- />- </FormControl>- )}- />- )}</>);};diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitHubDataSourceConfigFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitHubDataSourceConfigFields.tsxindex dea16a4a82..28181d186b 100644--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitHubDataSourceConfigFields.tsx+++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitHubDataSourceConfigFields.tsx@@ -1,126 +1,15 @@-import { useEffect } from "react";-import { Controller, useFormContext, useWatch } from "react-hook-form";-import { MultiValue } from "react-select";-import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { useFormContext, useWatch } from "react-hook-form";-import { FilterableSelect, FormControl, Select, SelectItem, Tooltip } from "@app/components/v2";-import {- TGitHubRadarConnectionRepository,- useGitHubRadarConnectionListRepositories-} from "@app/hooks/api/appConnections/github-radar";import { SecretScanningDataSource } from "@app/hooks/api/secretScanningV2";import { TSecretScanningDataSourceForm } from "../schemas";import { SecretScanningDataSourceConnectionField } from "../SecretScanningDataSourceConnectionField";-enum ScanMethod {- AllRepositories = "all-repositories",- SelectRepositories = "select-repositories"-}+type TGitHubForm = TSecretScanningDataSourceForm & { type: SecretScanningDataSource.GitHub };-export const GitHubDataSourceConfigFields = () => {- const { control, watch, setValue } = useFormContext<- TSecretScanningDataSourceForm & {- type: SecretScanningDataSource.GitHub;- }- >();+export const GitHubDataSourceConnectionFields = () => {+ const { control } = useFormContext<TGitHubForm>();+ const isUpdate = Boolean(useWatch({ control, name: "id" }));- const connectionId = useWatch({ control, name: "connection.id" });- const isUpdate = Boolean(watch("id"));-- const { data: repositories, isPending: areRepositoriesLoading } =- useGitHubRadarConnectionListRepositories(connectionId, { enabled: Boolean(connectionId) });-- const includeRepos = watch("config.includeRepos");-- const scanMethod =- !includeRepos || includeRepos[0] === "*"- ? ScanMethod.AllRepositories- : ScanMethod.SelectRepositories;-- useEffect(() => {- if (!includeRepos) {- setValue("config.includeRepos", ["*"]);- }- }, [includeRepos, setValue]);-- return (- <>- <SecretScanningDataSourceConnectionField- isUpdate={isUpdate}- onChange={() => {- if (scanMethod === ScanMethod.SelectRepositories) {- setValue("config.includeRepos", []);- }- }}- />- <FormControl label="Scan Repositories">- <Select- value={scanMethod}- onValueChange={(val) => {- setValue("config.includeRepos", val === ScanMethod.AllRepositories ? ["*"] : []);- }}- className="w-full border border-border-strong capitalize"- position="popper"- dropdownContainerClassName="max-w-none"- isDisabled={!connectionId}- >- {Object.values(ScanMethod).map((method) => {- return (- <SelectItem className="capitalize" value={method} key={method}>- {method.replace("-", " ")}- </SelectItem>- );- })}- </Select>- </FormControl>- {scanMethod === ScanMethod.SelectRepositories && (- <Controller- name="config.includeRepos"- defaultValue={["*"]}- control={control}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Include Repositories"- helperText={- <Tooltip- className="max-w-md"- content={<>Ensure that your connection has the correct permissions.</>}- >- <div>- <span>Don't see the repository you're looking for?</span>{" "}- <FontAwesomeIcon icon={faCircleInfo} className="text-muted" />- </div>- </Tooltip>- }- >- <FilterableSelect- menuPlacement="top"- isLoading={areRepositoriesLoading && Boolean(connectionId)}- isDisabled={!connectionId}- isMulti- value={repositories?.filter((repository) => value.includes(repository.name))}- onChange={(newValue) => {- onChange(- newValue- ? (newValue as MultiValue<TGitHubRadarConnectionRepository>).map(- (p) => p.name- )- : null- );- }}- options={repositories}- placeholder="Select repositories..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.name}- />- </FormControl>- )}- />- )}- </>- );+ return <SecretScanningDataSourceConnectionField isUpdate={isUpdate} />;};diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsxindex 82561264e7..badf366d0a 100644--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsx+++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsx@@ -1,10 +1,19 @@-import { useEffect, useMemo, useState } from "react";+import { useMemo, useState } from "react";import { Controller, useFormContext, useWatch } from "react-hook-form";-import { MultiValue, SingleValue } from "react-select";-import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { FilterableSelect, FormControl, Select, SelectItem, Tooltip } from "@app/components/v2";+import {+ Combobox,+ Field,+ FieldContent,+ FieldDescription,+ FieldError,+ FieldLabel,+ FieldLegend,+ FieldSet,+ FieldTitle,+ RadioGroup,+ RadioGroupItem+} from "@app/components/v3";import { useDebounce } from "@app/hooks";import {TGitLabGroup,@@ -18,52 +27,37 @@ import { GitLabDataSourceScope } from "@app/hooks/api/secretScanningV2/types/gitimport { TSecretScanningDataSourceForm } from "../schemas";import { SecretScanningDataSourceConnectionField } from "../SecretScanningDataSourceConnectionField";-enum ScanMethod {- AllProjects = "all-projects",- SelectProjects = "select-projects"-}-const GITLAB_DATA_SOURCE_LIST_LIMIT = 20;-const formatGitLabGroupOptionLabel = (group: TGitLabGroup) => (- <div className="flex min-w-0 items-center gap-2">- <span className="shrink-0">{group.name}</span>- {group.fullPath !== group.name && (- <span className="min-w-0 truncate text-muted">{group.fullPath}</span>- )}- </div>-);+const SEARCH_HELP =+ "Only the first results are shown. Search by name to find more. The connection must have access to it.";-const formatGitLabProjectOptionLabel = (project: TGitLabProject) => {- const fullPathWithNamespace = project.name;- const shortName = fullPathWithNamespace.split("/").pop() || fullPathWithNamespace;+const SCOPE_OPTIONS = [+ {+ scope: GitLabDataSourceScope.Project,+ title: "Project",+ description: "Scan a single GitLab project."+ },+ {+ scope: GitLabDataSourceScope.Group,+ title: "Group",+ description:+ "Scan projects in a GitLab group. Required to scan projects added to the group later."+ }+];- return (- <div className="flex min-w-0 items-center gap-2">- <span className="shrink-0">{shortName}</span>- {fullPathWithNamespace !== shortName && (- <span className="min-w-0 truncate text-muted">{fullPathWithNamespace}</span>- )}- </div>- );-};+type TGitLabForm = TSecretScanningDataSourceForm & { type: SecretScanningDataSource.GitLab };-export const GitLabDataSourceConfigFields = () => {- const { control, watch, setValue } = useFormContext<- TSecretScanningDataSourceForm & {- type: SecretScanningDataSource.GitLab;- }- >();+export const GitLabDataSourceConnectionFields = () => {+ const { control, setValue } = useFormContext<TGitLabForm>();const connectionId = useWatch({ control, name: "connection.id" });- const isUpdate = Boolean(watch("id"));-- const scope = watch("config.scope");- const groupName = watch("config.groupName");- const includeProjects = watch("config.includeProjects");- const projectId = watch("config.projectId");- const projectName = watch("config.projectName");- const groupId = watch("config.groupId");+ const isUpdate = Boolean(useWatch({ control, name: "id" }));+ const scope = useWatch({ control, name: "config.scope" });+ const groupId = useWatch({ control, name: "config.groupId" });+ const groupName = useWatch({ control, name: "config.groupName" });+ const projectId = useWatch({ control, name: "config.projectId" });+ const projectName = useWatch({ control, name: "config.projectName" });const [projectSearch, setProjectSearch] = useState("");const [debouncedProjectSearch] = useDebounce(projectSearch, 300);@@ -74,25 +68,19 @@ export const GitLabDataSourceConfigFields = () => {connectionId,debouncedProjectSearch || undefined,GITLAB_DATA_SOURCE_LIST_LIMIT,- { enabled: Boolean(connectionId) }+ { enabled: Boolean(connectionId) && scope === GitLabDataSourceScope.Project });const { data: groups, isPending: isGroupsPending } = useGitLabConnectionListGroups(connectionId,debouncedGroupSearch || undefined,GITLAB_DATA_SOURCE_LIST_LIMIT,- {- enabled: Boolean(connectionId) && scope === GitLabDataSourceScope.Group- }+ { enabled: Boolean(connectionId) && scope === GitLabDataSourceScope.Group });const groupOptions = useMemo(() => {const results = groups ?? [];- if (- groupId &&- groupName &&- !results.some((group) => Number.parseInt(group.id, 10) === groupId)- ) {+ if (groupId && groupName && !results.some((group) => Number(group.id) === groupId)) {return [{ id: String(groupId), name: groupName, fullName: groupName, fullPath: groupName },...results@@ -103,41 +91,13 @@ export const GitLabDataSourceConfigFields = () => {const projectOptions = useMemo(() => {const results = projects ?? [];- if (- projectId &&- projectName &&- !results.some((project) => Number.parseInt(project.id, 10) === projectId)- ) {+ if (projectId && projectName && !results.some((project) => Number(project.id) === projectId)) {return [{ id: String(projectId), name: projectName }, ...results];}return results;}, [projects, projectId, projectName]);- const includeProjectOptions = useMemo(() => {- const selectedGroupPath = (groups ?? []).find(- (group) => Number.parseInt(group.id, 10) === groupId- )?.fullPath;- const filtered = (projects ?? []).filter(- (project) => !selectedGroupPath || project.name.startsWith(`${selectedGroupPath}/`)- );- const missing = (includeProjects ?? [])- .filter((name) => name !== "*" && !filtered.some((project) => project.name === name))- .map((name) => ({ id: name, name }));- return [...missing, ...filtered];- }, [projects, groups, groupId, includeProjects]);-- const scanMethod =- !includeProjects || includeProjects.includes("*")- ? ScanMethod.AllProjects- : ScanMethod.SelectProjects;-- useEffect(() => {- if (!includeProjects) {- setValue("config.includeProjects", ["*"]);- }- }, [includeProjects]);-- const clearAllFields = () => {+ const clearConfig = () => {setValue("config.includeProjects", []);setValue("config.projectName", "");setValue("config.groupName", "");@@ -151,57 +111,43 @@ export const GitLabDataSourceConfigFields = () => {return (<>- <SecretScanningDataSourceConnectionField isUpdate={isUpdate} onChange={clearAllFields} />+ <SecretScanningDataSourceConnectionField isUpdate={isUpdate} onChange={clearConfig} /><Controllername="config.scope"control={control}- defaultValue={GitLabDataSourceScope.Project}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Scope"- helperText={isUpdate ? "Cannot be updated" : undefined}- tooltipText={- <div className="flex flex-col gap-3">- <p>Specify the GitLab scope scanning should be performed at:</p>- <ul className="flex list-disc flex-col gap-3 pl-4">- <li>- <p className="text-label">- <span className="font-medium text-foreground-soft">Project</span>: Scan an- individual GitLab project.- </p>- </li>- <li>- <p className="text-label">- <span className="font-medium text-foreground-soft">Group</span>: Scan one or- more projects belonging to a GitLab group.- </p>- </li>- </ul>- </div>- }- >- <Select+ render={({ field: { value, onChange } }) => (+ <FieldSet>+ <FieldLegend variant="label">Scope</FieldLegend>+ <RadioGroupvalue={value}- onValueChange={(v) => {- onChange(v);- clearAllFields();+ onValueChange={(newScope) => {+ onChange(newScope);+ clearConfig();+ setValue("isDiscoveryEnabled", newScope === GitLabDataSourceScope.Group);}}- className="w-full border border-border-strong capitalize"- position="popper"- isDisabled={isUpdate}- dropdownContainerClassName="max-w-none"+ disabled={isUpdate}>- {Object.values(GitLabDataSourceScope).map((method) => {- return (- <SelectItem className="capitalize" value={method} key={method}>- {method}- </SelectItem>- );- })}- </Select>- </FormControl>+ {SCOPE_OPTIONS.map((option) => (+ <FieldLabel+ key={option.scope}+ htmlFor={`secret-scanning-gitlab-scope-${option.scope}`}+ variant="project"+ >+ <Field orientation="horizontal">+ <FieldContent>+ <FieldTitle>{option.title}</FieldTitle>+ <FieldDescription>{option.description}</FieldDescription>+ </FieldContent>+ <RadioGroupItem+ value={option.scope}+ id={`secret-scanning-gitlab-scope-${option.scope}`}+ />+ </Field>+ </FieldLabel>+ ))}+ </RadioGroup>+ {isUpdate && <FieldDescription>Cannot be updated.</FieldDescription>}+ </FieldSet>)}/>{scope === GitLabDataSourceScope.Project ? (@@ -209,179 +155,94 @@ export const GitLabDataSourceConfigFields = () => {name="config.projectId"control={control}render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Project"- helperText={- <Tooltip- className="max-w-md"- content={- <>- Ensure the project exists in the connection's GitLab instance URL and the- connection has access to it. Only the first results are shown, search by name- to find more.- </>+ <Field data-invalid={Boolean(error)}>+ <FieldLabel+ id="secret-scanning-gitlab-project-label"+ htmlFor="secret-scanning-gitlab-project"+ >+ Project+ </FieldLabel>+ <FieldContent>+ <Combobox<TGitLabProject>+ id="secret-scanning-gitlab-project"+ aria-labelledby="secret-scanning-gitlab-project-label"+ aria-describedby="secret-scanning-gitlab-project-help"+ isError={Boolean(error)}+ isLoading={isProjectsPending && Boolean(connectionId)}+ isDisabled={!connectionId || isUpdate}+ isClearable={false}+ value={projectOptions.find((project) => Number(project.id) === value) ?? null}+ onValueChange={(project) => {+ onChange(Number(project.id));+ setValue("config.projectName", project.name);+ }}+ onInputValueChange={setProjectSearch}+ shouldFilter={false}+ options={projectOptions}+ placeholder="Search for a project..."+ searchAriaLabel="Search projects"+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ emptyMessage={(inputValue) =>+ inputValue ? "No projects found matching your search." : "No projects found."}- >- <div>- <span>Don't see the project you're looking for?</span>{" "}- <FontAwesomeIcon icon={faCircleInfo} className="text-muted" />- </div>- </Tooltip>- }- >- <FilterableSelect- isLoading={isProjectsPending && Boolean(connectionId)}- isDisabled={!connectionId}- value={projectOptions.find((project) => value === Number.parseInt(project.id, 10))}- onChange={(newValue) => {- const project = newValue as SingleValue<TGitLabProject>;-- onChange(project ? Number.parseInt(project.id, 10) : null);- setValue("config.projectName", project?.name ?? "");- }}- onInputChange={(newValue) => setProjectSearch(newValue)}- filterOption={null}- options={projectOptions}- placeholder="Search for a project..."- getOptionLabel={(option) => {- const shortName = option.name.split("/").pop() || option.name;- return `${shortName} · ${option.name}`;- }}- formatOptionLabel={formatGitLabProjectOptionLabel}- getOptionValue={(option) => option.name}- />- </FormControl>+ modal+ />+ <FieldDescription id="secret-scanning-gitlab-project-help">+ {SEARCH_HELP}+ </FieldDescription>+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>)}/>) : (- <>- <Controller- name="config.groupId"- control={control}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Group"- helperText={- <Tooltip- className="max-w-md"- content={- <>- Ensure the group exists in the connection's GitLab instance URL and the- connection has access to it. Only the first results are shown, search by- name to find more.- </>- }- >- <div>- <span>Don't see the group you're looking for?</span>{" "}- <FontAwesomeIcon icon={faCircleInfo} className="text-muted" />- </div>- </Tooltip>- }+ <Controller+ name="config.groupId"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field data-invalid={Boolean(error)}>+ <FieldLabel+ id="secret-scanning-gitlab-group-label"+ htmlFor="secret-scanning-gitlab-group">- <FilterableSelect+ Group+ </FieldLabel>+ <FieldContent>+ <Combobox<TGitLabGroup>+ id="secret-scanning-gitlab-group"+ aria-labelledby="secret-scanning-gitlab-group-label"+ aria-describedby="secret-scanning-gitlab-group-help"+ isError={Boolean(error)}isLoading={isGroupsPending && Boolean(connectionId)}- isDisabled={!connectionId}- value={groupOptions.find((group) => value === Number.parseInt(group.id, 10))}- onChange={(newValue) => {- const group = newValue as SingleValue<TGitLabGroup>;-- onChange(group ? Number.parseInt(group.id, 10) : null);- setValue("config.groupName", group?.fullName ?? "");- setValue("config.includeProjects", ["*"]);+ isDisabled={!connectionId || isUpdate}+ isClearable={false}+ value={groupOptions.find((group) => Number(group.id) === value) ?? null}+ onValueChange={(group) => {+ onChange(Number(group.id));+ setValue("config.groupName", group.fullName);+ setValue("config.includeProjects", []);}}- onInputChange={(newValue) => setGroupSearch(newValue)}- filterOption={null}+ onInputValueChange={setGroupSearch}+ shouldFilter={false}options={groupOptions}placeholder="Search for a group..."- getOptionLabel={(option) => `${option.name} · ${option.fullPath}`}- formatOptionLabel={formatGitLabGroupOptionLabel}+ searchAriaLabel="Search groups"+ getOptionLabel={(option) => option.fullPath}getOptionValue={(option) => option.id}- />- </FormControl>- )}- />- <FormControl label="Scan Projects">- <Select- value={scanMethod}- onValueChange={(val) => {- setValue("config.includeProjects", val === ScanMethod.AllProjects ? ["*"] : []);- }}- className="w-full border border-border-strong capitalize"- position="popper"- dropdownContainerClassName="max-w-none"- isDisabled={!connectionId}- >- {Object.values(ScanMethod).map((method) => {- return (- <SelectItem className="capitalize" value={method} key={method}>- {method.replace("-", " ")}- </SelectItem>- );- })}- </Select>- </FormControl>- {scanMethod === ScanMethod.SelectProjects && (- <Controller- name="config.includeProjects"- defaultValue={["*"]}- control={control}- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- isError={Boolean(error)}- errorText={error?.message}- label="Include Projects"- helperText={- <Tooltip- className="max-w-md"- content={- <>- Ensure the project exists in the connection's GitLab instance URL and- the connection has access to it. Only the first results are shown, search- by name to find more.- </>- }- >- <div>- <span>Don't see the project you're looking for?</span>{" "}- <FontAwesomeIcon icon={faCircleInfo} className="text-muted" />- </div>- </Tooltip>+ emptyMessage={(inputValue) =>+ inputValue ? "No groups found matching your search." : "No groups found."}- >- <FilterableSelect- menuPlacement="top"- isLoading={isProjectsPending && Boolean(connectionId)}- isDisabled={!connectionId || !groupName}- isMulti- value={includeProjectOptions.filter((project) => value.includes(project.name))}- onChange={(newValue) => {- onChange(- newValue- ? (newValue as MultiValue<TGitLabProject>).map((p) => p.name)- : null- );- }}- onInputChange={(newValue) => setProjectSearch(newValue)}- filterOption={null}- options={includeProjectOptions}- placeholder="Search for projects..."- getOptionLabel={(option) => {- const shortName = option.name.split("/").pop() || option.name;- return `${shortName} · ${option.name}`;- }}- formatOptionLabel={formatGitLabProjectOptionLabel}- getOptionValue={(option) => option.name}- />- </FormControl>- )}- />+ modal+ />+ <FieldDescription id="secret-scanning-gitlab-group-help">+ {SEARCH_HELP}+ </FieldDescription>+ <FieldError errors={[error]} />+ </FieldContent>+ </Field>)}- </>+ />)}</>);diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/SecretScanningDataSourceConfigFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/SecretScanningDataSourceConfigFields.tsxindex ad6c696315..dccde815d3 100644--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/SecretScanningDataSourceConfigFields.tsx+++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/SecretScanningDataSourceConfigFields.tsx@@ -1,64 +1,128 @@-import { Controller, useFormContext } from "react-hook-form";+import { Controller, useFormContext, useWatch } from "react-hook-form";-import { Field, FieldDescription, FieldError, FieldLabel, Toggle } from "@app/components/v3";-import { RESOURCE_DESCRIPTION_HELPER } from "@app/helpers/secretScanningV2";+import {+ Field,+ FieldContent,+ FieldDescription,+ FieldError,+ FieldGroup,+ Label,+ Toggle+} from "@app/components/v3";+import {+ doesDataSourceSupportDiscovery,+ RESOURCE_DESCRIPTION_HELPER,+ SECRET_SCANNING_DATA_SOURCE_MAP+} from "@app/helpers/secretScanningV2";import { SecretScanningDataSource } from "@app/hooks/api/secretScanningV2";import { TSecretScanningDataSourceForm } from "../schemas";-import { BitbucketDataSourceConfigFields } from "./BitbucketDataSourceConfigFields";-import { GitHubDataSourceConfigFields } from "./GitHubDataSourceConfigFields";-import { GitLabDataSourceConfigFields } from "./GitLabDataSourceConfigFields";+import { BitbucketDataSourceConnectionFields } from "./BitbucketDataSourceConfigFields";+import { GitHubDataSourceConnectionFields } from "./GitHubDataSourceConfigFields";+import { GitLabDataSourceConnectionFields } from "./GitLabDataSourceConfigFields";-const COMPONENT_MAP: Record<SecretScanningDataSource, React.FC> = {- [SecretScanningDataSource.GitHub]: GitHubDataSourceConfigFields,- [SecretScanningDataSource.Bitbucket]: BitbucketDataSourceConfigFields,- [SecretScanningDataSource.GitLab]: GitLabDataSourceConfigFields+const CONNECTION_COMPONENT_MAP: Record<SecretScanningDataSource, React.FC> = {+ [SecretScanningDataSource.GitHub]: GitHubDataSourceConnectionFields,+ [SecretScanningDataSource.Bitbucket]: BitbucketDataSourceConnectionFields,+ [SecretScanningDataSource.GitLab]: GitLabDataSourceConnectionFields};-export const SecretScanningDataSourceConfigFields = () => {- const { watch, control } = useFormContext<TSecretScanningDataSourceForm>();+export const SecretScanningDataSourceConnectionFields = () => {+ const { control } = useFormContext<TSecretScanningDataSourceForm>();+ const type = useWatch({ control, name: "type" });- const type = watch("type");-- const Component = COMPONENT_MAP[type];- const autoScanDescription = RESOURCE_DESCRIPTION_HELPER[type];+ const Component = CONNECTION_COMPONENT_MAP[type];return (- <>- <p className="mb-4 text-sm text-label-secondary">Connect and configure your Data Source.</p>+ <FieldGroup><Component />- <Controller- control={control}- name="isAutoScanEnabled"- render={({ field: { value, onChange, onBlur, ref, name }, fieldState: { error } }) => {- return (- <Field className="mb-4" data-invalid={Boolean(error)}>- <div className="flex items-center gap-3">- <Toggle- ref={ref}- name={name}- id="auto-scan-enabled"- variant="success"- onCheckedChange={onChange}- onBlur={onBlur}- checked={value}- aria-invalid={Boolean(error)}- aria-describedby={`auto-scan-enabled-help${error ? " auto-scan-enabled-error" : ""}`}- />- <FieldLabel htmlFor="auto-scan-enabled">- Auto-Scan {value ? "Enabled" : "Disabled"}- </FieldLabel>- </div>- <FieldDescription id="auto-scan-enabled-help">- {value- ? `Scans will automatically be triggered when a ${autoScanDescription.verb} occurs to ${autoScanDescription.pluralNoun} associated with this data source.`- : "Manually trigger scans to detect secret leaks."}- </FieldDescription>- <FieldError id="auto-scan-enabled-error">{error?.message}</FieldError>- </Field>- );- }}+ </FieldGroup>+ );+};++type TScanToggleName = "isHistoricalScanEnabled" | "isScanNewCommitsEnabled" | "isDiscoveryEnabled";++const ScanToggleField = ({+ name,+ label,+ description,+ isDisabled+}: {+ name: TScanToggleName;+ label: string;+ description: string;+ isDisabled?: boolean;+}) => {+ const { control } = useFormContext<TSecretScanningDataSourceForm>();++ return (+ <Controller+ control={control}+ name={name}+ render={({ field: { value, onChange, onBlur, ref }, fieldState: { error } }) => (+ <Field data-invalid={Boolean(error)} data-disabled={isDisabled}>+ <Field orientation="horizontal">+ <FieldContent>+ <Label htmlFor={name}>{label}</Label>+ <FieldDescription id={`${name}-help`}>{description}</FieldDescription>+ </FieldContent>+ <Toggle+ ref={ref}+ name={name}+ id={name}+ variant="project"+ checked={value}+ onCheckedChange={onChange}+ onBlur={onBlur}+ disabled={isDisabled}+ aria-describedby={`${name}-help`}+ />+ </Field>+ <FieldError errors={[error]} />+ </Field>+ )}+ />+ );+};++export const SecretScanningDataSourceScanFields = () => {+ const { control } = useFormContext<TSecretScanningDataSourceForm>();+ const type = useWatch({ control, name: "type" });+ const config = useWatch({ control, name: "config" });++ const { name: platform } = SECRET_SCANNING_DATA_SOURCE_MAP[type];+ const { pluralNoun, pluralTitle } = RESOURCE_DESCRIPTION_HELPER[type];+ const supportsDiscovery = doesDataSourceSupportDiscovery({ type, config });++ return (+ <FieldGroup>+ <ScanToggleField+ name="isHistoricalScanEnabled"+ label="Trigger Historical Scan"+ description={`Scan recently added ${pluralNoun} for existing secrets as soon as they're enabled.`}+ />+ <ScanToggleField+ name="isScanNewCommitsEnabled"+ label="Scan New Commits"+ description={`Trigger a diff scan on every new commit, across new and existing ${pluralNoun}.`}/>- </>+ <ScanToggleField+ name="isDiscoveryEnabled"+ label={`Discover New ${pluralTitle}`}+ isDisabled={!supportsDiscovery}+ description={+ supportsDiscovery+ ? `Automatically enable scanning for new ${pluralNoun} added to ${platform}.`+ : `Requires a group scope. GitLab discovery relies on group-level webhooks, which aren't available for a single project.`+ }+ />+ </FieldGroup>);};++export const SecretScanningDataSourceConfigFields = () => (+ <FieldGroup>+ <SecretScanningDataSourceConnectionFields />+ <SecretScanningDataSourceScanFields />+ </FieldGroup>+);diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConnectionField.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConnectionField.tsxindex efdf527b73..875350ffa0 100644--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConnectionField.tsx+++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConnectionField.tsx@@ -6,6 +6,7 @@ import { AppConnectionOptionContent } from "@app/components/app-connections";import {Combobox,Field,+ FieldContent,FieldDescription,FieldError,FieldLabel,@@ -66,7 +67,7 @@ export const SecretScanningDataSourceConnectionField = ({<><Controllerrender={({ field: { value, onChange, onBlur, name }, fieldState: { error } }) => (- <Field className="mb-4" data-invalid={Boolean(error)} data-disabled={isUpdate}>+ <Field data-invalid={Boolean(error)} data-disabled={isUpdate}><div className="flex items-center gap-1"><FieldLabel htmlFor="secret-scanning-data-source-connection">{connectionName} Connection@@ -87,75 +88,78 @@ export const SecretScanningDataSourceConnectionField = ({</TooltipContent></Tooltip></div>- <Combobox<{ id: string; name: string; projectId?: string | null }>- id="secret-scanning-data-source-connection"- name={name}- onBlur={onBlur}- value={value}- modal- onPopupOpenChange={onPopupOpenChange}- isClearable={false}- onValueChange={(newValue) => {- if (newValue.id === "_create") {- handlePopUpOpen("addConnection");- onChange(null);- // store for oauth callback connections- localStorage.setItem("secretScanningDataSourceFormData", JSON.stringify(watch()));- if (callback) callback();- return;- }+ <FieldContent>+ <Combobox<{ id: string; name: string; projectId?: string | null }>+ id="secret-scanning-data-source-connection"+ name={name}+ onBlur={onBlur}+ value={value}+ modal+ onPopupOpenChange={onPopupOpenChange}+ isClearable={false}+ onValueChange={(newValue) => {+ if (newValue.id === "_create") {+ handlePopUpOpen("addConnection");+ onChange(null);+ // store for oauth callback connections+ localStorage.setItem(+ "secretScanningDataSourceFormData",+ JSON.stringify(watch())+ );+ if (callback) callback();+ return;+ }- onChange(newValue);- if (callback) callback();- }}- isLoading={isPending}- options={[- ...(canCreateConnection ? [{ id: "_create", name: "Create Connection" }] : []),- ...(availableConnections ?? [])- ]}- isDisabled={isUpdate}- isError={Boolean(error)}- aria-describedby={`secret-scanning-data-source-connection-help${error ? " secret-scanning-data-source-connection-error" : ""}`}- placeholder="Select connection..."- searchAriaLabel={`Search ${connectionName} connections`}- loadingMessage={`Loading ${connectionName} connections...`}- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.id}- renderOption={(option) => (- <AppConnectionOptionContent- data={option}- isOnlyOption={option.id === "_create" && !availableConnections?.length}- />- )}- />- <FieldDescription id="secret-scanning-data-source-connection-help">- {isUpdate ? (- "Cannot be updated"- ) : (- <>- Check out{" "}- <a- href={`https://infisical.com/docs/integrations/app-connections/${app}`}- target="_blank"- rel="noopener noreferrer"- >- our docs- </a>{" "}- to ensure your connection has the required permissions for secret scanning.- </>- )}- </FieldDescription>- <FieldError id="secret-scanning-data-source-connection-error">- {error?.message}- </FieldError>+ onChange(newValue);+ if (callback) callback();+ }}+ isLoading={isPending}+ options={[+ ...(canCreateConnection ? [{ id: "_create", name: "Create Connection" }] : []),+ ...(availableConnections ?? [])+ ]}+ isDisabled={isUpdate}+ isError={Boolean(error)}+ aria-describedby={`secret-scanning-data-source-connection-help${error ? " secret-scanning-data-source-connection-error" : ""}`}+ placeholder="Select connection..."+ searchAriaLabel={`Search ${connectionName} connections`}+ loadingMessage={`Loading ${connectionName} connections...`}+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ renderOption={(option) => (+ <AppConnectionOptionContent+ data={option}+ isOnlyOption={option.id === "_create" && !availableConnections?.length}+ />+ )}+ />+ <FieldDescription id="secret-scanning-data-source-connection-help">+ {isUpdate ? (+ "Cannot be updated"+ ) : (+ <>+ Check out{" "}+ <a+ href={`https://infisical.com/docs/integrations/app-connections/${app}`}+ target="_blank"+ rel="noopener noreferrer"+ >+ our docs+ </a>{" "}+ to ensure your connection has the required permissions for secret scanning.+ </>+ )}+ </FieldDescription>+ <FieldError id="secret-scanning-data-source-connection-error" errors={[error]} />+ </FieldContent></Field>)}control={control}name="connection"/>{!isUpdate && !isPending && !availableConnections?.length && !canCreateConnection && (- <p className="-mt-2.5 mb-2.5 text-xs text-warning">- <InfoIcon className="mr-1 inline size-3" />+ <p className="flex items-center gap-1.5 text-xs text-warning">+ <InfoIcon className="size-3.5" />You do not have access to any {connectionName} Connections. Contact an admin to createone.</p>diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceDetailsFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceDetailsFields.tsxindex a73e402cf5..3e0423fc55 100644--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceDetailsFields.tsx+++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceDetailsFields.tsx@@ -2,8 +2,10 @@ import { Controller, useFormContext } from "react-hook-form";import {Field,+ FieldContent,FieldDescription,FieldError,+ FieldGroup,FieldLabel,Input,TextArea@@ -15,28 +17,26 @@ export const SecretScanningDataSourceDetailsFields = () => {const { control } = useFormContext<TSecretScanningDataSourceForm>();return (- <>- <p className="mb-4 text-sm text-label-secondary">- Provide a name and description for this Data Source.- </p>+ <FieldGroup><Controllerrender={({ field, fieldState: { error } }) => (- <Field className="mb-4" data-invalid={Boolean(error)}>+ <Field data-invalid={Boolean(error)}><FieldLabel htmlFor="secret-scanning-data-source-name">Name</FieldLabel>- <Input- {...field}- id="secret-scanning-data-source-name"- autoFocus- placeholder="my-data-source"- autoComplete="off"- name="secret-scanning-data-source-name"- aria-invalid={Boolean(error)}- aria-describedby={`secret-scanning-data-source-name-help${error ? " secret-scanning-data-source-name-error" : ""}`}- />- <FieldDescription id="secret-scanning-data-source-name-help">- Must be slug-friendly- </FieldDescription>- <FieldError id="secret-scanning-data-source-name-error">{error?.message}</FieldError>+ <FieldContent>+ <Input+ {...field}+ id="secret-scanning-data-source-name"+ autoFocus+ placeholder="acme-org"+ autoComplete="off"+ isError={Boolean(error)}+ aria-describedby="secret-scanning-data-source-name-help"+ />+ <FieldDescription id="secret-scanning-data-source-name-help">+ Shown in the data source list, findings, and audit logs. Must be slug-friendly.+ </FieldDescription>+ <FieldError errors={[error]} />+ </FieldContent></Field>)}control={control}@@ -44,28 +44,26 @@ export const SecretScanningDataSourceDetailsFields = () => {/><Controllerrender={({ field, fieldState: { error } }) => (- <Field className="mb-4" data-invalid={Boolean(error)}>+ <Field data-invalid={Boolean(error)}><FieldLabel htmlFor="secret-scanning-data-source-description">- Description <span className="text-muted">(optional)</span>+ Description (Optional)</FieldLabel>- <TextArea- {...field}- id="secret-scanning-data-source-description"- value={field.value ?? ""}- placeholder="Provide a description for this data source..."- className="resize-none!"- rows={4}- aria-invalid={Boolean(error)}- aria-describedby={error ? "secret-scanning-data-source-description-error" : undefined}- />- <FieldError id="secret-scanning-data-source-description-error">- {error?.message}- </FieldError>+ <FieldContent>+ <TextArea+ {...field}+ id="secret-scanning-data-source-description"+ value={field.value ?? ""}+ placeholder="Describe what this data source scans..."+ rows={4}+ aria-invalid={Boolean(error)}+ />+ <FieldError errors={[error]} />+ </FieldContent></Field>)}control={control}name="description"/>- </>+ </FieldGroup>);};diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceForm.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceForm.tsxindex 924729ca3e..14432335b8 100644--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceForm.tsx+++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceForm.tsx@@ -32,7 +32,17 @@ type Props = {const FORM_TABS: { name: string; key: string; fields: (keyof TSecretScanningDataSourceForm)[] }[] =[- { name: "Configuration", key: "config", fields: ["config", "isAutoScanEnabled", "connection"] },+ {+ name: "Configuration",+ key: "config",+ fields: [+ "config",+ "isHistoricalScanEnabled",+ "isScanNewCommitsEnabled",+ "isDiscoveryEnabled",+ "connection"+ ]+ },{ name: "Details", key: "details", fields: ["name", "description"] },{ name: "Review", key: "review", fields: [] }];@@ -55,7 +65,9 @@ export const SecretScanningDataSourceForm = ({resolver: zodResolver(SecretScanningDataSourceSchema),defaultValues: dataSource ?? {type,- isAutoScanEnabled: true, // scott: this may need to be derived from type in the future+ isHistoricalScanEnabled: true,+ isScanNewCommitsEnabled: true,+ isDiscoveryEnabled: true,...(initialFormData as object)},reValidateMode: "onChange"diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/BitbucketDataSourceReviewFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/BitbucketDataSourceReviewFields.tsxdeleted file mode 100644index dc48336cee..0000000000--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/BitbucketDataSourceReviewFields.tsx+++ /dev/null@@ -1,37 +0,0 @@-import { useFormContext } from "react-hook-form";--import { Detail, DetailLabel, DetailValue } from "@app/components/v3";-import { SecretScanningDataSource } from "@app/hooks/api/secretScanningV2";--import { TSecretScanningDataSourceForm } from "../schemas";-import { SecretScanningDataSourceConfigReviewSection } from "./shared";--export const BitbucketDataSourceReviewFields = () => {- const { watch } = useFormContext<- TSecretScanningDataSourceForm & {- type: SecretScanningDataSource.Bitbucket;- }- >();-- const [{ includeRepos, workspaceSlug }, connection] = watch(["config", "connection"]);- const shouldScanAll = includeRepos[0] === "*";-- return (- <SecretScanningDataSourceConfigReviewSection>- {connection && (- <Detail>- <DetailLabel>Connection</DetailLabel>- <DetailValue>{connection.name || "None"}</DetailValue>- </Detail>- )}- <Detail>- <DetailLabel>Workspace Slug</DetailLabel>- <DetailValue>{workspaceSlug || "None"}</DetailValue>- </Detail>- <Detail>- <DetailLabel>Scan Repositories</DetailLabel>- <DetailValue>{shouldScanAll ? "All" : includeRepos.join(", ") || "None"}</DetailValue>- </Detail>- </SecretScanningDataSourceConfigReviewSection>- );-};diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/GitHubDataSourceReviewFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/GitHubDataSourceReviewFields.tsxdeleted file mode 100644index f28df434a2..0000000000--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/GitHubDataSourceReviewFields.tsx+++ /dev/null@@ -1,33 +0,0 @@-import { useFormContext } from "react-hook-form";--import { Detail, DetailLabel, DetailValue } from "@app/components/v3";-import { SecretScanningDataSource } from "@app/hooks/api/secretScanningV2";--import { TSecretScanningDataSourceForm } from "../schemas";-import { SecretScanningDataSourceConfigReviewSection } from "./shared";--export const GitHubDataSourceReviewFields = () => {- const { watch } = useFormContext<- TSecretScanningDataSourceForm & {- type: SecretScanningDataSource.GitHub;- }- >();-- const [{ includeRepos }, connection] = watch(["config", "connection"]);- const shouldScanAll = includeRepos[0] === "*";-- return (- <SecretScanningDataSourceConfigReviewSection>- {connection && (- <Detail>- <DetailLabel>Connection</DetailLabel>- <DetailValue>{connection.name || "None"}</DetailValue>- </Detail>- )}- <Detail>- <DetailLabel>Scan Repositories</DetailLabel>- <DetailValue>{shouldScanAll ? "All" : includeRepos.join(", ") || "None"}</DetailValue>- </Detail>- </SecretScanningDataSourceConfigReviewSection>- );-};diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/GitLabDataSourceReviewFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/GitLabDataSourceReviewFields.tsxdeleted file mode 100644index 190db7235b..0000000000--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/GitLabDataSourceReviewFields.tsx+++ /dev/null@@ -1,68 +0,0 @@-import { useFormContext } from "react-hook-form";--import { Detail, DetailLabel, DetailValue } from "@app/components/v3";-import { SecretScanningDataSource } from "@app/hooks/api/secretScanningV2";-import { GitLabDataSourceScope } from "@app/hooks/api/secretScanningV2/types/gitlab-data-source";--import { TSecretScanningDataSourceForm } from "../schemas";-import { SecretScanningDataSourceConfigReviewSection } from "./shared";--export const GitLabDataSourceReviewFields = () => {- const { watch } = useFormContext<- TSecretScanningDataSourceForm & {- type: SecretScanningDataSource.GitLab;- }- >();-- const [config, connection] = watch(["config", "connection"]);-- if (config.scope === GitLabDataSourceScope.Project) {- const { projectName, projectId } = config;- return (- <SecretScanningDataSourceConfigReviewSection>- {connection && (- <Detail>- <DetailLabel>Connection</DetailLabel>- <DetailValue>{connection.name || "None"}</DetailValue>- </Detail>- )}- <Detail>- <DetailLabel>Scope</DetailLabel>- <DetailValue>Project</DetailValue>- </Detail>- <Detail>- <DetailLabel>Project</DetailLabel>- <DetailValue>{projectName || projectId || "None"}</DetailValue>- </Detail>- </SecretScanningDataSourceConfigReviewSection>- );- }-- // group-scope-- const { includeProjects, groupName, groupId } = config;- const shouldScanAll = includeProjects.includes("*");-- return (- <SecretScanningDataSourceConfigReviewSection>- {connection && (- <Detail>- <DetailLabel>Connection</DetailLabel>- <DetailValue>{connection.name || "None"}</DetailValue>- </Detail>- )}- <Detail>- <DetailLabel>Scope</DetailLabel>- <DetailValue>Group</DetailValue>- </Detail>- <Detail>- <DetailLabel>Group</DetailLabel>- <DetailValue>{groupName || groupId || "None"}</DetailValue>- </Detail>- <Detail>- <DetailLabel>Scan Projects</DetailLabel>- <DetailValue>{shouldScanAll ? "All" : includeProjects.join(", ") || "None"}</DetailValue>- </Detail>- </SecretScanningDataSourceConfigReviewSection>- );-};diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/SecretScanningDataSourceReviewFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/SecretScanningDataSourceReviewFields.tsxindex b564e36219..6beb6bfc80 100644--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/SecretScanningDataSourceReviewFields.tsx+++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/SecretScanningDataSourceReviewFields.tsx@@ -1,48 +1,102 @@-import { useFormContext } from "react-hook-form";+import { ReactNode } from "react";+import { useFormContext, useWatch } from "react-hook-form";import {+ Badge,Detail,DetailGroup,DetailGroupHeader,DetailLabel,DetailValue} from "@app/components/v3";+import {+ doesDataSourceSupportDiscovery,+ RESOURCE_DESCRIPTION_HELPER,+ SECRET_SCANNING_DATA_SOURCE_MAP+} from "@app/helpers/secretScanningV2";import { SecretScanningDataSource } from "@app/hooks/api/secretScanningV2";+import { GitLabDataSourceScope } from "@app/hooks/api/secretScanningV2/types/gitlab-data-source";import { TSecretScanningDataSourceForm } from "../schemas";-import { BitbucketDataSourceReviewFields } from "./BitbucketDataSourceReviewFields";-import { GitHubDataSourceReviewFields } from "./GitHubDataSourceReviewFields";-import { GitLabDataSourceReviewFields } from "./GitLabDataSourceReviewFields";--const COMPONENT_MAP: Record<SecretScanningDataSource, React.FC> = {- [SecretScanningDataSource.GitHub]: GitHubDataSourceReviewFields,- [SecretScanningDataSource.Bitbucket]: BitbucketDataSourceReviewFields,- [SecretScanningDataSource.GitLab]: GitLabDataSourceReviewFields++const ReviewGroup = ({ title, children }: { title: string; children: ReactNode }) => (+ <DetailGroup>+ <DetailGroupHeader>{title}</DetailGroupHeader>+ <div className="flex flex-wrap gap-x-8 gap-y-4">{children}</div>+ </DetailGroup>+);++const ReviewDetail = ({ label, children }: { label: string; children: ReactNode }) => (+ <Detail>+ <DetailLabel>{label}</DetailLabel>+ <DetailValue>{children || "None"}</DetailValue>+ </Detail>+);++const EnabledBadge = ({ isEnabled }: { isEnabled: boolean }) => (+ <Badge variant={isEnabled ? "success" : "neutral"}>{isEnabled ? "Enabled" : "Disabled"}</Badge>+);++const getConnectionDetails = (+ form: TSecretScanningDataSourceForm+): { label: string; value?: string }[] => {+ switch (form.type) {+ case SecretScanningDataSource.GitHub:+ return [];+ case SecretScanningDataSource.Bitbucket:+ return [{ label: "Workspace", value: form.config.workspaceSlug }];+ case SecretScanningDataSource.GitLab:+ return form.config?.scope === GitLabDataSourceScope.Group+ ? [+ { label: "Scope", value: "Group" },+ { label: "Group", value: form.config.groupName }+ ]+ : [+ { label: "Scope", value: "Project" },+ { label: "Project", value: form.config?.projectName }+ ];+ default:+ throw new Error("Unhandled data source type");+ }};export const SecretScanningDataSourceReviewFields = () => {- const { watch } = useFormContext<TSecretScanningDataSourceForm>();-- const { type, name, description } = watch();+ const { control } = useFormContext<TSecretScanningDataSourceForm>();+ const form = useWatch({ control }) as TSecretScanningDataSourceForm;- const Component = COMPONENT_MAP[type];+ const { name: platform } = SECRET_SCANNING_DATA_SOURCE_MAP[form.type];+ const connection = getConnectionDetails(form);return (- <div className="mb-4 flex flex-col gap-6">- <Component />- <DetailGroup>- <DetailGroupHeader>Details</DetailGroupHeader>- <div className="flex flex-wrap gap-x-8 gap-y-2">- <Detail>- <DetailLabel>Name</DetailLabel>- <DetailValue>{name || "None"}</DetailValue>- </Detail>- <Detail>- <DetailLabel>Description</DetailLabel>- <DetailValue>{description || "None"}</DetailValue>- </Detail>- </div>- </DetailGroup>+ <div className="flex flex-col gap-8">+ <ReviewGroup title="Connection">+ <ReviewDetail label="Platform">{platform}</ReviewDetail>+ <ReviewDetail label="App Connection">{form.connection?.name}</ReviewDetail>+ {connection.map(({ label, value }) => (+ <ReviewDetail key={label} label={label}>+ {value}+ </ReviewDetail>+ ))}+ </ReviewGroup>+ <ReviewGroup title="Scan Options">+ <ReviewDetail label="Historical Scan">+ <EnabledBadge isEnabled={form.isHistoricalScanEnabled} />+ </ReviewDetail>+ <ReviewDetail label="Scan New Commits">+ <EnabledBadge isEnabled={form.isScanNewCommitsEnabled} />+ </ReviewDetail>+ <ReviewDetail label={`Discover New ${RESOURCE_DESCRIPTION_HELPER[form.type].pluralTitle}`}>+ {doesDataSourceSupportDiscovery(form) ? (+ <EnabledBadge isEnabled={form.isDiscoveryEnabled} />+ ) : (+ <Badge variant="neutral">Unavailable</Badge>+ )}+ </ReviewDetail>+ </ReviewGroup>+ <ReviewGroup title="Details">+ <ReviewDetail label="Name">{form.name}</ReviewDetail>+ <ReviewDetail label="Description">{form.description}</ReviewDetail>+ </ReviewGroup></div>);};diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/shared/SecretScanningDataSourceConfigReviewSection.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/shared/SecretScanningDataSourceConfigReviewSection.tsxdeleted file mode 100644index a74ae1e237..0000000000--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/shared/SecretScanningDataSourceConfigReviewSection.tsx+++ /dev/null@@ -1,16 +0,0 @@-import { ReactNode } from "react";--import { DetailGroup, DetailGroupHeader } from "@app/components/v3";--type Props = {- children: ReactNode;-};--export const SecretScanningDataSourceConfigReviewSection = ({ children }: Props) => {- return (- <DetailGroup>- <DetailGroupHeader>Configuration</DetailGroupHeader>- <div className="flex flex-wrap gap-x-8 gap-y-2">{children}</div>- </DetailGroup>- );-};diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/shared/index.ts b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/shared/index.tsdeleted file mode 100644index 9134e2a4fc..0000000000--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/shared/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./SecretScanningDataSourceConfigReviewSection";diff --git a/frontend/src/components/secret-scanning/forms/index.ts b/frontend/src/components/secret-scanning/forms/index.tsindex de0f590dbb..d76d3c9013 100644--- a/frontend/src/components/secret-scanning/forms/index.ts+++ b/frontend/src/components/secret-scanning/forms/index.ts@@ -1 +1,2 @@export * from "./SecretScanningDataSourceForm";+export * from "./CreateSecretScanningDataSourceForm";diff --git a/frontend/src/components/secret-scanning/forms/schemas/base-secret-scanning-data-source-schema.ts b/frontend/src/components/secret-scanning/forms/schemas/base-secret-scanning-data-source-schema.tsindex db0068be69..083584f805 100644--- a/frontend/src/components/secret-scanning/forms/schemas/base-secret-scanning-data-source-schema.ts+++ b/frontend/src/components/secret-scanning/forms/schemas/base-secret-scanning-data-source-schema.ts@@ -13,6 +13,8 @@ export const BaseSecretScanningDataSourceSchema = ({ isConnectionRequired }: Schconnection: isConnectionRequired? z.object({ name: z.string(), id: z.string().uuid() }): z.null().or(z.undefined()),- isAutoScanEnabled: z.boolean(),+ isHistoricalScanEnabled: z.boolean(),+ isScanNewCommitsEnabled: z.boolean(),+ isDiscoveryEnabled: z.boolean(),id: z.string().uuid().optional()});diff --git a/frontend/src/components/secret-scanning/forms/schemas/bitbucket-data-source-schema.ts b/frontend/src/components/secret-scanning/forms/schemas/bitbucket-data-source-schema.tsindex 38345ca072..7ff420f498 100644--- a/frontend/src/components/secret-scanning/forms/schemas/bitbucket-data-source-schema.ts+++ b/frontend/src/components/secret-scanning/forms/schemas/bitbucket-data-source-schema.ts@@ -9,11 +9,7 @@ export const BitbucketDataSourceSchema = ztype: z.literal(SecretScanningDataSource.Bitbucket),config: z.object({workspaceSlug: z.string().min(1, "Workspace Required").max(128),- includeRepos: z- .string()- .array()- .min(1, "One or more repositories required")- .max(100, "Cannot configure more than 100 repositories")+ includeRepos: z.string().array().max(100, "Cannot configure more than 100 repositories")})}).merge(BaseSecretScanningDataSourceSchema({ isConnectionRequired: true }));diff --git a/frontend/src/components/secret-scanning/forms/schemas/github-data-source-schema.ts b/frontend/src/components/secret-scanning/forms/schemas/github-data-source-schema.tsindex 2b5f87f826..226f73bcf1 100644--- a/frontend/src/components/secret-scanning/forms/schemas/github-data-source-schema.ts+++ b/frontend/src/components/secret-scanning/forms/schemas/github-data-source-schema.ts@@ -8,11 +8,7 @@ export const GitHubDataSourceSchema = z.object({type: z.literal(SecretScanningDataSource.GitHub),config: z.object({- includeRepos: z- .string()- .array()- .min(1, "One or more repositories required")- .max(100, "Cannot configure more than 100 repositories")+ includeRepos: z.string().array().max(100, "Cannot configure more than 100 repositories")})}).merge(BaseSecretScanningDataSourceSchema({ isConnectionRequired: true }));diff --git a/frontend/src/components/secret-scanning/forms/schemas/gitlab-data-source-schema.ts b/frontend/src/components/secret-scanning/forms/schemas/gitlab-data-source-schema.tsindex ef577a7d2d..2a4e7c820a 100644--- a/frontend/src/components/secret-scanning/forms/schemas/gitlab-data-source-schema.ts+++ b/frontend/src/components/secret-scanning/forms/schemas/gitlab-data-source-schema.ts@@ -15,9 +15,7 @@ export const GitLabDataSourceSchema = zgroupName: z.string(),includeProjects: z.array(z.string().min(1).max(256))- .min(1, "One or more projects required").max(100, "Cannot configure more than 100 projects")- .default(["*"])}),z.object({scope: z.literal(GitLabDataSourceScope.Project),diff --git a/frontend/src/components/secret-scanning/index.ts b/frontend/src/components/secret-scanning/index.tsindex b235c8ac94..51076da2be 100644--- a/frontend/src/components/secret-scanning/index.ts+++ b/frontend/src/components/secret-scanning/index.ts@@ -1,3 +1,3 @@-export * from "./CreateSecretScanningDataSourceModal";+export * from "./CreateSecretScanningDataSourceSheet";export * from "./EditSecretScanningDataSourceModal";export * from "./SecretScanningScanStatus";diff --git a/frontend/src/helpers/secretScanningV2.ts b/frontend/src/helpers/secretScanningV2.tsindex 30dc26382a..30f5da1ec0 100644--- a/frontend/src/helpers/secretScanningV2.ts+++ b/frontend/src/helpers/secretScanningV2.ts@@ -6,6 +6,7 @@ import {SecretScanningDataSource,SecretScanningFindingStatus} from "@app/hooks/api/secretScanningV2";+import { GitLabDataSourceScope } from "@app/hooks/api/secretScanningV2/types/gitlab-data-source";export const SECRET_SCANNING_DATA_SOURCE_MAP: Record<SecretScanningDataSource,@@ -37,6 +38,19 @@ export const SECRET_SCANNING_DATA_SOURCE_CONNECTION_MAP: Record<[SecretScanningDataSource.GitLab]: AppConnection.GitLab};+// GitLab discovery relies on group-level webhooks, so a project-scoped data source cannot discover new projects.+export const doesDataSourceSupportDiscovery = ({+ type,+ config+}: {+ type: SecretScanningDataSource;+ config?: unknown;+}) =>+ !(+ type === SecretScanningDataSource.GitLab &&+ (config as { scope?: string } | undefined)?.scope !== GitLabDataSourceScope.Group+ );+export const RESOURCE_DESCRIPTION_HELPER: Record<SecretScanningDataSource,{diff --git a/frontend/src/hooks/api/secretScanningV2/types/index.ts b/frontend/src/hooks/api/secretScanningV2/types/index.tsindex c0c05cf27e..1c03d4d4f8 100644--- a/frontend/src/hooks/api/secretScanningV2/types/index.ts+++ b/frontend/src/hooks/api/secretScanningV2/types/index.ts@@ -51,7 +51,15 @@ export type TSecretScanningDataSourceResponse = { dataSource: TSecretScanningDatexport type TCreateSecretScanningDataSourceDTO = DiscriminativePick<TSecretScanningDataSource,- "name" | "config" | "description" | "connectionId" | "type" | "isAutoScanEnabled" | "projectId"+ | "name"+ | "config"+ | "description"+ | "connectionId"+ | "type"+ | "isHistoricalScanEnabled"+ | "isScanNewCommitsEnabled"+ | "isDiscoveryEnabled"+ | "projectId">;export type TUpdateSecretScanningDataSourceDTO = Partial<diff --git a/frontend/src/hooks/api/secretScanningV2/types/shared/secret-scanning-data-source-base.ts b/frontend/src/hooks/api/secretScanningV2/types/shared/secret-scanning-data-source-base.tsindex bcba0b02ac..2176ab9d21 100644--- a/frontend/src/hooks/api/secretScanningV2/types/shared/secret-scanning-data-source-base.ts+++ b/frontend/src/hooks/api/secretScanningV2/types/shared/secret-scanning-data-source-base.ts@@ -14,5 +14,8 @@ export type TSecretScanningDataSourceBase = {name: string;} | null;isAutoScanEnabled: boolean;+ isHistoricalScanEnabled: boolean;+ isScanNewCommitsEnabled: boolean;+ isDiscoveryEnabled: boolean;isDisconnected: boolean;};diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningDataSourceSection.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningDataSourceSection.tsxindex 84e0f2eb98..538cd1eab0 100644--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningDataSourceSection.tsx+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/SecretScanningDataSourceSection.tsx@@ -9,6 +9,7 @@ import { IconButton, Tooltip } from "@app/components/v2";import { Badge } from "@app/components/v3";import { ProjectPermissionSub } from "@app/context";import { ProjectPermissionSecretScanningDataSourceActions } from "@app/context/ProjectPermissionContext/types";+import { RESOURCE_DESCRIPTION_HELPER } from "@app/helpers/secretScanningV2";import { usePopUp } from "@app/hooks";import { TSecretScanningDataSource } from "@app/hooks/api/secretScanningV2";@@ -21,7 +22,16 @@ type Props = {export const SecretScanningDataSourceSection = ({ dataSource }: Props) => {const { handlePopUpToggle, popUp, handlePopUpOpen } = usePopUp(["editDataSource"] as const);- const { name, description, connection, isAutoScanEnabled, isDisconnected } = dataSource;+ const {+ name,+ description,+ connection,+ isHistoricalScanEnabled,+ isScanNewCommitsEnabled,+ isDiscoveryEnabled,+ isDisconnected,+ type+ } = dataSource;return (<>@@ -68,19 +78,28 @@ export const SecretScanningDataSourceSection = ({ dataSource }: Props) => {<GenericFieldLabel label="Connection">{connection.name}</GenericFieldLabel>)}<DataSourceConfigDisplay dataSource={dataSource} />- <GenericFieldLabel label="Auto-Scan">- {isAutoScanEnabled ? (- <Badge variant="success">- <CheckIcon />- Enabled- </Badge>- ) : (- <Badge variant="neutral">- <BanIcon />- Disabled- </Badge>- )}- </GenericFieldLabel>+ {[+ { label: "Historical Scan", isEnabled: isHistoricalScanEnabled },+ { label: "Scan New Commits", isEnabled: isScanNewCommitsEnabled },+ {+ label: `Discover New ${RESOURCE_DESCRIPTION_HELPER[type].pluralTitle}`,+ isEnabled: isDiscoveryEnabled+ }+ ].map(({ label, isEnabled }) => (+ <GenericFieldLabel key={label} label={label}>+ {isEnabled ? (+ <Badge variant="success">+ <CheckIcon />+ Enabled+ </Badge>+ ) : (+ <Badge variant="neutral">+ <BanIcon />+ Disabled+ </Badge>+ )}+ </GenericFieldLabel>+ ))}</div></div></div>diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourceRow.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourceRow.tsxindex 3652e6841e..08aabe38ae 100644--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourceRow.tsx+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourceRow.tsx@@ -63,7 +63,7 @@ export const SecretScanningDataSourceRow = ({id,name,description,- isAutoScanEnabled,+ isScanNewCommitsEnabled,type,unresolvedFindings,resourceCount,@@ -114,7 +114,7 @@ export const SecretScanningDataSourceRow = ({);}- if (!isAutoScanEnabled) {+ if (!isScanNewCommitsEnabled) {return (<Tooltip><TooltipTrigger asChild>@@ -207,8 +207,8 @@ export const SecretScanningDataSourceRow = ({isDisabled={!isAllowed}onClick={() => onToggleEnableAutoScan(dataSource)}>- {isAutoScanEnabled ? <PauseIcon /> : <PlayIcon />}- {isAutoScanEnabled ? "Disable" : "Enable"} Auto-Scan+ {isScanNewCommitsEnabled ? <PauseIcon /> : <PlayIcon />}+ {isScanNewCommitsEnabled ? "Disable" : "Enable"} Scan New Commits</DropdownMenuItem><DropdownMenuItem isDisabled={!isAllowed} onClick={() => onEdit(dataSource)}><PencilIcon />diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsxindex 1a037d8826..ff0bed62ef 100644--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx@@ -6,7 +6,7 @@ import { SecretScanningUpgradeIntent, UpgradeGate } from "@app/components/licensimport { createNotification } from "@app/components/notifications";import { ProjectPermissionCan } from "@app/components/permissions";import {- CreateSecretScanningDataSourceModal,+ CreateSecretScanningDataSourceSheet,EditSecretScanningDataSourceModal} from "@app/components/secret-scanning";import { DeleteSecretScanningDataSourceModal } from "@app/components/secret-scanning/DeleteSecretScanningDataSourceModal";@@ -204,17 +204,17 @@ export const SecretScanningDataSourcesSection = () => {};const handleToggleEnableAutoScan = async (dataSource: TSecretScanningDataSource) => {- const isAutoScanEnabled = !dataSource.isAutoScanEnabled;+ const isScanNewCommitsEnabled = !dataSource.isScanNewCommitsEnabled;await updateDataSource.mutateAsync({dataSourceId: dataSource.id,type: dataSource.type,- isAutoScanEnabled,+ isScanNewCommitsEnabled,projectId: dataSource.projectId});createNotification({- text: `Auto-scan ${isAutoScanEnabled ? "enabled" : "disabled"} for "${dataSource.name}"`,+ text: `Scanning new commits ${isScanNewCommitsEnabled ? "enabled" : "disabled"} for "${dataSource.name}"`,type: "success"});};@@ -400,7 +400,7 @@ export const SecretScanningDataSourcesSection = () => {)}</CardContent></Card>- <CreateSecretScanningDataSourceModal+ <CreateSecretScanningDataSourceSheetisOpen={popUp.addDataSource.isOpen}onOpenChange={(isOpen) => handlePopUpToggle("addDataSource", isOpen)}/>