Modernize WslQuery on .NET 10 and address legacy dependency security - #8
Conversation
|
|
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
There was a problem hiding this comment.
🟡 Changes recommended
There are at least two correctness/completeness issues (COM security init robustness and distributed notice completeness) that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR modernizes WslQuery into a .NET 10, Native AOT–friendly CLI that queries WSL distribution configuration via owned native/registry code and emits a stable 16-field JSON contract using source-generated System.Text.Json. It also removes legacy/experimental dependencies and adds CI + regression coverage to keep the CLI behavior (exit codes, stderr diagnostics, JSON shape) stable.
Changes:
- Migrates the CLI to
net10.0, removesNewtonsoft.Json/Wslhub.Sdk/experimental ILCompiler feed usage, and switches to source-generatedSystem.Text.Json. - Implements Windows registry +
wslapi.dllquerying with constrained DLL search paths and safe native buffer cleanup. - Adds a dependency-free regression test runner, Windows Native AOT publish + smoke tests, and new CI/CodeQL/Dependabot configuration.
File summaries
| File | Description |
|---|---|
| THIRD-PARTY-NOTICES.txt | Adds MIT notice for adapted Wslhub.Sdk-derived model/bindings. |
| tests/SmokeTest.ps1 | Adds published-exe smoke tests for help/args/query behavior in CI. |
| src/WslQuery/WslQuery.csproj | Moves project to net10.0, enables AOT-friendly settings, and publishes license/notice files. |
| src/WslQuery/WindowsDistroQuery.cs | New registry + native WSL query implementation and native env-var buffer management. |
| src/WslQuery/QueryJson.cs | Adds source-generated System.Text.Json serialization (pretty/compact). |
| src/WslQuery/Program.cs | Replaces legacy entrypoint with argument parsing, exit codes, stderr diagnostics, and platform gating. |
| src/WslQuery/nuget.config | Removes the per-project experimental feed configuration. |
| src/WslQuery/NativeMethods.cs | Introduces LibraryImport bindings with System32-only DLL search paths. |
| src/WslQuery/DistroInfo.cs | Defines the 16-field JSON contract model (computed flags + HRESULT + success). |
| src/WslQuery.Tests/WslQuery.Tests.csproj | Adds net10.0 regression runner project referencing the CLI code. |
| src/WslQuery.Tests/Program.cs | Implements regression coverage for JSON contract, CLI behavior, native buffers, and registry fixtures. |
| src/WslQuery.sln | Adds test project and switches solution configs to Any CPU. |
| src/publish.cmd | Updates publish script to Native AOT win-x64 output under artifacts/. |
| src/.vscode/tasks.json | Updates publish/watch tasks for Native AOT publishing and correct watch syntax. |
| src/.vscode/launch.json | Updates debug target path to net10.0. |
| README.md | Updates English README for .NET 10/AOT, exit codes, compatibility notes, and CI/testing guidance. |
| README.ko-kr.md | Adds/updates Korean README with the modernized behavior, tooling, and validation scope. |
| nuget.config | Adds a root NuGet config restricted to nuget.org. |
| global.json | Pins/rolls forward to .NET 10 SDK selection policy. |
| .github/workflows/codeql.yml | Adds CodeQL analysis workflow for C#. |
| .github/workflows/ci.yml | Adds cross-OS build/test plus Windows Native AOT publish and executable smoke test. |
| .github/dependabot.yml | Enables weekly GitHub Actions and NuGet update checks. |
Review details
- Files reviewed: 22/22 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
WslQuery targets .NET 5 and depends on an experimental 2020 AOT compiler. This change moves the CLI to .NET 10 and supported Native AOT tooling, removes the legacy Newtonsoft.Json dependency associated with CVE-2024-21907, and retains the 16-field JSON contract.
Compatibility: the 16 JSON property names were checked against the Wslhub.Sdk 0.1.2 NuGet assembly. Numeric flags and HRESULTs remain. Corrected default/success values and unsigned UID values are intentional changes. JSON escaping can differ. Unknown arguments return 2; query and partial failures return 1 with diagnostics on stderr.
Validation for final head 0bdc6fd:
Use a merge commit to preserve the original contributor history. PR #5's original fork is unavailable and its direct merge API returned HTTP 409; retaining its original head commit in this PR enables GitHub's indirect-merge handling. PR #7 is already merged.
Live configuration queries against populated WSL 1 and WSL 2 distributions remain unverified; hosted-runner smoke checks do not establish that coverage. This PR changes source and CI without publishing a release. Secret scanning was disabled when inspected and its repository setting was not changed.