Skip to content

Commit

Permalink
Update to latest CLI version v6.2421.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikescops committed May 22, 2024
1 parent 389ec1b commit 5ede5e5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 58 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ jobs:
env:
ACTION_SECRET_PASSWORD: dl://918E3113-CA48-4642-8FAF-CE832BDED6BE/password
ACTION_SECRET_NOTE: dl://918E3113-CA48-4642-8FAF-CE832BDED6BE/note
DASHLANE_DEVICE_ACCESS_KEY: ${{ secrets.DASHLANE_DEVICE_ACCESS_KEY }}
DASHLANE_DEVICE_SECRET_KEY: ${{ secrets.DASHLANE_DEVICE_SECRET_KEY }}
DASHLANE_LOGIN: ${{ secrets.DASHLANE_LOGIN }}
DASHLANE_MASTER_PASSWORD: ${{ secrets.DASHLANE_MASTER_PASSWORD }}
DASHLANE_SERVICE_DEVICE_KEYS: ${{ secrets.DASHLANE_SERVICE_DEVICE_KEYS }}
- name: test secret values
env:
ACTION_SECRET_PASSWORD: ${{ steps.load_secrets.outputs.ACTION_SECRET_PASSWORD }}
Expand All @@ -39,10 +36,7 @@ jobs:
id: load_secrets
uses: ./ # Dashlane/load-secrets-action@<version>
env:
DASHLANE_DEVICE_ACCESS_KEY: ${{ secrets.DASHLANE_DEVICE_ACCESS_KEY }}
DASHLANE_DEVICE_SECRET_KEY: ${{ secrets.DASHLANE_DEVICE_SECRET_KEY }}
DASHLANE_LOGIN: ${{ secrets.DASHLANE_LOGIN }}
DASHLANE_MASTER_PASSWORD: ${{ secrets.DASHLANE_MASTER_PASSWORD }}
DASHLANE_SERVICE_DEVICE_KEYS: ${{ secrets.DASHLANE_SERVICE_DEVICE_KEYS }}
- name: Test with no entries
env:
ACTION_SECRET_PASSWORD: ${{ steps.load_secrets.outputs.ACTION_SECRET_PASSWORD }}
Expand Down
66 changes: 35 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,25 @@
# Dashlane Load Secrets Action

## About
`load-secrets-action` is built using `Dashlane CLI` and `Github Actions`. It allows developers to inject their secrets vault from Dashlane to their Github workflow.

`load-secrets-action` is built using `Dashlane CLI` and `Github Actions`. It allows developers to inject their secrets vault from Dashlane to their github workfow.
## Usage

## Requirements
> [!IMPORTANT]
> To setup this action you need a Dashlane account and the Dashlane CLI to be installed on your machine. You can download the Dashlane CLI [here](https://dashlane.github.io/dashlane-cli/install).
- `Dashlane CLI`for device registration
- `Node.js` and `npm`to run the project locally

## How to run this project locally

1- install dependencies:
**1- Register your device locally**

```sh
npm i
```

2- any change to the `index.js` requires a local build so that the the `dist` folder gets updated :

```sh
ncc build src/index.js
```

## How to use

1- Register your device locally

```sh
dcli devices register "server-name"
dcli devices register "action-name"
```

For more details refer to Dashlane CLI documentation https://dashlane.github.io/dashlane-cli

2- Set the environment variables prompted by the previous step in your GitHub repository’s secrets and variables
**2- Set the environment variable prompted by the previous step in your GitHub repository’s secrets and variables**

![Github Secrets](./documentation/github_secrets.png)

3- Set the same env variables in your pipeline as well as the ids of the secrets you want to read from Dashlane starting with `dl://`
**3- Set the same env variables in your pipeline as well as the ids of the secrets you want to read from Dashlane starting with `dl://`**

```yml
steps:
Expand All @@ -48,17 +30,39 @@ steps:
env:
ACTION_SECRET_PASSWORD: dl://918E3113-CA48-4642-8FAF-CE832BDED6BE/password
ACTION_SECRET_NOTE: dl://918E3113-CA48-4642-8FAF-CE832BDED6BE/note
DASHLANE_DEVICE_ACCESS_KEY: ${{ secrets.DASHLANE_DEVICE_ACCESS_KEY }}
DASHLANE_DEVICE_SECRET_KEY: ${{ secrets.DASHLANE_DEVICE_SECRET_KEY }}
DASHLANE_LOGIN: ${{ secrets.DASHLANE_LOGIN }}
DASHLANE_MASTER_PASSWORD: ${{ secrets.DASHLANE_MASTER_PASSWORD }}
DASHLANE_SERVICE_DEVICE_KEYS: ${{ secrets.DASHLANE_SERVICE_DEVICE_KEYS }}
```
4- Retrieve your secrets in any next step of your pipeline using `GITHUB_OUTPUT`
**4- Retrieve your secrets in any next step of your pipeline using `GITHUB_OUTPUT`**

```yml
- name: test secret values
env:
ACTION_SECRET_PASSWORD: ${{ steps.load_secrets.outputs.ACTION_SECRET_PASSWORD }}
ACTION_SECRET_NOTE: ${{ steps.load_secrets.outputs.ACTION_SECRET_NOTE }}
```

## Development

### Requirements

- `Dashlane CLI`for device registration
- `Node.js` and `npm`to run the project locally

### How to run this project locally

1- install dependencies:

```sh
npm i
```

2- any change to the `index.js` requires a local build so that the the `dist` folder gets updated :

```sh
ncc build src/index.js
```

## Contributing

Feel free to contribute to this project, fork and pull request your ideas. Don't include work that is not open source or not from you.
Binary file modified documentation/github_secrets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 4 additions & 19 deletions src/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,8 @@ check_credentials() {
# Check all Dashlane and access keys are provided
# Make them available to the current step through env vari

if [ -z "$DASHLANE_DEVICE_ACCESS_KEY" ]; then
echoError "DASHLANE_DEVICE_ACCESS_KEY is missing"
exit 1
fi

if [ -z "$DASHLANE_DEVICE_SECRET_KEY" ]; then
echoError "DASHLANE_DEVICE_SECRET_KEY is missing"
exit 1
fi

if [ -z "$DASHLANE_LOGIN" ]; then
echoError "DASHLANE_LOGIN is missing"
exit 1
fi

if [ -z "$DASHLANE_MASTER_PASSWORD" ]; then
echoError "DASHLANE_MASTER_PASSWORD is missing"
if [ -z "$DASHLANE_SERVICE_DEVICE_KEYS" ]; then
echoError "DASHLANE_SERVICE_DEVICE_KEYS is missing"
exit 1
fi

Expand All @@ -49,10 +34,10 @@ install_cli() {
exit 1
fi

curl -sSfLo dcli https://github.com/Dashlane/dashlane-cli/releases/download/v6.2405.0/dcli-linux-x64
curl -sSfLo dcli https://github.com/Dashlane/dashlane-cli/releases/download/v6.2421.0/dcli-linux-x64

elif [[ "$OSTYPE" == "darwin"* ]]; then
curl -sSfLo dcli https://github.com/Dashlane/dashlane-cli/releases/download/v6.2405.0/dcli-macos-arm64
curl -sSfLo dcli https://github.com/Dashlane/dashlane-cli/releases/download/v6.2421.0/dcli-macos-arm64
else
echoError "Operating system not supported yet for this GitHub Action: $OSTYPE."
exit 1
Expand Down

0 comments on commit 5ede5e5

Please sign in to comment.