demo(07-magic-connection-string): 07 — Hardcoded SQL connection string in Program.cs#146
demo(07-magic-connection-string): 07 — Hardcoded SQL connection string in Program.cs#146
Conversation
There was a problem hiding this comment.
GauntletCI found the following issues:
These findings reference lines outside the PR diff, so they appear here instead of inline. Expand each entry for full evidence, rationale, and suggested action.
GCI0010 — Hardcoding and Configuration (`src/OrderService/Program.cs`): Hardcoded connection string detected.
GCI0010 — Hardcoding and Configuration
Hardcoded connection string detected.
Evidence:
Line 27: "Server=tcp:orders-db.internal;Database=Orders;Integrated Security=true;TrustServerCertificate=true";
💡 Suggested action: Use IConfiguration, Secret Manager, or environment variables for connection strings.
Confidence: High | Severity: Block
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e30d535e3d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const string ordersDbConnection = | ||
| "Server=tcp:orders-db.internal;Database=Orders;Integrated Security=true;TrustServerCertificate=true"; |
There was a problem hiding this comment.
Move order DB connection string out of source code
Hardcoding ordersDbConnection here bakes an environment-specific SQL endpoint into the binary, so the same build cannot be safely promoted across environments without rebuilding, and it exposes internal infrastructure details in source/artifacts; this should be loaded from configuration or a secret provider at runtime instead of a string literal in Program.cs.
Useful? React with 👍 / 👎.
…g in Program.cs See scenarios/07-magic-connection-string/README.md for the expected verdict.
|
Reopening with refreshed scenario. |
e30d535 to
cfa8177
Compare
07 — Hardcoded SQL connection string in Program.cs
Expected verdict: ❌ Fails — GauntletCI should fire GCI0010 (hardcoded connection string).
What changed
src/OrderService/Program.csregisters an order-database connection stringas a constant directly in code, instead of binding it from
IConfiguration:The literal contains the canonical
Server=connection-string marker,which GauntletCI's
GCI0010rule recognises as an environment-coupledconfiguration value baked into source.
Why this is risky
promoting the same artefact to staging or production now requires a
rebuild.
leaks internal infrastructure topology into every artifact and CI log.
which is exactly what configuration is for.
What GauntletCI catches
GCI0010 Hardcoding and Configuration— string literal containing aServer=connection-string marker added to a non-test file.