demo(07-magic-connection-string): 07 — Hardcoded SQL connection string in Program.cs#156
demo(07-magic-connection-string): 07 — Hardcoded SQL connection string in Program.cs#156
Conversation
…g in Program.cs See scenarios/07-magic-connection-string/README.md for the expected verdict.
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: cfa8177ea4
ℹ️ 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".
| // Order-database connection — temporarily inlined while the | ||
| // secret-store wiring is being moved out of the legacy host. | ||
| const string ordersDbConnection = | ||
| "Server=tcp:orders-db.internal;Database=Orders;Integrated Security=true;TrustServerCertificate=true"; |
There was a problem hiding this comment.
Load DB connection string from configuration
Hardcoding ordersDbConnection here bakes an environment-specific endpoint (Server=tcp:orders-db.internal) into the binary, so promoting the same build across dev/staging/prod requires code changes and rebuilds, and it exposes internal infrastructure details in source and logs. This should be bound from builder.Configuration (or a secrets provider) instead of a string literal in Program.cs.
Useful? React with 👍 / 👎.
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.