Add TrustServerCertificate to DefaultConnection#152
Conversation
Updates the local SQL Express connection string to include TrustServerCertificate=True, resolving SSL/TLS connection issues common in newer versions of the SQL Server driver.
📝 WalkthroughWalkthroughUpdated the SQL Server connection string in application settings to include Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/tacos.mvc/appsettings.json`:
- Line 3: The base ConnectionStrings entry "DefaultConnection" currently
includes TrustServerCertificate=True; remove that token from the base
appsettings.json value so the production/default config enforces strict TLS, and
add a development-only override in appsettings.Development.json (or an
environment-specific override) that sets the same "DefaultConnection" value but
includes TrustServerCertificate=True for local SQL Express testing; ensure the
key name "DefaultConnection" is identical between files so configuration
fallback works.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0a137ebf-cf3d-42e2-bfe1-ab238c11ff97
📒 Files selected for processing (1)
src/tacos.mvc/appsettings.json
| { | ||
| "ConnectionStrings": { | ||
| "DefaultConnection": "Server=.\\sqlexpress;Database=tacos;Trusted_Connection=True;MultipleActiveResultSets=true" | ||
| "DefaultConnection": "Server=.\\sqlexpress;Database=tacos;Trusted_Connection=True;TrustServerCertificate=True;MultipleActiveResultSets=true" |
There was a problem hiding this comment.
Scope TrustServerCertificate=True to development-only config
Line 3 weakens TLS identity validation globally when kept in base appsettings.json. Since this PR targets local SQL Express, move this flag to appsettings.Development.json (or an environment override) and keep the base connection string strict.
Suggested config split
# src/tacos.mvc/appsettings.json
- "DefaultConnection": "Server=.\\sqlexpress;Database=tacos;Trusted_Connection=True;TrustServerCertificate=True;MultipleActiveResultSets=true"
+ "DefaultConnection": "Server=.\\sqlexpress;Database=tacos;Trusted_Connection=True;MultipleActiveResultSets=true"// src/tacos.mvc/appsettings.Development.json
{
"ConnectionStrings": {
"DefaultConnection": "Server=.\\sqlexpress;Database=tacos;Trusted_Connection=True;TrustServerCertificate=True;MultipleActiveResultSets=true"
}
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "DefaultConnection": "Server=.\\sqlexpress;Database=tacos;Trusted_Connection=True;TrustServerCertificate=True;MultipleActiveResultSets=true" | |
| "DefaultConnection": "Server=.\\sqlexpress;Database=tacos;Trusted_Connection=True;MultipleActiveResultSets=true" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/tacos.mvc/appsettings.json` at line 3, The base ConnectionStrings entry
"DefaultConnection" currently includes TrustServerCertificate=True; remove that
token from the base appsettings.json value so the production/default config
enforces strict TLS, and add a development-only override in
appsettings.Development.json (or an environment-specific override) that sets the
same "DefaultConnection" value but includes TrustServerCertificate=True for
local SQL Express testing; ensure the key name "DefaultConnection" is identical
between files so configuration fallback works.
Updates the local SQL Express connection string to include TrustServerCertificate=True, resolving SSL/TLS connection issues common in newer versions of the SQL Server driver.
Summary by CodeRabbit