[Autofix] Remove hardcoded MySQL password from MigrationContextFactory#3
Open
vardior9 wants to merge 1 commit into
Open
[Autofix] Remove hardcoded MySQL password from MigrationContextFactory#3vardior9 wants to merge 1 commit into
vardior9 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✅ Fixed
Secrets · View in Apiiro
Summary:
Removed hardcoded MySQL password from the design-time MigrationContextFactory and replaced it with an environment variable lookup (MYSQL_CONNECTION_STRING), falling back to a connection string with an empty password.
What Changed:
Replaced the hardcoded connection string
Server=127.0.0.1;Database=myDataBase;Uid=myUsername;Pwd=myPassword;with a call toEnvironment.GetEnvironmentVariable("MYSQL_CONNECTION_STRING"). The fallback value uses the same connection parameters but with an empty password (Pwd=;), so the secret is no longer present in source code.Why This Fix:
The repo has no secret manager integration (no Azure Key Vault, AWS Secrets Manager, etc.) and this file is a design-time EF Core migration factory only used by
dotnet eftooling. An environment variable is the simplest appropriate mechanism and matches .NET conventions. The fallback keeps the factory functional for local development without requiring explicit env var setup, while removing the exposed credential from the codebase.Files Changed:
src/providers/WorkflowCore.Persistence.MySQL/MigrationContextFactory.csFollow-Ups:
Potential Impact:
Low. This factory is only invoked by EF Core design-time tooling (e.g.,
dotnet ef migrations add). Developers who previously relied on the hardcoded connection string will now need to either set the MYSQL_CONNECTION_STRING environment variable or accept the fallback (which has an empty password). No runtime application behavior is affected.About Apiiro Autofix
This PR was automatically generated by Apiiro Autofix. Review all changes carefully before merging and run your test suite to verify no regressions.