Variable masking issue with repeating characters

Summary

Modifying TestVariablesMasking, I found that if you prefix a variable with the same initial character, the whole variable is revealed.

Steps to reproduce

Your existing test case checks that:

This is the secret message cont@ining :secret duplicateValues becomes Th[MASKED] [MASKED] the secret message [MASKED] [MASKED] [MASKED]s

However, if you modify the message to: Thiis iis the secret message ccont@ining ::secret dduplicateValues

The "clean" message becomes: Thiis iis the secret message ccont@ining ::secret dduplicateValues

I'm not entirely sure why this happens. However, I'm currently writing an alternative gitlab-runner with a focus on loosely coupled packages for developers to create custom runners. You're welcome to port jobd's solution if it's the easier fix.