<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Secret Detection > 原文:[https://docs.gitlab.com/ee/user/application_security/secret_detection/](https://docs.gitlab.com/ee/user/application_security/secret_detection/) * [Overview](#overview) * [Use cases](#use-cases) * [Requirements](#requirements) * [Configuration](#configuration) * [Using the SAST Template](#using-the-sast-template) * [Customizing settings](#customizing-settings) * [Available variables](#available-variables) * [Logging Level](#logging-level) * [Full History Secret Scan](#full-history-secret-scan) # Secret Detection[](#secret-detection-ultimate "Permalink") [Introduced](https://about.gitlab.com/releases/2019/03/22/gitlab-11-9-released/#detect-secrets-and-credentials-in-the-repository) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 11.9. ## Overview[](#overview "Permalink") 開發應用程序時經常出現的問題是,開發人員可能會無意間將秘密和憑據提交到其遠程存儲庫. 如果其他人可以訪問源,或者項目是公開的,則敏感信息將被公開,惡意用戶可以利用這些信息來訪問諸如部署環境之類的資源. GitLab 11.9 包含一個稱為"秘密檢測"的新檢查. 它掃描存儲庫的內容以查找 API 密鑰和其他不應存在的信息. manbetx 客戶端打不開顯示識別的秘密作為 SAST 報告的一部分在幾個地方: * [Security Dashboard](../security_dashboard/) * Pipelines’ **Security** tab * 合并請求小部件中的報告 [![Secret Detection in merge request widget](https://img.kancloud.cn/63/aa/63aa45dd632960fc086fa3bd929194e2_908x185.png)](img/secret_detection_v13_2.png) ## Use cases[](#use-cases "Permalink") * 檢測密鑰,密碼和 API 令牌等機密信息的意外提交. * 對存儲庫的完整歷史記錄執行一次或重復掃描以查找機密信息. ## Requirements[](#requirements "Permalink") 要運行檢測的秘密工作,默認情況下,你需要 GitLab 亞軍與[`docker`](https://docs.gitlab.com/runner/executors/docker.html)或[`kubernetes`](https://docs.gitlab.com/runner/install/kubernetes.html)執行. 如果您在 GitLab.com 上使用共享的 Runners,則默認啟用該功能. **注意:**目前我們的秘密檢測作業需要 Linux 容器類型. Windows 容器尚不支持.**注意:**如果使用自己的 Runners,請確保安裝的 Docker 版本**不是** `19.03.0` . 有關詳細[信息](../sast#error-response-from-daemon-error-processing-tar-file-docker-tar-relocation-error) ,請參見[故障排除信息](../sast#error-response-from-daemon-error-processing-tar-file-docker-tar-relocation-error) . ## Configuration[](#configuration "Permalink") **注意:**在 GitLab 13.1 中,秘密檢測被拆分為自己的 CI / CD 模板. 秘密檢測是在`secret-detection`作業期間由[特定的分析器](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Security/Secret-Detection.gitlab-ci.yml)執行的. 無論您的應用程序使用哪種編程語言,它都可以運行. 秘密檢測分析器包括[Gitleaks](https://github.com/zricethezav/gitleaks)和[TruffleHog](https://github.com/dxa4481/truffleHog)檢查. ***Note:** The Secret Detection analyzer will ignore "Password in URL" vulnerabilities if the password begins with a dollar sign ( `$` ) as this likely indicates the password being used is an environment variable. **注意:**如果密碼以美元符號( `$` )開頭,則秘密檢測分析器將忽略" URL 中的密碼"漏洞,因為這很可能表明所使用的密碼是環境變量. For example, `https://username:$password@example.com/path/to/repo` won't be detected, whereas `https://username:password@example.com/path/to/repo` would be detected. 例如,將不會檢測到`https://username:$password@example.com/path/to/repo` ,而將檢測到`https://username:password@example.com/path/to/repo` .***注意:**如果您使用的是[Auto DevOps](../../../topics/autodevops/index.html)提供的[自動](../../../topics/autodevops/index.html) [秘密檢測,](../../../topics/autodevops/stages.html#auto-secret-detection-ultimate)則不必按照本節中的說明手動配置秘密檢測. 要為 GitLab 13.1 和更高版本啟用 Secret Detection,您必須包括`Secret-Detection.gitlab-ci.yml`模板,該模板作為 GitLab 安裝的一部分提供. 對于 11.9 之前的 GitLab 版本,您可以復制和使用該模板中定義的作業. 將以下內容添加到您的`.gitlab-ci.yml`文件中: ``` include: - template: Secret-Detection.gitlab-ci.yml ``` 包含的模板在 CI / CD 管道中創建"秘密檢測"作業,并掃描項目的源代碼中的秘密. 結果將保存為" [秘密檢測"報告工件](../../../ci/pipelines/job_artifacts.html#artifactsreportssecret_detection-ultimate) ,您以后可以下載和分析該[工件](../../../ci/pipelines/job_artifacts.html#artifactsreportssecret_detection-ultimate) . 由于實施限制,我們始終采用最新的秘密檢測工件. ### Using the SAST Template[](#using-the-sast-template "Permalink") 在 GitLab 13.1 之前,秘密檢測是[SAST 配置的](../sast#configuration)一部分. 如果您已經在 GitLab 13.1 之前為您的應用配置了啟用 SAST,則無需手動配置它. **計劃的棄用:**在以后的 GitLab 版本中,將不建議使用 SAST 模板配置秘密檢測. 請開始使用`Secret-Detection.gitlab-ci.yml`以防止將來出現問題. 我們制作了一個[視頻,指導您完成過渡](https://www.youtube.com/watch?v=W2tjcQreDwQ)到此新模板的過程.觀看視頻: [歷史秘密掃描演練](https://www.youtube.com/watch?v=W2tjcQreDwQ) . <figure class="video-container"><iframe src="https://www.youtube.com/embed/W2tjcQreDwQ" frameborder="0" allowfullscreen=""></iframe></figure> 使用 SAST 模板時,秘密檢測由[特定分析器](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml#L180)在`sast`作業期間執行. 它的運行與應用程序的編程語言無關,并且您無需更改 CI / CD 配置文件即可啟用它. 結果可在 SAST 報告中獲得. ### Customizing settings[](#customizing-settings "Permalink") 可以使用`.gitlab-ci.yml`的[`variables`](../../../ci/yaml/README.html#variables)參數通過[環境變量](#available-variables)更改秘密檢測掃描設置. 要覆蓋作業定義(例如,更改`variables`或`dependencies`類的屬性),請聲明與要覆蓋的 SAST 作業同名的作業. 將此新作業放置在包含模板之后,并在其下指定其他任何鍵. 在下面的示例中,我們包括"秘密檢測"模板,同時使用`SECRET_DETECTION_HISTORIC_SCAN`變量將`secret_detection`作業覆蓋為`true` : ``` include: - template: Secret-Detection.gitlab-ci.yml secret_detection: variables: SECRET_DETECTION_HISTORIC_SCAN: "true" ``` 因為模板是[在](../../../ci/yaml/README.html#include)管道配置[之前進行評估](../../../ci/yaml/README.html#include)的,所以最后提到的變量優先. **棄用:**從 GitLab 13.0 開始,不再支持[`only`和`except`](../../../ci/yaml/README.html#onlyexcept-basic)的使用. 覆蓋模板時,必須使用[`rules`](../../../ci/yaml/README.html#rules) . #### Available variables[](#available-variables "Permalink") 可以通過定義可用變量來自定義秘密檢測: | 環境變量 | 默認值 | Description | | --- | --- | --- | | `SECRET_DETECTION_COMMIT_FROM` | - | 提交 Gitleaks 掃描始于. | | `SECRET_DETECTION_COMMIT_TO` | - | Gitleaks 掃描的提交結束于. | | `SECRET_DETECTION_HISTORIC_SCAN` | false | 標記以啟用歷史性的 Gitleaks 掃描. | ### Logging Level[](#logging-level "Permalink") 您可以通過設置`SECURE_LOG_LEVEL` env var 來控制日志的詳細程度. 默認設置為`info` ,您可以將其設置為以下任意級別: * `fatal` * `error` * `warn` * `info` * `debug` ## Full History Secret Scan[](#full-history-secret-scan "Permalink") GitLab 12.11 引入了對掃描存儲庫完整歷史記錄的支持. 當您首次在存儲庫中啟用秘密檢測并且想要執行完整的秘密掃描時,此新功能特別有用. 對整個歷史記錄進行秘密掃描可能會花費很長時間,尤其是對于 Git 歷史記錄較長的大型存儲庫. 我們建議不要將此變量設置為常規作業定義的一部分. 可以設置一個新的配置變量( [`SECRET_DETECTION_HISTORIC_SCAN`](../sast/#vulnerability-filters) )來更改 GitLab 秘密檢測掃描的行為,使其在存儲庫的整個 Git 歷史記錄上運行. 我們創建了一個[簡短的視頻演練,](https://youtu.be/wDtc_K00Y0A)展示了如何執行完整的歷史秘密掃描. 觀看視頻: [歷史秘密掃描演練](https://www.youtube.com/watch?v=wDtc_K00Y0A) . <figure class="video-container"><iframe src="https://www.youtube.com/embed/wDtc_K00Y0A" frameborder="0" allowfullscreen=""></iframe></figure>
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看