Skip to content

Commit 28df0f2

Browse files
Test secret manager fetching
1 parent 1998948 commit 28df0f2

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Temporary OIDC + AWS SM access check for hellosign/dropbox-sign-java.
2+
# Does not print secret values. Remove this workflow after the check succeeds.
3+
#
4+
# The IAM roles from dropbox-internal/server#548808 are branch-restricted:
5+
# oidc-github-hellosign-dropbox-sign-java-branch-main
6+
# oidc-github-hellosign-dropbox-sign-java-branch-v1
7+
# A PR branch cannot assume them. Merge this file to main, then Run workflow
8+
# on main (Actions → AWS Secrets Manager OIDC POC → Run workflow).
9+
10+
name: AWS Secrets Manager OIDC POC
11+
12+
on:
13+
workflow_dispatch:
14+
15+
permissions: {}
16+
17+
jobs:
18+
fetch-maven-secrets:
19+
if: github.repository == 'hellosign/dropbox-sign-java'
20+
runs-on: ubuntu-latest
21+
permissions:
22+
id-token: write
23+
contents: read
24+
steps:
25+
- name: Configure AWS credentials (OIDC)
26+
uses: aws-actions/configure-aws-credentials@v6
27+
with:
28+
role-to-assume: arn:aws:iam::521590706193:role/oidc-github-hellosign-dropbox-sign-java-branch-${{ github.ref_name }}
29+
aws-region: us-west-2
30+
role-duration-seconds: 900
31+
role-session-name: dropbox-sign-java-oidc-poc-${{ github.run_id }}
32+
mask-aws-account-id: true
33+
34+
- name: Confirm assumed role
35+
run: aws sts get-caller-identity --query Arn --output text
36+
37+
- name: Get Maven Central secrets from AWS Secrets Manager
38+
uses: aws-actions/aws-secretsmanager-get-secrets@v3
39+
with:
40+
secret-ids: |
41+
SONATYPE_USERNAME,sdk-release-maven-central-token-username
42+
SONATYPE_PASSWORD,sdk-release-maven-central-token-password
43+
SIGNING_KEY,sdk-release-signing-key
44+
SIGNING_PASSWORD,sdk-release-signing-password
45+
parse-json-secrets: false
46+
47+
- name: Verify secrets were retrieved
48+
shell: bash
49+
run: |
50+
set -euo pipefail
51+
52+
missing=0
53+
for name in SONATYPE_USERNAME SONATYPE_PASSWORD SIGNING_KEY SIGNING_PASSWORD; do
54+
value="${!name:-}"
55+
if [[ -z "$value" ]]; then
56+
echo "::error::${name} was empty"
57+
missing=1
58+
else
59+
echo "${name} is set (${#value} characters)"
60+
fi
61+
done
62+
63+
if [[ "$missing" -ne 0 ]]; then
64+
echo "::error::One or more secrets were missing"
65+
exit 1
66+
fi
67+
68+
echo "OIDC role assumed and all four Maven publishing secrets were retrieved"

0 commit comments

Comments
 (0)