@@ -346,27 +346,33 @@ ihr mit ``git stash drop`` entfernen.
346346Mit `Gitleaks <https://github.com/gitleaks/gitleaks >`_ könnt ihr eure
347347Repositories regelmäßig auf ungewollt gespeicherte Zugangsdaten überprüfen.
348348
349- Ihr könnt Gitleaks auch automatisch als GitLab-Action ausführen. Hierzu müsst
350- ihr die `Secret-Detection.gitlab-ci.yml
351- <https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Jobs/Secret-Detection.gitlab-ci.yml> `_-Vorlage
352- :abbr: `z.B. ( zum Beispiel ) ` in eine Stufe namens ``secrets-detection `` in
353- eurer ``.gitlab-ci.yml ``-Datei einbinden:
349+ Ihr könnt Gitleaks mit dem :doc: `advanced/hooks/pre-commit ` verwenden, indem ihr
350+ in der :file: `.pre-commit-config.yaml `-Datei folgendes eintragt:
354351
355352.. code-block :: yaml
356353
357- include :
358- - template : Security/Secret-Detection.gitlab-ci.yml
354+ repos :
355+ - repo : https://github.com/gitleaks/gitleaks
356+ rev : v8.21.1
357+ hooks :
358+ - id : gitleaks
359359
360- Die Vorlage erstellt *Secret Detection *-Aufträge in eurer CI/CD-Pipeline und
361- durchsucht den Quellcode eures Projekts nach *Secrets *. Die Ergebnisse werden
362- als `Secret Detection Report Artefakt
363- <https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportssecret_detection> `_
364- gespeichert, den ihr später herunterladen und analysieren könnt.
360+ .. note ::
361+ Um den Gitleaks-Hook zu deaktivieren, könnt ihr ``SKIP=Gitleaks ``
362+ voranstellen, so dass Gitleaks nicht ausgeführt wird:
365363
366- .. seealso ::
364+ .. code-block :: console
365+
366+ $ SKIP=gitleaks git commit -m "Add secret"
367+ Detect hardcoded secrets................................................Skipped
368+
369+ Alternativ könnt ihr auch den ``gitleaks:allow ``-Kommentar einer Zeile
370+ anhängen, :abbr: `z.B. ( zum Beispiel ) `:
371+
372+ .. code-block :: Python
367373
368- * ` GitLab Secret Detection
369- <https://docs.gitlab.com/ee/user/application_security/secret_detection/> `_
374+ class MyClass :
375+ client_secret = " Srtub6pZcTSET9V4vUpUg7xPi64sh3NV " # gitleaks:allow
370376
371377 Mit :ref: `git-filter-repo ` könnt ihr unerwünschte Dateien oder Zugangsdaten aus
372378eurer Git-Historie entfernen.
0 commit comments