[Feature Request]: Types for file paths and plain text #9624
Labels
backlog
Feature Request
gathering-feedback
The issue requires feedback in order to be planned, please comment if the feature is useful for you
Priority:3
Work that is nice to have
triaged
Summary
In documentation/specs/proposed, security-metadata.md states:
If a type system is introduced, please include a file path type and a plain text type.
Background and Motivation
When a
TaskItem
is constructed (orItemSpec
is set), the value is passed throughFileUtilities.FixFilePath
:msbuild/src/Utilities/TaskItem.cs
Lines 75 to 81 in 1725b24
msbuild/src/Utilities/TaskItem.cs
Lines 152 to 163 in 1725b24
msbuild/src/Shared/FileUtilities.cs
Lines 543 to 546 in 1725b24
FixFilePath
makes no change under Windows (wherePath.DirectorySeparatorChar
will be'\\'
) but on *NIX OSs (macOS and Linux) a\
character will be replaced with a/
character. This makes some sense for file paths but when an Item collection is used for data that is not file paths and that contains\
characters, the data is corrupted.This issue shows up in multiple places and ways but one example is using the
ReadLinesFromFile
task to read a JavaScript file that has code using regular expressions. The\
character is an escape character in REs. The same MSBuild project will work correctly on Windows and corrupt the RE expressions on Linux and macOS.Proposed Feature
Alternative Designs
No response
The text was updated successfully, but these errors were encountered: