# "Database passwords should not be disclosed" not always detecting

**URL:** <https://community.sonarsource.com/t/database-passwords-should-not-be-disclosed-not-always-detecting/102794>\
**Category:** SonarQube Cloud\
**Tags:** appsec, secrets, database, security\
**Created:** [October 18, 2023, 8:06am UTC](https://community.sonarsource.com/t/database-passwords-should-not-be-disclosed-not-always-detecting/102794 "2023-10-18T08:06:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![EZL](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@EZL](https://community.sonarsource.com/u/EZL)\
**Post date:** [October 18, 2023, 8:06am UTC](https://community.sonarsource.com/t/database-passwords-should-not-be-disclosed-not-always-detecting/102794/1 "2023-10-18T08:06:58Z")

</div>

Hello

We ran into a problem where we have a .json file containing information such as

```auto
"DatabaseConfiguration": {
    /* --- MSSQL --- */ /*
    "ConnectionString": "Server=::<number>,<number>;Initial Catalog=<String>;User Id=<String>;Password=<Clear text String>;Integrated Security=false;Application Name=<String>;",
...
}

```

And i throws _ **Make sure this database password gets changed and removed from the code** _, _ **Database passwords should not be disclosed secrets:S6703** _.

The issues is that we have multiple json files containing similar information but they don’t get flagged with a security issue?

Our source code is in Bitbucket and we are using TeamCity pipelines to rune the sonarscanner.  
We have 2 sonarscanners and its the same issue with both of them. We have **dotnet-sonarscanner** and **sonarsource/sonar-scanner-cli**

---

<div class="post-metadata">

**Author:** ![sebastien.andrivet](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/sebastien.andrivet/32/50144_2.png) [@sebastien.andrivet](https://community.sonarsource.com/u/sebastien.andrivet)\
**Post date:** [October 18, 2023, 1:18pm UTC](https://community.sonarsource.com/t/database-passwords-should-not-be-disclosed-not-always-detecting/102794/3 "2023-10-18T13:18:43Z")

</div>

Hi,

Welcome to the community and thank you very much for your Feedback.

In order to eliminate false positives, we do not trigger S6703 in some cases. Those exact cases depend on the version of SonarQube you are using. For example, we eliminate cases such as:

```auto
"DatabaseConfiguration": {
  "ConnectionString": "Server=::<number>,<number>;Initial Catalog=<String>;User Id=<String>;Password={PASSWORD_HERE};Integrated Security=false;Application Name=<String>;",
}

```

and:

```auto
"DatabaseConfiguration": {
  "ConnectionString": "Server=::<number>,<number>;Initial Catalog=<String>;User Id=<String>;Password=PLACEHOLDER;Integrated Security=false;Application Name=<String>;",
}

```

We assume that those are not passwords in clear but are placeholders or are replaced at runtime. Maybe some of your JSON files are in those cases?

Best regards  
Sebastien

---

<div class="post-metadata">

**Author:** ![EZL](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@EZL](https://community.sonarsource.com/u/EZL)\
**Post date:** [October 19, 2023, 7:51am UTC](https://community.sonarsource.com/t/database-passwords-should-not-be-disclosed-not-always-detecting/102794/4 "2023-10-19T07:51:39Z")

</div>

Hey Sebastian

Thank you for you quick reply.

In this case your assumption is correct, but what if they where not placeholders? Is there a way to show the false positives so we can manually mark them?

We are using SonarCloud and not SonarQube.

I assume it’s the same for **csharpsquid:S2068**** - **** “password” detected here, make sure this is not a hard-coded credential.**?

Best regards  
Elias

---

<div class="post-metadata">

**Author:** ![sebastien.andrivet](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/sebastien.andrivet/32/50144_2.png) [@sebastien.andrivet](https://community.sonarsource.com/u/sebastien.andrivet)\
**Post date:** [October 19, 2023, 8:49am UTC](https://community.sonarsource.com/t/database-passwords-should-not-be-disclosed-not-always-detecting/102794/5 "2023-10-19T08:49:37Z")

</div>

Hi Elias,

For S6703, there are different cases:

- If the file is a test file or inside a test folder, the rule will not be triggered.
- If the file contains placeholders or replacements, those will not be triggered.
- In all other cases, the passwords or secrets will trigger the rule.

This behavior is not customizable. Secrets detection is in constant evolution as we add more kinds of secrets to our detections. We also do our best to minimize the level of false positives.

S2068, it is handled differently. S6703 triggers in various places including files that are not code (such as JSON files). S2068 is specific and customized for each language like C#. So S2068 does not have the same behavior as S2068 as the goal of each rule is different.

Best regards  
Sebastien

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/78532_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [October 26, 2023, 8:50am UTC](https://community.sonarsource.com/t/database-passwords-should-not-be-disclosed-not-always-detecting/102794/6 "2023-10-26T08:50:26Z")

</div>

Closed on October 26, 2023, 8:50am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
