Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing issues fetching a JSON secret value from CyberArk using cyberark/conjur-action@v2.0.5 #11

Open
nravuru opened this issue Aug 26, 2024 · 0 comments

Comments

@nravuru
Copy link

nravuru commented Aug 26, 2024

Hi,
We are trying to fetch a service account which is in the format of JSON from Conjur using cyberark/conjur-action@v2.0.5 through Github Actions. When the workflow runs, we are getting below error. Tried with v2.0.6 as well but facing the same issue. Is there any known issues with this action in fetching a JSON value?

Error: Unable to process file command 'env' successfully.
Error: Invalid format ' "type": "service_account",'

Below is my workflow file :

name: conjur-cloud-apikey

on:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

  steps:
    - name: Import Secrets using CyberArk Conjur Secret Fetcher Action
      uses: cyberark/conjur-action@v2.0.6
      with:
        url: ${{ vars.CONJUR_URL }}
        account: ${{ vars.CONJUR_ACCOUNT }}
        host_id: ${{ secrets.CONJUR_USERNAME }}
        api_key: ${{ secrets.CONJUR_API_AUTH_KEY }}
        secrets: ${{ vars.CONJUR_STORAGE_DEV_KEY }}

    - name: Escape JSON and set as environment variable
      run: |
        echo "Escaping JSON secret"
        ESCAPED_JSON=$(echo "${{ env.SECRET_JSON }}" | jq -aRs .)
        echo "SECRET_JSON_ESCAPED=${ESCAPED_JSON}" >> $GITHUB_ENV

    - name: Use the JSON secret
      run: |
        echo "Using the JSON secret"
        echo "SECRET_JSON_ESCAPED: ${{ env.SECRET_JSON_ESCAPED }}"
        echo "${{ env.SECRET_JSON_ESCAPED }}" | jq .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant