Skip to content

Add CodeQL comments to clarify trusted input handling in ResourcesGen… - #11763

Merged
gpaskaleva-msft merged 3 commits into
mainfrom
user/gpaskaleva/resolveCodeQLIssues
Aug 3, 2026
Merged

gpaskaleva-msft merged 3 commits into
mainfrom
user/gpaskaleva/resolveCodeQLIssues

Conversation

@gpaskaleva-msft

@gpaskaleva-msft gpaskaleva-msft commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Adds a suppression comment for CodeQL finding SM00414.

After investigation, the reported data flows were determined to be build-time only and originate from trusted MSBuild inputs (ITaskItem.ItemSpec values such as ResourceFiles, OutputResourcesFile, and _markupFiles). These values are supplied by the project file and build items authored by the developer performing the build, not by untrusted external users or runtime application input.

This area can be re-evaluated in the future if these tasks begin accepting untrusted or externally supplied input.

Microsoft Reviewers: Open in CodeFlow

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds inline CodeQL suppression/justification comments for rule SM00414 in WPF build tasks, documenting that the flagged file-path flows originate from developer-authored MSBuild items (build-time inputs), rather than runtime/untrusted user input.

Changes:

  • Annotates File.OpenRead(inputFile.ItemSpec) call sites in UidManager with CodeQL SM00414 trusted-input justification.
  • Annotates file deletion/existence checks in UidManager.RemoveFile with CodeQL SM00414 trusted-input justification.
  • Annotates resource file existence validation in ResourcesGenerator.ValidResourceFiles with CodeQL SM00414 trusted-input justification.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/UidManager.cs Adds CodeQL SM00414 suppress/justify comments on build-time file IO (read/delete/move) paths derived from MSBuild items.
src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/ResourcesGenerator.cs Adds CodeQL SM00414 suppress/justify comment on resource file existence checks using MSBuild ItemSpec-derived paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

himgoyalmicro
himgoyalmicro previously approved these changes Jul 20, 2026

@himgoyalmicro himgoyalmicro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@harshit7962

Copy link
Copy Markdown
Member

The comments by copilot are not fully valid, but I think we should truncate the reasoning that we have provided. It should be a minimum of 25 chars as per the rules but if copilot suggest that analyzer will find it difficult to read, then we should consider truncating it.

@himgoyalmicro himgoyalmicro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@amarinov-msft amarinov-msft added the PR metadata: Label to tag PRs, to facilitate with triage label Jul 29, 2026
@gpaskaleva-msft

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

@gpaskaleva-msft
gpaskaleva-msft merged commit 2ca0375 into main Aug 3, 2026
8 checks passed
@gpaskaleva-msft
gpaskaleva-msft deleted the user/gpaskaleva/resolveCodeQLIssues branch August 3, 2026 06:52
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants