Skip to content

Commit cddfaf4

Browse files
Merge pull request #23 from step-security/varunsh-coder-patch-1
Update README
2 parents b6a07fe + 0dc41e3 commit cddfaf4

File tree

1 file changed

+73
-9
lines changed

1 file changed

+73
-9
lines changed

README.md

+73-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,79 @@
1-
# get-mfa-secrets
2-
[![get-mfa-secrets](images/banner.png)](#)
3-
Use Multi-Factor-Authentication (MFA) secrets in your GitHub Actions workflows
1+
# wait-for-secrets
42

5-
> :warning: This GitHub Action is not ready for Production use.
3+
GitHub Action that waits for secrets to be entered during a workflow run. The secrets can be entered using a web browser.
64

75
## Why?
8-
Lot of software is published using Continous Deployment (CD) Pipelines. Publishing secrets are typically stored with the CI/ CD provider. This makes it hard to use Multi-Factor-Authentication (MFA) to publish software.
6+
- To enable using one-time password (OTPs) for a release workflow.
7+
- To remove need to persist secrets in GitHub Secrets.
8+
- You have more control over when secrets get used in your workflows.
9+
- Even if someone has write access to the repository, they do not get access to the secrets
910

10-
As an example, NPM allows use of OTP (one-time password) for publishing NPM package, but the OTP is only valid for a minute or so. This makes it hard to use it in the CD pipeline.
11+
## How?
1112

12-
This GitHub Action allows use of MFA and OTPs during the CD pipeline
13+
1. Add the `wait-for-secrets` GitHub Action to your workflow and specify the secrets you need.
14+
2. The Action will print a URL in the build log every 10 seconds.
15+
3. Click on the URL and enter the secrets that the workflow needs.
16+
4. The Action will get the secrets you entered in the browser and continue execution.
17+
5. Use the retreived secrets in future steps.
1318

14-
## How does it work?
15-
It waits for input when the credential is needed and prints out a website URL in the logs. You can click the link and enter the input in the StepSecurity website. The secret is then sent over to the GitHub Action, where it can be used.
19+
### AWS Secrets
20+
21+
Example on how to provide AWS credentials during the workflow.
22+
23+
It needs the `id-token: write` permission to authenticate to the StepSecurity API. This is to ensure only the authorized workflow can retreive the secrets.
24+
25+
``` yaml
26+
jobs:
27+
release:
28+
permissions:
29+
contents: read
30+
id-token: write
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: step-security/wait-for-secrets@v1
34+
id: wait-for-secrets
35+
with:
36+
secrets: |
37+
AWS_ACCESS_KEY_ID
38+
AWS_SECRET_ACCESS_KEY
39+
40+
- name: Configure AWS Credentials
41+
uses: aws-actions/configure-aws-credentials@v1
42+
with:
43+
aws-access-key-id: ${{ steps.wait-for-secrets.outputs.AWS_ACCESS_KEY_ID }}
44+
aws-secret-access-key: ${{ steps.wait-for-secrets.outputs.AWS_SECRET_ACCESS_KEY }}
45+
aws-region: us-west-2
46+
```
47+
48+
### Slack notification
49+
50+
You can get a notification on Slack when the secret needs to be entered. Set the `slack-webhook-url` as shown below.
51+
This example also shows how to publish to NPM registry using an OTP.
52+
53+
``` yaml
54+
jobs:
55+
release:
56+
permissions:
57+
contents: read
58+
id-token: write
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: step-security/wait-for-secrets@v1
62+
id: wait-for-secrets
63+
with:
64+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
65+
secrets: |
66+
otp
67+
npm_token
68+
- run: |
69+
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > .npmrc
70+
npm publish --otp ${{ steps.wait-for-secrets.outputs.otp }}
71+
env:
72+
NODE_AUTH_TOKEN: ${{ steps.wait-for-secrets.outputs.npm_token }}
73+
```
74+
75+
### Actual examples
76+
77+
Here are a couple of workflows that use `wait-for-secrets`
78+
1. https://github.com/step-security/secure-workflows/blob/main/.github/workflows/release.yml#L36-L49
79+
2. https://github.com/step-security/wait-for-secrets/blob/varunsh-coder-patch-1/.github/workflows/release.yml#L35-L44

0 commit comments

Comments
 (0)