microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
22.54k stars 1.39k forks source link

Block control codes and truncate longer configuration text blocks #4436

Closed JohnMcPMS closed 2 months ago

JohnMcPMS commented 2 months ago

Change

All control codes in the range [0x0, 0x20) and the DELETE control code 0x7F (with the exceptions of the tab, line feed, and carriage return characters) will result in an error from the YAML parser. An alternative solution is to convert them to their control pictures, but it was decided that it was best to fail at this time.

The configuration output for each unit during the "show" portion (used by almost all of the commands to display details about the file) will limit the amount of output allowed for any field that comes from an external source. Data from the file will present a warning that it was truncated just below its output. If anything is truncated, an overall "error" will be output as well.

Validation

New and old tests alike.

Microsoft Reviewers: Open in CodeFlow