Skip to content

[auto-fix] security: remove hardcoded database credentials from appsettings.json#14

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
fix/remove-hardcoded-db-credentials-6e77e926f9211389
Draft

[auto-fix] security: remove hardcoded database credentials from appsettings.json#14
github-actions[bot] wants to merge 1 commit into
mainfrom
fix/remove-hardcoded-db-credentials-6e77e926f9211389

Conversation

@github-actions
Copy link
Copy Markdown

Implements the #1 priority improvement from weekly improvements issue #13.

What was changed

File Change
Beam.Server/appsettings.json Replaced plaintext SQL Server password with REPLACE_WITH_USER_SECRET_OR_ENV_VAR placeholder
Beam.Server/Beam.Server.csproj Added <UserSecretsId>beam-server-dev</UserSecretsId> to enable .NET User Secrets
.gitignore Added appsettings.Production.json and appsettings.Staging.json to prevent future credential commits

Why

appsettings.json contained a plaintext SQL Server password committed directly to source control. Any developer with read access (or anyone who ever cloned the repo) has that credential. This is the highest-priority security issue in the codebase.

⚠️ Required manual action

The committed password must be treated as compromised and rotated immediately. This PR removes the credential from future commits but cannot remove it from git history.

To fully remediate:

  1. Rotate the database password on the SQL Server instance.
  2. Optionally rewrite git history with git filter-repo or BFG Repo-Cleaner to remove the old credential from all past commits.

Local development setup (after merging)

cd Beam.Server
dotnet user-secrets set "ConnectionStrings:DefaultConnection" "Data Source=sql;Initial Catalog=Beam;Integrated Security=False;User ID=sa;Password=<new-password>"
```

### Production / CI setup

Inject the connection string as an environment variable — ASP.NET Core picks it up automatically:

```
ConnectionStrings__DefaultConnection=<value>

Review checklist

  • Rotate the database password before or immediately after merging
  • Verify local development works with user secrets
  • Confirm CI/CD pipeline injects ConnectionStrings__DefaultConnection as an environment variable

Closes #13

Generated by Implement Top Priority Improvement · ● 437.8K ·

- Replace plaintext SQL Server password in appsettings.json with a
  placeholder string that fails loudly if used accidentally
- Add UserSecretsId to Beam.Server.csproj to enable .NET User Secrets
  for local development (dotnet user-secrets set ...)
- Update .gitignore to block appsettings.Production.json and
  appsettings.Staging.json from being committed, preventing future
  credential leaks via environment-specific settings files

The committed password should be treated as compromised and rotated.
For local dev, supply the real connection string via user secrets:
  cd Beam.Server
  dotnet user-secrets set "ConnectionStrings:DefaultConnection" "<real-conn-string>"
For production/CI, use an environment variable:
  ConnectionStrings__DefaultConnection=<value>

Closes #13

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weekly Improvements:Weekly Code Health — Top 3 Improvements (2026-04-22)

0 participants