diff --git a/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/create.mdx b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/create.mdx new file mode 100644 index 000000000..eeee8e019 --- /dev/null +++ b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/create.mdx @@ -0,0 +1,4 @@ +--- +title: "Create" +openapi: "POST /api/v2/secret-scanning/data-sources/bitbucket" +--- diff --git a/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/delete.mdx b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/delete.mdx new file mode 100644 index 000000000..b2bb37d0f --- /dev/null +++ b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/delete.mdx @@ -0,0 +1,4 @@ +--- +title: "Delete" +openapi: "DELETE /api/v2/secret-scanning/data-sources/bitbucket/{dataSourceId}" +--- diff --git a/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/get-by-id.mdx b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/get-by-id.mdx new file mode 100644 index 000000000..009d57dcb --- /dev/null +++ b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/get-by-id.mdx @@ -0,0 +1,4 @@ +--- +title: "Get by ID" +openapi: "GET /api/v2/secret-scanning/data-sources/bitbucket/{dataSourceId}" +--- diff --git a/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/get-by-name.mdx b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/get-by-name.mdx new file mode 100644 index 000000000..d9b82fb9b --- /dev/null +++ b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/get-by-name.mdx @@ -0,0 +1,4 @@ +--- +title: "Get by Name" +openapi: "GET /api/v2/secret-scanning/data-sources/bitbucket/data-source-name/{dataSourceName}" +--- diff --git a/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/list-resources.mdx b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/list-resources.mdx new file mode 100644 index 000000000..e80a71eb6 --- /dev/null +++ b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/list-resources.mdx @@ -0,0 +1,4 @@ +--- +title: "List Resources" +openapi: "GET /api/v2/secret-scanning/data-sources/bitbucket/{dataSourceId}/resources" +--- diff --git a/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/list-scans.mdx b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/list-scans.mdx new file mode 100644 index 000000000..1c1c83abc --- /dev/null +++ b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/list-scans.mdx @@ -0,0 +1,4 @@ +--- +title: "List Scans" +openapi: "GET /api/v2/secret-scanning/data-sources/bitbucket/{dataSourceId}/scans" +--- diff --git a/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/list.mdx b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/list.mdx new file mode 100644 index 000000000..f75e3c2b7 --- /dev/null +++ b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/list.mdx @@ -0,0 +1,4 @@ +--- +title: "List" +openapi: "GET /api/v2/secret-scanning/data-sources/bitbucket" +--- diff --git a/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/scan-resource.mdx b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/scan-resource.mdx new file mode 100644 index 000000000..03d0c79b0 --- /dev/null +++ b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/scan-resource.mdx @@ -0,0 +1,4 @@ +--- +title: "Scan Resource" +openapi: "POST /api/v2/secret-scanning/data-sources/bitbucket/{dataSourceId}/resources/{resourceId}/scan" +--- diff --git a/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/scan.mdx b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/scan.mdx new file mode 100644 index 000000000..f7b7c2dae --- /dev/null +++ b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/scan.mdx @@ -0,0 +1,4 @@ +--- +title: "Scan" +openapi: "POST /api/v2/secret-scanning/data-sources/bitbucket/{dataSourceId}/scan" +--- diff --git a/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/update.mdx b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/update.mdx new file mode 100644 index 000000000..92a88b6a6 --- /dev/null +++ b/docs/api-reference/endpoints/secret-scanning/data-sources/bitbucket/update.mdx @@ -0,0 +1,4 @@ +--- +title: "Update" +openapi: "PATCH /api/v2/secret-scanning/data-sources/bitbucket/{dataSourceId}" +--- diff --git a/docs/docs.json b/docs/docs.json index 015ecb3c4..4e09e6751 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -210,6 +210,7 @@ "group": "Secret Scanning", "pages": [ "documentation/platform/secret-scanning/overview", + "documentation/platform/secret-scanning/bitbucket", "documentation/platform/secret-scanning/github" ] } @@ -1111,6 +1112,21 @@ "pages": [ "api-reference/endpoints/secret-scanning/data-sources/list", "api-reference/endpoints/secret-scanning/data-sources/options", + { + "group": "Bitbucket", + "pages": [ + "api-reference/endpoints/secret-scanning/data-sources/bitbucket/list", + "api-reference/endpoints/secret-scanning/data-sources/bitbucket/get-by-id", + "api-reference/endpoints/secret-scanning/data-sources/bitbucket/get-by-name", + "api-reference/endpoints/secret-scanning/data-sources/bitbucket/list-resources", + "api-reference/endpoints/secret-scanning/data-sources/bitbucket/list-scans", + "api-reference/endpoints/secret-scanning/data-sources/bitbucket/create", + "api-reference/endpoints/secret-scanning/data-sources/bitbucket/update", + "api-reference/endpoints/secret-scanning/data-sources/bitbucket/delete", + "api-reference/endpoints/secret-scanning/data-sources/bitbucket/scan", + "api-reference/endpoints/secret-scanning/data-sources/bitbucket/scan-resource" + ] + }, { "group": "GitHub", "pages": [ diff --git a/docs/documentation/platform/secret-scanning/bitbucket.mdx b/docs/documentation/platform/secret-scanning/bitbucket.mdx new file mode 100644 index 000000000..9b3defbcf --- /dev/null +++ b/docs/documentation/platform/secret-scanning/bitbucket.mdx @@ -0,0 +1,98 @@ +--- +title: "Bitbucket Secret Scanning" +sidebarTitle: "Bitbucket" +description: "Learn how to configure secret scanning for Bitbucket." +--- + +## Prerequisites + +- Create a [Bitbucket Connection](/integrations/app-connections/bitbucket) + +## Create a Bitbucket Data Source in Infisical + + + + 1. Navigate to your Secret Scanning Project's Dashboard and click the **Add Data Source** button. + ![Secret Scanning Dashboard](/images/platform/secret-scanning/github/github-data-source-step-1.png) + + 2. Select the **Bitbucket** option. + + 3. Configure which workspace and repositories you would like to scan. Then click **Next**. + ![Data Source Configuration](/images/platform/secret-scanning/bitbucket/step-3.png) + + - **Bitbucket Radar Connection** - the connection that has access to the repositories you want to scan. + - **Workspace** - the Bitbucket workspace to scan secrets in. + - **Scan Repositories** - select which repositories you would like to scan. + - **All Repositories** - Infisical will scan all repositories associated with your connection. + - **Select Repositories** - Infisical will scan the selected repositories. + - **Auto-Scan Enabled** - whether Infisical should automatically perform a scan when a push is made to configured repositories. + + 4. Give your data source a name and description (optional). Then click **Next**. + ![Data Source Details](/images/platform/secret-scanning/bitbucket/step-4.png) + + - **Name** - the name of the data source. Must be slug-friendly. + - **Description** (optional) - a description of this data source. + + 5. Review your data source, then click **Create Data Source**. + ![Data Source Review](/images/platform/secret-scanning/bitbucket/step-5.png) + + 6. Your **Bitbucket Data Source** is now available and will begin a full scan if **Auto-Scan** is enabled. + ![Data Source Created](/images/platform/secret-scanning/bitbucket/step-6.png) + + 7. You can view repositories and scan results by clicking on your data source. + ![Data Source Page](/images/platform/secret-scanning/bitbucket/step-7.png) + + 8. In addition, you can review any findings from the **Findings Page**. + ![Findings Page](/images/platform/secret-scanning/bitbucket/step-8.png) + + + To create a Bitbucket Data Source, make an API request to the [Create Bitbucket Data Source](/api-reference/endpoints/secret-scanning/data-sources/bitbucket/create) API endpoint. + + ### Sample request + + ```bash Request + curl --request POST \ + --url https://us.infisical.com/api/v2/secret-scanning/data-sources/bitbucket \ + --header 'Content-Type: application/json' \ + --data '{ + "name": "my-bitbucket-source", + "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a", + "description": "my bitbucket data source", + "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a", + "isAutoScanEnabled": true, + "config": { + "workspaceSlug": "my-workspace", + "includeRepos": ["*"] + } + }' + ``` + + ### Sample response + + ```bash Response + { + "dataSource": { + "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a", + "externalId": "1234567890", + "name": "my-bitbucket-source", + "description": "my bitbucket data source", + "isAutoScanEnabled": true, + "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a", + "createdAt": "2023-11-07T05:31:56Z", + "updatedAt": "2023-11-07T05:31:56Z", + "type": "bitbucket", + "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a", + "connection": { + "app": "bitbucket", + "name": "my-bitbucket-app", + "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" + }, + "config": { + "workspaceSlug": "my-workspace", + "includeRepos": ["*"] + } + } + } + ``` + + diff --git a/docs/images/platform/secret-scanning/bitbucket/step-3.png b/docs/images/platform/secret-scanning/bitbucket/step-3.png new file mode 100644 index 000000000..97c373711 Binary files /dev/null and b/docs/images/platform/secret-scanning/bitbucket/step-3.png differ diff --git a/docs/images/platform/secret-scanning/bitbucket/step-4.png b/docs/images/platform/secret-scanning/bitbucket/step-4.png new file mode 100644 index 000000000..2a9fb1cb1 Binary files /dev/null and b/docs/images/platform/secret-scanning/bitbucket/step-4.png differ diff --git a/docs/images/platform/secret-scanning/bitbucket/step-5.png b/docs/images/platform/secret-scanning/bitbucket/step-5.png new file mode 100644 index 000000000..365323c6d Binary files /dev/null and b/docs/images/platform/secret-scanning/bitbucket/step-5.png differ diff --git a/docs/images/platform/secret-scanning/bitbucket/step-6.png b/docs/images/platform/secret-scanning/bitbucket/step-6.png new file mode 100644 index 000000000..adac9bb40 Binary files /dev/null and b/docs/images/platform/secret-scanning/bitbucket/step-6.png differ diff --git a/docs/images/platform/secret-scanning/bitbucket/step-7.png b/docs/images/platform/secret-scanning/bitbucket/step-7.png new file mode 100644 index 000000000..2ecbdda1a Binary files /dev/null and b/docs/images/platform/secret-scanning/bitbucket/step-7.png differ diff --git a/docs/images/platform/secret-scanning/bitbucket/step-8.png b/docs/images/platform/secret-scanning/bitbucket/step-8.png new file mode 100644 index 000000000..3948374f6 Binary files /dev/null and b/docs/images/platform/secret-scanning/bitbucket/step-8.png differ diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/BitbucketDataSourceReviewFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/BitbucketDataSourceReviewFields.tsx index e9a6fcb88..1523cb0ad 100644 --- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/BitbucketDataSourceReviewFields.tsx +++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceReviewFields/BitbucketDataSourceReviewFields.tsx @@ -13,12 +13,13 @@ export const BitbucketDataSourceReviewFields = () => { } >(); - const [{ includeRepos }, connection] = watch(["config", "connection"]); + const [{ includeRepos, workspaceSlug }, connection] = watch(["config", "connection"]); const shouldScanAll = includeRepos[0] === "*"; return ( {connection && {connection.name}} + {workspaceSlug} {shouldScanAll ? "All" : includeRepos.join(", ")} diff --git a/frontend/src/hooks/api/secretScanningV2/types/bitbucket-data-source.ts b/frontend/src/hooks/api/secretScanningV2/types/bitbucket-data-source.ts index f6e5fa89b..d9e7eb929 100644 --- a/frontend/src/hooks/api/secretScanningV2/types/bitbucket-data-source.ts +++ b/frontend/src/hooks/api/secretScanningV2/types/bitbucket-data-source.ts @@ -6,6 +6,7 @@ import { TSecretScanningDataSourceBase } from "./shared"; export type TBitbucketDataSource = TSecretScanningDataSourceBase & { type: SecretScanningDataSource.Bitbucket; config: { + workspaceSlug: string; includeRepos: string[]; }; }; diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/DataSourceConfigDisplay/BitbucketDataSourceConfigDisplay.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/DataSourceConfigDisplay/BitbucketDataSourceConfigDisplay.tsx index b99f72c2e..7115b16a6 100644 --- a/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/DataSourceConfigDisplay/BitbucketDataSourceConfigDisplay.tsx +++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourceByIdPage/components/DataSourceConfigDisplay/BitbucketDataSourceConfigDisplay.tsx @@ -7,12 +7,15 @@ type Props = { export const BitbucketDataSourceConfigDisplay = ({ dataSource }: Props) => { const { - config: { includeRepos } + config: { includeRepos, workspaceSlug } } = dataSource; return ( - - {includeRepos.includes("*") ? "All" : includeRepos.join(", ")} - + <> + {workspaceSlug} + + {includeRepos.includes("*") ? "All" : includeRepos.join(", ")} + + ); };