microsoft/azure-pipelines-task-lib

Can't use Regular Expression as Input

barrcodes opened this issue · 1 comments

Environment

azure-pipelines-task-lib version: 2.9.3

Issue Description

Can't accept regular expression as string input.

Expected behaviour

I would like to allow regular expressions as input.

Actual behaviour

When supplying certain values as input, I receive an exception during decipheriv.update. The following two types of data have caused this exception:

  • A string with only one character, i.e. tmr.setInput('RegExpFlags', 'g');
  • A regular expression string, i.e. tmr.setInput('RegExp', '/versionCode ([0-9]+)/g');
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'encoding' is invalid for data of length 23. Received 'hex'
    at validateEncoding (internal/validators.js:153:11)
    at Decipheriv.update (internal/crypto/cipher.js:159:3)
    at Vault.retrieveSecret (/Users/matthewbarr/repos/alle-regex-transform/node_modules/azure-pipelines-task-lib/vault.js:54:32)
    at Object.getInput (/Users/matthewbarr/repos/alle-regex-transform/node_modules/azure-pipelines-task-lib/task.js:200:27)
    at Object.<anonymous> (/Users/matthewbarr/repos/alle-regex-transform/index.js:10:24)

Steps to reproduce

  1. Create a task with at least one input of type string
  2. Add a line in the task to get the input.
  3. Create a mocha test case where you set that input to either
    1. A regular expression
    2. A single character input
  4. Create a debug launch config for mocha
  5. Run debug.

This issue has had no activity in 90 days. Please comment if it is not actually stale