Skip to content

Commit 141ac0d

Browse files
authored
Merge pull request #2242 from oasisprotocol/lw/comment-signing-apks
Add a security note about signing apks in CI
2 parents 8f4ca7a + 4f4dabf commit 141ac0d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

.changelog/2242.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a security note about signing apks in CI

.github/workflows/ci-build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,22 @@ jobs:
7070
if: github.event_name == 'push'
7171
run: ./gradlew assembleRelease -PversionCodeOverride=${{ steps.vars.outputs.VERSION_CODE_OVERRIDE }}
7272
working-directory: android
73-
- name: Decode and Save Keystore File
74-
if: github.event_name == 'push'
75-
run: |
76-
echo "${{ secrets.KEYSTORE_FILE }}" | base64 --decode > "android/release.jks"
77-
- name: Sign AAB using jarsigner
78-
if: github.event_name == 'push'
79-
run: |
80-
jarsigner -verbose -keystore "android/release.jks" -storepass "${{ secrets.KEYSTORE_PASSWORD }}" -keypass "${{ secrets.KEYSTORE_PASSWORD }}" -signedjar "android/app/build/outputs/bundle/release/app-release-signed.aab" "android/app/build/outputs/bundle/release/app-release.aab" "${{ secrets.KEY_ALIAS }}"
8173
# Targeting version 30 and above we need to align the APK so that all uncompressed data starts on a 4-byte boundary
8274
- name: Zipalign APK
8375
if: github.event_name == 'push'
8476
run: |
8577
"$ANDROID_SDK_ROOT/build-tools/35.0.0/zipalign" -v 4 "android/app/build/outputs/apk/release/app-release-unsigned.apk" "android/app/build/outputs/apk/release/app-release-aligned.apk"
86-
- name: Sign APK using apksigner
78+
- name: Decode and Save Keystore File
79+
if: github.event_name == 'push'
80+
run: |
81+
echo "${{ secrets.KEYSTORE_FILE }}" | base64 --decode > "android/release.jks"
82+
- name: Sign AAB and APK
83+
# Security: should not sign apks on unmerged pullrequest. Otherwise someone
84+
# could sign a malicious app and distribute it with our valid signature (though
85+
# outside playstore).
8786
if: github.event_name == 'push'
8887
run: |
88+
jarsigner -verbose -keystore "android/release.jks" -storepass "${{ secrets.KEYSTORE_PASSWORD }}" -keypass "${{ secrets.KEYSTORE_PASSWORD }}" -signedjar "android/app/build/outputs/bundle/release/app-release-signed.aab" "android/app/build/outputs/bundle/release/app-release.aab" "${{ secrets.KEY_ALIAS }}"
8989
"$ANDROID_SDK_ROOT/build-tools/35.0.0/apksigner" sign --ks "android/release.jks" --ks-pass "pass:${{ secrets.KEYSTORE_PASSWORD }}" --key-pass "pass:${{ secrets.KEYSTORE_PASSWORD }}" --ks-key-alias "${{ secrets.KEY_ALIAS }}" "android/app/build/outputs/apk/release/app-release-aligned.apk"
9090
- name: Upload Android AAB build artifacts
9191
if: github.event_name == 'push'

0 commit comments

Comments
 (0)