Repository navigation
chore: untrack appsettings.Development.json, keep its defaults as an example - #591
Conversation
…example
The file was tracked, so a local connection string edited into it showed up as
a modification in an unrelated feature branch's diff — one `git commit -a` away
from committing a credential into a repo that GitGuardian scans.
AGENTS.md already says twice that dev secrets belong in user-secrets, and
`UserSecretsId` is configured, so the supported path needs no code change:
dotnet user-secrets --project src/Cluckwork.Api set "ConnectionStrings:Default" "..."
Untracking it alone would have deleted the shared, non-secret Serilog dev
config — the log levels and the {TraceId}:{SpanId} output template #404 cares
about — for every other clone. So those move to
appsettings.Development.example.json, mirroring the deploy/.env.example pattern.
Nothing referenced the tracked file: no csproj item (the Web SDK globs
appsettings*.json), no Dockerfile, CI, compose or docs reference.
Deliberately NOT touched: the pre-existing `.gitignore` entry for
appsettings.Development.local.json, which nothing in the app loads. That dead
hint is a separate question and is left as-is by owner decision.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c241d4bfb4
ℹ️ 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".
| # by accident, and it was tracked, so a local edit rode along into every diff. | ||
| # Untracked now; appsettings.Development.example.json carries the shared, | ||
| # non-secret Serilog defaults that used to live here. | ||
| src/Cluckwork.Api/appsettings.Development.json |
There was a problem hiding this comment.
Exclude the local config from Docker builds
When a developer retains or creates this newly ignored file with a connection-string credential—the exact accident this change is intended to contain—the documented Compose build still sends it because .dockerignore does not exclude it; Dockerfile then runs COPY . . followed by dotnet publish, whose Web SDK glob packages appsettings*.json. The credential therefore becomes readable from the locally built production image even though Git no longer reports the file, so add this path to .dockerignore as well.
AGENTS.md reference: AGENTS.md:L119-L120
Useful? React with 👍 / 👎.
Found while reviewing an unrelated branch:
src/Cluckwork.Api/appsettings.Development.jsonshowed up as modified in the working tree, carrying a local Postgres connection string and password. The file was tracked, so that edit sat onegit commit -aaway from committing a credential into a repo GitGuardian scans.Why untrack rather than just revert
AGENTS.md already says, twice, that dev secrets belong in
user-secrets— andUserSecretsIdis configured, so the supported path needs no code change:Reverting alone fixes today and not tomorrow: a tracked
appsettings.Development.jsonis the path of least resistance for exactly the value user-secrets exists to hold, and the next person hits it the same way.Why the config didn't just disappear
Untracking on its own would have deleted the shared, non-secret Serilog dev config for every other clone — the log levels and the
{TraceId}:{SpanId}output template that decision #404 depends on. Those move toappsettings.Development.example.json, mirroring the existingdeploy/.env.examplepattern. Git records it as a rename because the content is byte-identical.Checked before removing
Nothing referenced the tracked file: no
csprojitem (the Web SDK globsappsettings*.json), and no reference inDockerfile,.github/,deploy/,tools/, or any doc. A fresh clone simply falls back toappsettings.jsonuntil someone copies the example.Deliberately not touched
.gitignorealready carries an entry forappsettings.Development.local.json— and nothing in the app loads that file. There is noAddJsonFilefor it, and ASP.NET Core does not pick up.local.jsonby default, so anyone following that hint puts config somewhere silently never read. That is a real latent trap, but it is a separate question and is left exactly as-is by owner decision. Flagging it here so it is on the record rather than rediscovered.Scope
Kept off
feat/535-spa-farm-code-prefill(#588) on purpose — that PR is frontend-only and three review rounds have verified it touches nothing undersrc/. This is unrelated and belongs on its own branch.