Skip to content

Commit fa33939

Browse files
committed
stealth(foundation): build profile generation + flag plumbing
1 parent 2ad701f commit fa33939

11 files changed

Lines changed: 1678 additions & 73 deletions

File tree

.github/workflows/build-android.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@ on:
1212
installer_base_name:
1313
required: true
1414
type: string
15+
android_identity_seed:
16+
required: false
17+
type: string
18+
stealth_leakage_mode:
19+
description: "Optional stealth leakage scan mode, for example stealth or stealth-novpn"
20+
required: false
21+
type: string
22+
default: ""
23+
obfuscate_go:
24+
description: "Build Android Go/native libraries through garble"
25+
required: false
26+
type: boolean
27+
default: false
28+
secrets:
29+
GRADLE_PROPERTIES:
30+
required: true
31+
APP_ENV:
32+
required: true
33+
KEYSTORE:
34+
required: true
35+
STEALTH_GARBLE_SEED:
36+
required: false
1537

1638
jobs:
1739
build-android:
@@ -148,14 +170,58 @@ jobs:
148170
env:
149171
GOMOBILECACHE: ${{ env.GOMOBILECACHE }}
150172

173+
- name: Run stealth manifest filter tests
174+
run: make stealth-manifest-filter-test
175+
176+
- name: Install garble
177+
if: ${{ inputs.obfuscate_go }}
178+
run: make install-garble
179+
180+
- name: Build Android obfuscated (APK + AAB)
181+
if: ${{ inputs.obfuscate_go }}
182+
run: make android-release-ci-obfuscated
183+
env:
184+
BUILD_TYPE: ${{ inputs.build_type }}
185+
VERSION: ${{ inputs.version }}
186+
INSTALLER_NAME: ${{ inputs.installer_base_name }}
187+
ANDROID_IDENTITY_SEED: ${{ inputs.android_identity_seed }}
188+
GOMOBILECACHE: ${{ env.GOMOBILECACHE }}
189+
STEALTH_GARBLE_SEED: ${{ secrets.STEALTH_GARBLE_SEED }}
190+
151191
- name: Build Android (APK + AAB)
192+
if: ${{ !inputs.obfuscate_go }}
152193
run: make android-release-ci
153194
env:
154195
BUILD_TYPE: ${{ inputs.build_type }}
155196
VERSION: ${{ inputs.version }}
156197
INSTALLER_NAME: ${{ inputs.installer_base_name }}
198+
ANDROID_IDENTITY_SEED: ${{ inputs.android_identity_seed }}
157199
GOMOBILECACHE: ${{ env.GOMOBILECACHE }}
158200

201+
- name: Stealth leakage check
202+
id: stealth_leakage_check
203+
if: ${{ inputs.stealth_leakage_mode != '' }}
204+
shell: bash
205+
run: |
206+
set -o pipefail
207+
: > stealth-leakage-report.txt
208+
make stealth-leakage-check 2>&1 | tee stealth-leakage-report.txt
209+
env:
210+
STEALTH_LEAKAGE_MODE: ${{ inputs.stealth_leakage_mode }}
211+
STEALTH_LEAKAGE_MISSING_OK: "0"
212+
STEALTH_LEAKAGE_PATHS: >-
213+
${{ inputs.installer_base_name }}${{ inputs.build_type != 'production' && format('-{0}', inputs.build_type) || '' }}.apk
214+
${{ inputs.installer_base_name }}${{ inputs.build_type != 'production' && format('-{0}', inputs.build_type) || '' }}.aab
215+
216+
- name: Upload stealth leakage report
217+
if: ${{ always() && inputs.stealth_leakage_mode != '' && steps.stealth_leakage_check.outcome != 'skipped' }}
218+
uses: actions/upload-artifact@v4
219+
with:
220+
name: stealth-leakage-report
221+
path: stealth-leakage-report.txt
222+
if-no-files-found: error
223+
retention-days: 14
224+
159225
- name: Upload Android APK
160226
uses: actions/upload-artifact@v4
161227
with:

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ on:
4444
required: false
4545
type: boolean
4646
default: false
47+
stealth_leakage_mode:
48+
description: "Run Android stealth leakage scanner for manual Android builds"
49+
required: false
50+
type: choice
51+
options:
52+
- none
53+
- stealth
54+
- stealth-novpn
55+
default: none
4756

4857
permissions:
4958
contents: write
@@ -69,6 +78,7 @@ jobs:
6978
linux_arch: ${{ steps.meta.outputs.linux_arch }}
7079
is_test_run: ${{ steps.meta.outputs.is_test_run }}
7180
smoke_enable_ip_check: ${{ steps.meta.outputs.smoke_enable_ip_check }}
81+
stealth_leakage_mode: ${{ steps.meta.outputs.stealth_leakage_mode }}
7282
steps:
7383
- name: Checkout repo
7484
uses: actions/checkout@v4
@@ -202,6 +212,13 @@ jobs:
202212
fi
203213
204214
SMOKE_ENABLE_IP_CHECK="false"
215+
STEALTH_LEAKAGE_MODE=""
216+
if [[ "$EVENT" == "workflow_dispatch" ]]; then
217+
requested_stealth_leakage_mode="${{ github.event.inputs.stealth_leakage_mode }}"
218+
if [[ "$requested_stealth_leakage_mode" != "none" ]]; then
219+
STEALTH_LEAKAGE_MODE="$requested_stealth_leakage_mode"
220+
fi
221+
fi
205222
206223
echo "build_type=$BUILD_TYPE" >> $GITHUB_OUTPUT
207224
echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
@@ -211,6 +228,7 @@ jobs:
211228
echo "installer_base_name=$INSTALLER_BASE_NAME" >> $GITHUB_OUTPUT
212229
echo "is_test_run=$IS_TEST_RUN" >> $GITHUB_OUTPUT
213230
echo "smoke_enable_ip_check=$SMOKE_ENABLE_IP_CHECK" >> $GITHUB_OUTPUT
231+
echo "stealth_leakage_mode=$STEALTH_LEAKAGE_MODE" >> $GITHUB_OUTPUT
214232
215233
- name: Update pubspec.yaml version
216234
shell: bash
@@ -355,6 +373,7 @@ jobs:
355373
version: ${{ needs.set-metadata.outputs.version }}
356374
build_type: ${{ needs.set-metadata.outputs.build_type }}
357375
installer_base_name: ${{ needs.set-metadata.outputs.installer_base_name }}
376+
stealth_leakage_mode: ${{ needs.set-metadata.outputs.stealth_leakage_mode }}
358377

359378
release-create:
360379
needs: set-metadata

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Miscellaneous
22
*.class
3+
*.apk
4+
*.so
35
*.log
46
*.pyc
57
*.swp

0 commit comments

Comments
 (0)