The following files contain sensitive information and should NEVER be committed:
appsettings.Production.json- Production configuration with real passwordsappsettings.json- Development settings (currently contains hardcoded secrets - see below)
-
Move secrets to environment variables or User Secrets:
# Set environment variables (Windows PowerShell) $env:ConnectionStrings__DefaultConnection = "your-connection-string" $env:Jwt__Key = "your-jwt-key" $env:EmailSettings__MailPassword = "your-email-password"
-
Or use .NET User Secrets for development:
dotnet user-secrets init dotnet user-secrets set "Jwt:Key" "your-secure-key" dotnet user-secrets set "ConnectionStrings:DefaultConnection" "your-connection-string"
-
For production, use Azure Key Vault or similar
- All POST methods in AdminController now have
[ValidateAntiForgeryToken]attribute - Ensure all forms include
@Html.AntiForgeryToken()or use tag helpers withasp-action
- The
/api/authentication/registerendpoint now requires Administrator role - Previously was open to anyone (AllowAnonymous)
- File download/display functions now validate filenames
- Path resolution ensures files are within allowed directories
- Use
FileSecurityHelper.TryGetSafeFilePath()for new file operations
- Users can only view their own details (unless Administrator)
- Added proper authorization checks to Details action
- Removed JWT key logging from AuthUserService and Program.cs
- Never log sensitive information (passwords, tokens, keys)
- Developer Exception Page only shows in Development environment
- Production uses generic error page
- Rotate all secrets that were in appsettings.json (they're in git history)
- Add .gitignore with entries for:
appsettings.Production.json appsettings.*.local.json - Enable HTTPS redirect in production
- Add rate limiting to login endpoints
- Implement audit logging for sensitive operations
- Add account lockout policies (already configured in Program.cs)
| Role | Purpose |
|---|---|
| Administrator | Full system access |
| User | Practitioner access |
| FacilityUser | Institution/Facility access |
| Finance | Payment-related functions |
| ApiUser | External API integrations |