Skip to content

Block implicit network-file access in XML resource resolution - #544

Open
Will Portnoy (willportnoy) wants to merge 5 commits into
masterfrom
fix/implicit-network-schema-resolution
Open

Will Portnoy (willportnoy) wants to merge 5 commits into
masterfrom
fix/implicit-network-schema-resolution

Conversation

@willportnoy

Copy link
Copy Markdown
Member

Summary

Prevent automatic Windows network-file access when XML Notepad resolves XML/XSLT resources.

  • Reject UNC paths, encoded network-file aliases, mapped network drives, and unknown drive roots before automatic resource access or cached-file metadata checks.
  • Apply guarded resolution to schemas and their dependencies, external DTDs/entities, XInclude, and XSLT includes/imports and document(), including asynchronous calls.
  • Close resolver bypasses in schema root enumeration, XML instance generation, and stylesheet output browsing.
  • Avoid automatically supplying Windows credentials to document-selected HTTP endpoints.
  • Preserve explicitly selected input documents, local dependencies, and HTTP(S) resources.

Network-share dependencies, including mapped-drive paths, are intentionally blocked. Copy these dependencies locally or serve them over HTTP(S). Explicitly selected main documents and comparison inputs can still reside on network storage.

Regression coverage

Add a headless, mock-backed test project covering resource resolution, URI aliases, drive classification, schema imports, DTDs/entities, XInclude, XSLT, and explicitly selected input documents. The tests do not contact network shares or capture authentication material.

Run these regression tests in the existing Windows CI Debug and Release jobs.

Validation

  • 43 test cases pass on .NET Framework 4.8 and .NET 8 in Debug and Release.
  • Desktop library source/type compilation succeeds against .NET Framework 4.8 references.
  • Full Windows desktop Debug and Release builds and regression runs through this PR's CI.

Cover opening and validation with an in-memory schema source. Four network-schema assertions intentionally fail before the product fix; local-schema and no-schema controls pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 38cfa7db-d690-4e7f-a2ff-a38a5e8015b5
Reject UNC aliases, mapped network drives, and unknown drive roots before synchronous or asynchronous resource I/O. Cover schemas, external DTDs/entities, XInclude, XSLT imports and document(), and cached-file metadata checks.

Preserve local and HTTP(S) sources and explicitly selected input files. Remove automatic Windows target credentials and expand mocked regressions across .NET Framework 4.8 and .NET 8.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 38cfa7db-d690-4e7f-a2ff-a38a5e8015b5
Classify lexical drive roots before filesystem-backed normalization. Guard schema-set preprocessing and stylesheet DOM reloads. Preserve explicit comparison inputs and the XmlTextReader contract while guarding their references.

Add focused regressions and run the headless model suite in both desktop CI configurations. All 43 cases pass on .NET Framework 4.8 and .NET 8 in Debug and Release.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 38cfa7db-d690-4e7f-a2ff-a38a5e8015b5
Use Path.GetRandomFileName for the in-memory document base and Path.GetTempFileName for the owned file fixture, clarifying relative-path and file-ownership intent without CodeQL suppressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 38cfa7db-d690-4e7f-a2ff-a38a5e8015b5
Use the framework-owned temporary-file path for the in-memory document base, remove its placeholder before loading to avoid file watching, and clean up the owned path if initialization fails. This removes the remaining CodeQL path-combine note without suppression.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 38cfa7db-d690-4e7f-a2ff-a38a5e8015b5

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants