Skip to main content

Machine Learning

This section outlines the machine learning features implemented in GitGuardian, detailing how they work and how to activate them for Self-Hosted. Once activated, you can enrich past incidents with machine learning analysis.

For more details about the machine learning capabilities, see the Machine Learning Secret Detection documentation.

System Requirements​

The ML Secret Engine requires 3 vCPU and 2.5 GiB RAM per replica. For detailed scaling guidelines, performance metrics, and infrastructure recommendations, see the Scaling documentation.

info

From 2025.7.0 version, Machine Learning is activated by default.

KOTS-Based Installation​

To enable this feature, set a positive number of replicas for both the ML engine and workers in your configuration:

ML Secret Engine in KOTS

Helm-Based Installation​

info

For those using GitGuardian in an air-gapped environment, the names of the images required for machine learning can be found here.

For Helm-based installations, consult the Helm Values Documentation for detailed configuration options. Ensure you configure a positive number of replicas for the ML engine and workers (the default value is 1, so no override of this value will get you the correct resources). Example minimal configuration:

secretEngine:
replicas: 1

celeryWorkers:
ml-api-priority:
replicas: 1

We strongly recommend using Horizontal Pod Autoscaling (HPA) for the ml-api-priority worker, especially when performing a backfill on all your incidents. For more information, refer to our Autoscaling Guide.

Lower the priority of ML​

As Secret ML Engine has high hardware requirements, you may want to lower its priority to ensure all other pods are scheduled before. This can be done with a cluster-wide Resource called PriorityClass.

Declare a PriorityClass in your cluster:

---
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: ml-priority
labels:
{{- include "gim.labels" $ | nindent 4 }}
value: -10 # see how to set this value with your cluster administrator
globalDefault: false
description: "Lower priority class for ML secretEngine pods that can be preempted."

Then, simply use that priorityClass in GitGuardian values:

secretEngine:
priorityClassName: ml-priority

Risk score​

From 2026.11.0, Self-Hosted can compute the risk score: each secret incident gets a score from 0 to 100, and the Critical saved view lists the open incidents scored 85 or above. The risk score is off by default.

Turn on the risk score​

You need admin privileges:

  1. In the Admin area of your GitGuardian instance, go to Settings > Preferences, and in the Machine Learning section, turn on enable_self_hosted_risk_score.
  2. New incidents now get a score as they come in. To score the incidents created before, backfill them.

While the preference is off, GitGuardian computes no risk score and the Critical view filters on severity. Turning it off also hides the scores already computed: the dashboard, the public API, the CSV export and integration messages show no score, and integrations ignore their risk score filters. Turn it back on to show them again. If you turn it off during a risk score backfill, the backfill skips its remaining incidents: run it again once the preference is back on.

Run a dedicated risk score worker​

By default, the worker-scanners pods compute the risk score, so a large rescore and repository scans slow each other down. To compute it on dedicated pods:

  • KOTS-based installations: in the Machine learning section of the Admin Console, set Risk score worker replicas above 0. You can then set its CPU and memory limits.
  • Helm-based installations: set celeryWorkers.ml-prioritization.replicas above 0.

By default, each pod requests 1 CPU and 1.5 GiB of memory, which you can change. See Scaling.

Enrich past incidents​

Machine learning analyzes new incidents as they come in. When you activate it for the first time, the Auto-ignore false positive playbook is also enabled by default.

Incidents created before that have no machine learning results. The Settings > Machine learning page of the Admin area backfills them, with one card per backfill:

  • FP remover / Incident enricher runs two models on your past private and public incidents:
    • the False Positive Remover tags the incidents likely to be false positives;
    • the Secret Enricher gives generic incidents a precise secret type, for example "Redis Credentials" instead of "Generic Database Assignment".
  • Risk score computes the risk score of your past private incidents. Public incidents are not scored. This card shows only once you turn on the risk score.

To backfill your past incidents, you need admin privileges:

  1. In the Admin area of your GitGuardian instance, go to Settings > Machine learning.
  2. In the FP remover / Incident enricher card, click Backfill incidents and confirm.
  3. Once it completes, in the Risk score card, click Backfill risk scores and confirm.

Each card shows the progress of its backfill. Once it completes, the card shows its start and completion dates, with links to your incidents.

Machine learning backfills in the Admin area

If a backfill makes no progress for 24 hours, its card shows that it stopped, and you can start a new one. To change this delay, set the backpopulation_expiry_hours preference.

caution
  • A backfill cannot be canceled once started. It takes from a few minutes to several days, depending on the number of incidents.
  • During the FP remover / Incident enricher backfill, real-time incident processing is delayed. During the risk score backfill, new incidents get their score late. Schedule both outside of business hours. On a large instance, the dedicated risk score worker also keeps the risk score backfill from slowing down repository scans.
  • The risk score uses the False Positive Remover results, so the risk score backfill cannot start while the FP remover / Incident enricher backfill runs. If you backfill risk scores first, backfill them again afterwards: until then, old false positives can get a higher score than they should.
  • The risk score backfill doesn't notify your integrations: no Jira or ServiceNow comment and no notification for each scored incident. The score still appears in each incident's timeline.