Repository: PowerShell/PowerShell
File: src/System.Management.Automation/engine/CommandCompletion/CompletionHelpers.cs (C#)

Code before:
            => value.StartsWith(wordToComplete, StringComparison.OrdinalIgnoreCase);

        /// <summary>
        /// Determines if the given value matches the specified word using wildcard pattern matching.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the value matches the word as a wildcard pattern; otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// Wildcard pattern matching allows for flexible matching, where wilcards can represent 
        /// multiple characters in the input. This strategy is case-insensitive.
        /// </remarks>
        internal static readonly MatchStrategy WildcardPatternMatch = (value, wordToComplete)
            => WildcardPattern
                .Get(wordToComplete + "*", WildcardOptions.IgnoreCase)
                .IsMatch(value);

        /// <summary>
        /// Determines if the given value matches the specified word using either a literal or wildcard escape strategy.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the value matches either the literal normalized word or the wildcard pattern with escaping; 
        /// otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// This strategy first attempts a literal prefix match and, if unsuccessful, escapes the word to complete to 
        /// handle any problematic wildcard characters before performing a wildcard match.
        /// </remarks>
        internal static readonly MatchStrategy WildcardPatternEscapeMatch = (value, wordToComplete)
            => LiteralMatch(value, wordToComplete) ||
               WildcardPatternMatch(value, WildcardPattern.Escape(wordToComplete));

        /// <summary>
        /// Determines if the given value matches the specified word using either a literal or wildcard match strategy.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the value matches either the literal normalized word or the wildcard pattern; otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// This strategy attempts a literal match first and, if unsuccessful, evaluates the word against a wildcard pattern.
        /// </remarks>
        internal static readonly MatchStrategy DefaultMatch = (value, wordToComplete)
            => LiteralMatch(value, wordToComplete) ||
               WildcardPatternMatch(value, wordToComplete);

        /// <summary>
        /// Removes wrapping quotes from a string and returns the quote used, if present.
        /// </summary>
        /// <param name="wordToComplete">
        /// The string to process, potentially surrounded by single or double quotes.
        /// This parameter is updated in-place to exclude the removed quotes.

Review comment (security):
continuation of previous comment:
```suggestion
        /// This strategy first attempts a literal prefix match for performance and, if unsuccessful, escapes the word to complete to 
```

Code after:
            => value.StartsWith(wordToComplete, StringComparison.OrdinalIgnoreCase);

        /// <summary>
        /// Determines if the given value matches the specified word using wildcard pattern matching.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the value matches the word as a wildcard pattern; otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// Wildcard pattern matching allows for flexible matching, where wilcards can represent 
        /// multiple characters in the input. This strategy is case-insensitive.
        /// </remarks>
        internal static readonly MatchStrategy WildcardPatternMatchIgnoreCase = (value, wordToComplete)
            => WildcardPattern
                .Get(wordToComplete + "*", WildcardOptions.IgnoreCase)
                .IsMatch(value);

        /// <summary>
        /// Determines if the given value matches the specified word considering wildcard characters literally.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the value matches either the literal normalized word or the wildcard pattern with escaping; 
        /// otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// This strategy first attempts a literal prefix match for performance and, if unsuccessful, escapes the word to complete to 
        /// handle any problematic wildcard characters before performing a wildcard match.
        /// </remarks>
        internal static readonly MatchStrategy WildcardPatternEscapeMatch = (value, wordToComplete)
            => LiteralMatchOrdinalIgnoreCase(value, wordToComplete) ||
               WildcardPatternMatchIgnoreCase(value, WildcardPattern.Escape(wordToComplete));

        /// <summary>
        /// Determines if the given value matches the specified word taking into account wildcard characters.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the value matches either the literal normalized word or the wildcard pattern; otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// This strategy attempts a literal match first for performance and, if unsuccessful, evaluates the word against a wildcard pattern.
        /// </remarks>
        internal static readonly MatchStrategy DefaultMatch = (value, wordToComplete)
            => LiteralMatchOrdinalIgnoreCase(value, wordToComplete) ||
               WildcardPatternMatchIgnoreCase(value, wordToComplete);

        /// <summary>
        /// Removes wrapping quotes from a string and returns the quote used, if present.
        /// </summary>
        /// <param name="wordToComplete">
        /// The string to process, potentially surrounded by single or double quotes.
        /// This parameter is updated in-place to exclude the removed quotes.