Skip to content

RobotFramework: compromised transmitted parameters from TM to robot test when special chars like $

Current situation

Find by running Robot Framework BDD tests using squash parameters. (getTestParam from squash_tf.TFParamService)

If there are some specials chars like $ or \ in the test parameters declared in Squash-TM datasets, the retrieved datas in the executed tests are compromised. Tried with "str" and "dol$", got "" and "dol12458" in the RF tests.

Desired outcome

Transmit proper parameters from squash-TM to the test execution environment Variables values should be: "str" and "dol$"

Analysis

The problem seems to come from the command : cat << "{marker}" > {path}\n{content}\n{marker} using heredoc

Solution

could be to modify the cmd in orchestrator/opentf/plugins/actionprovider/files.py

From this :

def createfile_action(inputs):
      ...

  if core.runner_on_windows():
        encoded = str(base64.b64encode(bytes(content, 'utf8')), 'utf8')
        what = f'@echo {encoded} > {marker} & @certutil -f -decode {marker} {path} & @del {marker}'
    else:
        what = f'cat << {marker} > {path}\n{content}\n{marker}'

to this :

def createfile_action(inputs):
      ...
  if core.runner_on_windows():
        encoded = str(base64.b64encode(bytes(content, 'utf8')), 'utf8')
        what = f'@echo {encoded} > {marker} & @certutil -f -decode {marker} {path} & @del {marker}'
    else:
        what = f'cat << "{marker}" > {path}\n{content}\n{marker}'