> ## Documentation Index
> Fetch the complete documentation index at: https://infisical-devin-1781641701-docs-github-pat-fine-grained.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# GitLab Secret Scanning

> Learn how to configure secret scanning for GitLab.

## Prerequisites

* Create a [GitLab Connection](/integrations/app-connections/gitlab) with Secret Scanning permissions

## Create a GitLab Data Source in Infisical

<Tabs>
  <Tab title="Infisical UI">
    1. Navigate to your Secret Scanning Project's Dashboard and click the **Add Data Source** button.
           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical-devin-1781641701-docs-github-pat-fine-grained/images/platform/secret-scanning/github/github-data-source-step-1.png" alt="Secret Scanning Dashboard" />

    2. Select the **GitLab** option.
           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical-devin-1781641701-docs-github-pat-fine-grained/images/platform/secret-scanning/gitlab/step-2.png" alt="Select GitLab" />

    3. Configure which workspace and repositories you would like to scan. Then click **Next**.

           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical-devin-1781641701-docs-github-pat-fine-grained/images/platform/secret-scanning/gitlab/step-3.png" alt="Data Source Configuration" />

       * **GitLab Connection** - the connection that has access to the repositories you want to scan.
       * **Scope** - the GitLab scope to scan secrets in.
         * **Project** - scan an individual GitLab project.
         * **Group** - scan one or more projects belonging to a GitLab group.
       * **Scan Repositories** - when using **Group Scope**, 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**.

           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical-devin-1781641701-docs-github-pat-fine-grained/images/platform/secret-scanning/gitlab/step-4.png" alt="Data Source Details" />

       * **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**.
           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical-devin-1781641701-docs-github-pat-fine-grained/images/platform/secret-scanning/gitlab/step-5.png" alt="Data Source Review" />

    6. Your **GitLab Data Source** is now available and will begin a full scan if **Auto-Scan** is enabled.
           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical-devin-1781641701-docs-github-pat-fine-grained/images/platform/secret-scanning/gitlab/step-6.png" alt="Data Source Created" />

    7. You can view repositories and scan results by clicking on your data source.
           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical-devin-1781641701-docs-github-pat-fine-grained/images/platform/secret-scanning/gitlab/step-7.png" alt="Data Source Page" />

    8. In addition, you can review any findings from the **Findings Page**.
           <img src="https://mintlify.s3.us-west-1.amazonaws.com/infisical-devin-1781641701-docs-github-pat-fine-grained/images/platform/secret-scanning/gitlab/step-8.png" alt="Findings Page" />
  </Tab>

  <Tab title="API">
    To create a GitLab Data Source, make an API request to the [Create GitLab Data Source](/api-reference/endpoints/secret-scanning/data-sources/gitlab/create) API endpoint.

    ### Sample request

    ```bash Request theme={null}
    curl --request POST \
    --url https://us.infisical.com/api/v2/secret-scanning/data-sources/gitlab \
    --header 'Content-Type: application/json' \
    --data '{
        "name": "my-gitlab-source",
        "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "description": "my gitlab data source",
        "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "isAutoScanEnabled": true,
        "config": {
            "scope": "project",
            "projectId": 123456789,
            "projectName": "my-group/my-project"
        }
    }'
    ```

    ### Sample response

    ```bash Response theme={null}
    {
        "dataSource": {
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "externalId": "1234567890",
            "name": "my-gitlab-source",
            "description": "my gitlab data source",
            "isAutoScanEnabled": true,
            "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "createdAt": "2023-11-07T05:31:56Z",
            "updatedAt": "2023-11-07T05:31:56Z",
            "type": "gitlab",
            "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "connection": {
                "app": "gitlab",
                "name": "my-gitlab-app",
                "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
            },
            "config": {
                "scope": "project",
                "projectId": 123456789,
                "projectName": "my-group/my-project"
            }
        }
    }
    ```
  </Tab>
</Tabs>
