chore: cleanup golangci-lint and cspell findings#7548
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document callback-owned cancellation in vsrpc and move spinner cancellation setup below Run() so Stop remains the owner of the callback lifecycle. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f9920ed to
22e5561
Compare
22e5561 to
e98cb60
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #7426 by clearing remaining golangci-lint (gosec) and cspell findings while preserving intended behavior, including a targeted hardening of local template .gitignore reads during initialization.
Changes:
- Anchor local template
.gitignorereads to the template root usingos.OpenRootto prevent nested.gitignoreresolution from escaping the template tree. - Add/relocate
gosecsuppressions with more precise justifications (process inspection on macOS, cancellation callbacks, trusted/managed output paths, local FastAPI detection). - Promote repo-specific spellings into the shared cspell dictionary and adjust file-scoped overrides.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/pkg/ux/spinner.go | Moves WithCancel setup to a clearer location and updates gosec suppression formatting for stored cancel func. |
| cli/azd/pkg/tools/dotnet/dotnet.go | Refines gosec suppression placement/reasoning for writing an azd-managed manifest path. |
| cli/azd/pkg/infra/provisioning/terraform/terraform_provider.go | Refines gosec suppression reasoning for writing parameters into the managed environment directory. |
| cli/azd/pkg/azdext/process_darwin.go | Adds gosec suppressions for exec.Command with PID-derived args (macOS process inspection). |
| cli/azd/pkg/azdext/azd_client.go | Rewords TLS comment for clarity (“man-in-the-middle”). |
| cli/azd/pkg/azdext/atomicfile.go | Fixes spelling (“file systems”). |
| cli/azd/internal/vsrpc/server.go | Adjusts gosec suppression placement and preserves tracing context when creating per-call cancelable contexts. |
| cli/azd/internal/runcontext/agentdetect/detect_process_darwin.go | Adds gosec suppressions for exec.Command with PID-derived args (macOS parent process inspection). |
| cli/azd/internal/repository/initializer.go | Uses os.OpenRoot(source) + relative reads for .gitignore to prevent escaping the local template tree. |
| cli/azd/internal/appdetect/python.go | Adds gosec suppression for opening local project files during FastAPI launch detection. |
| cli/azd/.vscode/cspell.yaml | Adds file-scoped overrides for compat identifiers; removes now-unneeded overrides after dictionary promotion. |
| cli/azd/.vscode/cspell-azd-dictionary.txt | Adds repo terms (e.g., GOWORK, covdata, ndjson, googleapis) to the shared dictionary. |
Copilot's findings
- Files reviewed: 11/12 changed files
- Comments generated: 0
jongio
left a comment
There was a problem hiding this comment.
Clean lint cleanup. One note: the childCtx change in server.go isn't just a nolint reformat - it switches the cancel context's parent from ctx to childCtx, which preserves the tracing span from tracing.Start. The old code was dropping that span for Call requests. Worth mentioning in the PR description since it's a behavior correction, not just a lint fix.
Everything else checks out - os.OpenRoot is the right API for path confinement, spinner reorder is safe (Stop() handles nil cancel), and the cspell promotions are clean.
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
wbreza
left a comment
There was a problem hiding this comment.
Code review: no significant issues found. Linter fixes are appropriate, security hardening with os.Root for path traversal prevention is correct, and lint suppressions are well-justified. LGTM.
Fixes #7426.
This PR cleans up the remaining
golangci-lintandcspellfindings and includes one small correctness fix invsrpcthat fell out of the lint cleanup..gitignorereads to the template root so nested.gitignorefiles can't escape the local template tree during initialization.internal/vsrpc/server.goto derive per-call cancelable contexts fromchildCtx, which preserves the tracing span fromtracing.Startfor Call requests instead of dropping it.gosecsuppressions where the flagged values are already trusted, managed by azd, or owned by a later callback (local FastAPI detection, Darwin process inspection, spinner/server cancellation callbacks, and managed output paths).