Skip to content

JSON Value parsing support #172

@larivierec

Description

@larivierec

Hello, this is more of a question than an issue.
I read through some of the code and don't see any mention of using
K / V (with multiple key/values) with this action.

From what I understand everything is 1 to 1.
I was wondering if there are plans to do something similar to AWS Secrets Manager where it hides each
K => V
V =>
k => (hidden) v

Currently, I have tried to do something similar to this,

...

jobs:
  get-secret:
    name: Retrieve Secrets
    runs-on: ["main-arc-runner-set"]
    outputs:
      bot_app_id: ${{ steps.parse-secrets.outputs.bot_app_id }}
      bot_app_private_key: ${{ steps.parse-secrets.outputs.bot_app_private_key }}
    steps:
      - name: Get Secrets
        uses: bitwarden/sm-action@v2
        with:
          access_token: ${{ secrets.BW_ACCESS_TOKEN }}
          secrets: |
            SECRET_ID > GH_SECRETS
      - name: Install jq
        run: sudo apt-get update && sudo apt-get install -y jq

      - name: Extract Secret Values
        id: parse-secrets
        run: |
          BOT_APP_ID="$(jq -r .bot_id <<< "${GH_SECRETS}")"
          echo "::add-mask::${BOT_APP_ID}"
          echo "bot_app_id=${BOT_APP_ID}" >> "$GITHUB_OUTPUT"

and the bot_app_id is shown as plaintext.

The example of AWS secrets manager has a "parse-json-secrets" field, which allows us to render the nested key/values of each value as unique hidden secrets.

- name: Step name
  uses: aws-actions/aws-secretsmanager-get-secrets@v2
  with:
    secret-ids: |
      secretId1
      ENV_VAR_NAME, secretId2
    name-transformation: (Optional) uppercase|lowercase|none
    parse-json-secrets: (Optional) true|false
    auto-select-family-attempt-timeout: (Optional) positive integer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions