Skip to content

Conversation

@tdykstra
Copy link
Contributor

@tdykstra tdykstra commented Oct 31, 2024

@tdykstra tdykstra changed the title SFI ROPC Remediation: more files with connection strings ROPC Remediation: more files with connection strings Oct 31, 2024
@tdykstra tdykstra changed the title ROPC Remediation: more files with connection strings ROPC remediation: more files with connection strings Oct 31, 2024
@tdykstra tdykstra changed the title ROPC remediation: more files with connection strings WIP: ROPC remediation: more files with connection strings Oct 31, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including password here isn't required, as it and the other parts of the connection string were there just to give an impression of what an Azure Redis Cache connection string looks like.

@tdykstra tdykstra marked this pull request as ready for review October 31, 2024 23:10
@tdykstra tdykstra changed the title WIP: ROPC remediation: more files with connection strings WIP: ROPC remediation - more files with connection strings Oct 31, 2024
@tdykstra tdykstra changed the title WIP: ROPC remediation - more files with connection strings ROPC remediation - more files with connection strings Oct 31, 2024

```dotnetcli
dotnet user-secrets set "DbPassword" "pass123"
dotnet user-secrets set "DbPassword" "`<secret value>`"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For bonus points, replace "<secret value>"
with
"\x00``<secret value>``\" which should throw an error, although maybe <secret value> will throw. We don't want them copy/paste something that works.

[!code-json[](~/security/app-secrets/samples/3.x/UserSecrets/appsettings-unsecure.json?highlight=3)]

A more secure approach is to store the password as a secret. For example:
Storing passwords in plain text is insecure. For example, a database connection string stored in `appsettings.json` should not include a password. Instead, store the password as a secret, and include the password in the connection string at runtime. For example:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to tell them never store secrets in a config file (for example appsettings.json) ... checked in source.

@tdykstra tdykstra merged commit ff8edb9 into dotnet:main Nov 1, 2024
3 checks passed
@tdykstra tdykstra deleted the sfi1030connstr branch November 1, 2024 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ROPC remediation: more files with connection strings

2 participants