> For the complete documentation index, see [llms.txt](https://docs.sec1.io/user-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sec1.io/user-docs/4-sast/2-java/gitleaks.md).

# GIT Leaks

## Overview

* **Rule ID**: `gitleaks`
* **Applicable Languages**: N/A
* **Weakness ID**: CWE-798

## Description

Hard-coding secrets in a project poses a risk of inadvertent leakage. This rule utilizes the Gitleaks library to scan for common secret types like keys, tokens, and passwords, ensuring they are not embedded directly in the codebase. It is a pivotal component of the language-agnostic secrets scanner.

## Risks

This is an example of an external hard-coded password on the client-side of a connection. This code will run successfully, but anyone who has access to it will have access to the password. Once the program has shipped, there is no going back from the database user "scott" with a password of "tiger" unless the program is patched. A devious employee with access to this information can use it to break into the system. Even worse, if attackers have access to the bytecode for application, they can use the javap -c command to access the disassembled code, which will contain the values of the passwords used.

## Remediation Guidelines

**Do not** hard-code secrets in committed code. Instead, utilize environment variables alongside a dedicated secret management system.

## References

* [**Gitleaks**](https://gitleaks.io/)
* [**CWE-798: Use of Hard-coded Credentials**](https://cwe.mitre.org/data/definitions/798.html)
* [**A07:2021 - Identification and Authentication Failures**](https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures/)

## Configuration

**This is a built in rule that represents findings from the secrets scanner.**

To omit this rule during a scan, and to provide you with continuous 24/7 code-level scanning, you can employ our [**SAST TOOL**](https://scopy.sec1.io/login)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sec1.io/user-docs/4-sast/2-java/gitleaks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
