Skip to content

Commit 0a98f56

Browse files
sethkfmanweitingsuncursoragent
authored
chore: Enable AWS Secrets Manager for EXPO Update (#24508)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR enables the AWS Secrets Manage System in the Push EXPO Update work flow. 4 steps have been added to the workflow: - Determine signing secret name - Configure AWS credentials - Fetch secret and export as environment variables - Decode and Export EXPO Key <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Introduces AWS-backed secret management and key handling in `push-eas-update.yml` to support secure EAS OTA updates. > > - Determines `AWS_SIGNING_CERT_SECRET_NAME` per `channel` (exp/rc/production), configures AWS credentials, fetches secrets from Secrets Manager, masks values, and exports them to `GITHUB_ENV`. > - Replaces direct `EXPO_KEY_PRIV` usage with base64-decoded `EXPO_KEY_PRIV_B64` in the build step, failing early if unset. > - Maintains existing build/publish flow while routing to channel-specific update commands. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5185e12. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Wei Sun <wei.sun@consensys.net> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 85b3488 commit 0a98f56

1 file changed

Lines changed: 57 additions & 2 deletions

File tree

.github/workflows/push-eas-update.yml

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,52 @@ jobs:
210210
node-version: '20'
211211
cache: 'yarn'
212212

213+
- name: Determine signing secret name
214+
shell: bash
215+
env:
216+
TARGET: ${{ inputs.channel }}
217+
run: |
218+
case "$TARGET" in
219+
exp)
220+
SECRET_NAME="metamask-exp-expo-signer"
221+
;;
222+
rc)
223+
SECRET_NAME="metamask-rc-expo-signer"
224+
;;
225+
production)
226+
SECRET_NAME="metamask-prod-expo-signer"
227+
;;
228+
*)
229+
echo "❌ Unknown target: $TARGET"
230+
exit 1
231+
;;
232+
esac
233+
echo "AWS_SIGNING_CERT_SECRET_NAME=$SECRET_NAME" >> "$GITHUB_ENV"
234+
235+
- name: Configure AWS credentials
236+
uses: aws-actions/configure-aws-credentials@v4
237+
with:
238+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
239+
aws-region: 'us-east-2'
240+
241+
- name: Fetch secret and export as environment variables
242+
shell: bash
243+
run: |
244+
echo "🔐 Fetching secret from Secrets Manager..."
245+
secret_json=$(aws secretsmanager get-secret-value \
246+
--region 'us-east-2' \
247+
--secret-id "${AWS_SIGNING_CERT_SECRET_NAME}" \
248+
--query SecretString \
249+
--output text)
250+
251+
keys=$(echo "$secret_json" | jq -r 'keys[]')
252+
for key in $keys; do
253+
value=$(echo "$secret_json" | jq -r --arg k "$key" '.[$k]')
254+
echo "::add-mask::$value"
255+
echo "$key=$(printf '%s' "$value")" >> "$GITHUB_ENV"
256+
echo "✅ Set secret for key: $key"
257+
done
258+
213259
- name: Install dependencies
214260
run: |
215261
echo "📦 Installing dependencies..."
@@ -238,14 +284,23 @@ jobs:
238284
239285
- name: Build & Push EAS Update via build.sh
240286
env:
241-
EXPO_KEY_PRIV: ${{ secrets.EXPO_KEY_PRIV }}
242-
# Skip linting during Metro transform in CI (linting already done separately)
243287
SKIP_TRANSFORM_LINT: 'true'
244288
# Increase Node heap to avoid OOM during Expo export in CI
245289
NODE_OPTIONS: '--max_old_space_size=8192'
246290
# Disable LavaMoat sandbox to prevent duplicate bundle executions in CI
247291
EXPO_NO_LAVAMOAT: '1'
248292
run: |
293+
echo "📦 Configuring EXPO key..."
294+
if [[ -z "$EXPO_KEY_PRIV_B64" ]]; then
295+
echo "⚠️ EXPO_KEY_PRIV_B64 is not set. Skipping keystore decoding."
296+
exit 1
297+
fi
298+
299+
# Decode the key
300+
EXPO_KEY_PRIV=$(echo "$EXPO_KEY_PRIV_B64" | base64 --decode)
301+
export EXPO_KEY_PRIV
302+
echo "✅ Expo key decoded and exported"
303+
249304
echo "🚀 Pushing EAS update for channel: ${TARGET_CHANNEL}"
250305
case "${TARGET_CHANNEL}" in
251306
exp)

0 commit comments

Comments
 (0)