Search code examples
parameter-passingrundeck

Inject Key Storage Password into Option's ValuesUrl


I'm trying to request a raw file from a Gitlab repository as a values JSON file for my job option. The only way so far that I managed to do it is by writing my secret token as plain text in the request URL:

https://mycompanygitlab.com/api/v4/projects/XXXX/repository/files/path%2Fto%2Fmy%2Ffile.json/raw?ref=main&private_token=MyV3ry53cr3Tt0k3n

I've tried using option cascading; I created a Secure password Input Option called gitlab_token which points to a Key Storage Password and tried every possible notation (with or without .value, quoted or unquoted option) in the valuesUrl field of the second option, instead of the plain token, but I keep receiving this error message pointing an invalid char at the position of the dollar sign: error_message

I've redacted sensitive info and edited the error print accordingly


Solution

  • I reproduced your issue. It works using a text option, you can use the value in this way: ${option.mytoken.value}.

    - defaultTab: nodes
      description: ''
      executionEnabled: true
      id: e4f114d5-b3af-44a5-936f-81d984797481
      loglevel: INFO
      name: ResultData
      nodeFilterEditable: false
      options:
      - name: mytoken
        value: deda66698444
      - name: apiendpoint
        valuesUrl: https://mocki.io/v1/xxxxxxxx-xxxx-xxxx-xxxx-${option.mytoken.value}
      plugins:
        ExecutionLifecycle: null
      scheduleEnabled: true
      sequence:
        commands:
        - exec: echo ${option.mytoken}
        - exec: echo ${option.apiendpoint}
        keepgoing: false
        strategy: node-first
      uuid: e4f114d5-b3af-44a5-936f-81d984797481
    

    Another workaround (if you don't want to use a plain text option) could be to pass the secure option to an inline script and manage the logic from there.

    Please open a new issue here.