> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-server/instance-administration/security/masking-detected-secrets.md).

# Masking detected secrets in source code

Masking detected secret values in source-code views and Web API responses in SonarQube Server 2026.5.

SonarQube Server can mask the value of secrets that a scan detects in your code, instead of showing them in plain text.

The **Mask detected secret values in source code** setting (`sonar.security.secretSourceRedaction.enabled`) is disabled by default. While disabled, SonarQube Server shows the secret value in the source-code view and in Web API responses that return source code. Enable the setting to hide these values instead.

## Permissions <a href="#permissions" id="permissions"></a>

You must have the Administer System permission.

## How it works <a href="#how-it-works" id="how-it-works"></a>

When you enable masking, SonarQube Server replaces detected secret values with a mask in the source-code view and in Web API responses that return source code. If SonarQube Server cannot determine a safe location to mask within a file, it masks the entire source of that file instead.

Masking applies only to how source code is displayed. Detected-secret issues, their locations, and their descriptions remain visible as usual.

Masking takes effect immediately for existing and new analyses. You do not need to reanalyze your code or restart your instance after changing the setting.

## Enabling secret masking <a href="#enabling-secret-masking" id="enabling-secret-masking"></a>

To enable masking of detected secret values in source code:

1. Go to **Administration** > **Configuration** > **General settings** > **Security**.
2. Enable **Mask detected secret values in source code**.

## Related pages <a href="#related-pages" id="related-pages"></a>

[Secrets](/sonarqube-server/analyzing-source-code/languages/secrets.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-server/instance-administration/security/masking-detected-secrets.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
