Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e1d99db
build: pin Gradle distribution and stop logging generated env values
antuz123 Oct 7, 2026
a7f5ddd
docs: add Android payload comparison and reproducibility evidence
antuz123 Oct 7, 2026
0aa9a6a
Pause new USDT wallet setup and commerce
antuz123 Oct 8, 2026
bec7cd9
Retire GasFree client and pause legacy USDT sends
antuz123 Oct 8, 2026
486594d
Guard iOS config codegen against retired credentials
antuz123 Oct 8, 2026
627ba03
Clarify status of historical USDT requests
antuz123 Oct 8, 2026
e6c518e
Run USDT pause checks in pull request CI
antuz123 Oct 8, 2026
1790381
build: validate Android reproducibility inputs before release builds
antuz123 Oct 8, 2026
c0418f0
build: track provisional Android environment name allowlist
antuz123 Oct 8, 2026
d96a821
ci: remove stale SonarCloud workflow from release draft
antuz123 Oct 8, 2026
0b5370d
ci: remove stale SonarCloud workflow from USDT draft
antuz123 Oct 8, 2026
0747e4d
Integrate USDT pause with Android reproducibility preparation
antuz123 Oct 8, 2026
f4464b4
ci: build diagnostic Android artifacts and clarify USDT history
antuz123 Oct 8, 2026
9ef26da
ci: read diagnostic artifact version from release manifest
antuz123 Oct 8, 2026
468138c
fix: keep USDT request history chronological and avoid unverified fees
antuz123 Oct 8, 2026
7afb05f
ci: cover R4 branches and reject unsigned diagnostic bundles
antuz123 Oct 8, 2026
8bb899d
fix(usdt): keep unconfirmed history pending
antuz123 Oct 9, 2026
9bd85d0
test(usdt): require timestamp for confirmed history marker
antuz123 Oct 9, 2026
ebf1b7d
fix(usdt): trust filtered confirmed TRC20 history
antuz123 Oct 9, 2026
7784bd0
fix(usdt): distinguish confirmed chain history from legacy success
antuz123 Oct 9, 2026
3592ede
test: make standalone USDT candidate Electrum checks deterministic
redkeep-agents Oct 12, 2026
c3b9b37
test: accept wrong-key AES UTF-8 rejection
redkeep-agents Oct 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/android-diagnostic-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Android diagnostic build

on:
pull_request:
branches:
- 'release/**'
- sprint
- dev
- main
workflow_dispatch:

permissions:
contents: read

concurrency:
group: android-diagnostic-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 90

steps:
- name: Check out source
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22.23.3

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'

- name: Set up Android SDK tools
uses: android-actions/setup-android@v4
with:
packages: ''

- name: Install Android build packages
run: sdkmanager 'platforms;android-36' 'build-tools;35.0.0' 'ndk;27.1.12297006' 'cmake;3.22.1'

- name: Install JavaScript dependencies without the iOS setup hook
run: |
npm install --global yarn@1.22.22
yarn install --frozen-lockfile --ignore-scripts --non-interactive
./node_modules/.bin/patch-package
./node_modules/.bin/rn-nodeify --install buffer,events,process,stream,inherits,path,assert,crypto --hack --yarn

- name: Create diagnostic configuration
run: |
cat > "$RUNNER_TEMP/keeper-diagnostic.env" <<'EOF'
CHANNEL_URL=https://channel.bitcoinkeeper.app/
ENVIRONMENT=PRODUCTION
HEXA_ID_MAINNET=0000000000000000000000000000000000000000000000000000000000000000
HEXA_ID_TESTNET=0000000000000000000000000000000000000000000000000000000000000000
RELAY=https://example.invalid/
SIGNING_SERVER_MAINNET=https://example.invalid/
SIGNING_SERVER_TESTNET=https://example.invalid/
EOF
node scripts/verify-channel-config.cjs "$RUNNER_TEMP/keeper-diagnostic.env"
printf 'sdk.dir=%s\n' "$ANDROID_SDK_ROOT" > android/local.properties

- name: Confirm Gradle rejects a retired mobile credential
run: |
cp "$RUNNER_TEMP/keeper-diagnostic.env" "$RUNNER_TEMP/keeper-rejected.env"
printf 'GASFREE_API_KEY=diagnostic-only\n' >> "$RUNNER_TEMP/keeper-rejected.env"
if (cd android && ENVFILE="$RUNNER_TEMP/keeper-rejected.env" ./gradlew :app:help --no-daemon --console=plain > "$RUNNER_TEMP/rejected-build.log" 2>&1); then
echo 'Gradle accepted a retired mobile credential' >&2
exit 1
fi
if ! grep -q 'Retired API credentials must not be included in an Android build' "$RUNNER_TEMP/rejected-build.log"; then
tail -80 "$RUNNER_TEMP/rejected-build.log"
exit 1
fi

- name: Build APK and AAB with the public debug key
env:
STORE_PASSWORD: android
KEY_ALIAS: androiddebugkey
KEY_PASSWORD: android
run: |
export ENVFILE="$RUNNER_TEMP/keeper-diagnostic.env"
export KEEPER_ANDROID_KEYSTORE="$GITHUB_WORKSPACE/android/app/debug.keystore"
cd android
./gradlew :app:assembleProductionRelease :app:bundleProductionRelease --no-daemon --console=plain

- name: Check diagnostic artifacts
run: |
apk=android/app/build/outputs/apk/production/release/app-production-release.apk
aab=android/app/build/outputs/bundle/productionRelease/app-production-release.aab
test -s "$apk"
test -s "$aab"
"$ANDROID_SDK_ROOT/build-tools/35.0.0/apksigner" verify "$apk"
badging=$("$ANDROID_SDK_ROOT/build-tools/35.0.0/aapt2" dump badging "$apk")
version=$(node -p 'require("./release/version.json").version')
version_code=$(node -p 'require("./release/version.json").androidVersionCode')
grep -Fq "package: name='io.hexawallet.bitcoinkeeper' versionCode='$version_code' versionName='$version'" <<< "$badging"
if ! jarsigner -verify -verbose -certs "$aab" > "$RUNNER_TEMP/aab-signature.log" 2>&1; then
tail -80 "$RUNNER_TEMP/aab-signature.log"
exit 1
fi
if ! grep -Fxq 'jar verified.' "$RUNNER_TEMP/aab-signature.log" || grep -Fq '? = unsigned entry' "$RUNNER_TEMP/aab-signature.log"; then
tail -80 "$RUNNER_TEMP/aab-signature.log"
echo 'AAB is unsigned or contains unsigned entries' >&2
exit 1
fi
unzip -tq "$apk" >/dev/null
unzip -tq "$aab" >/dev/null
sha256sum "$apk" "$aab"
echo 'Diagnostic APK/AAB built with placeholder config and debug signing; no reproducibility verdict.'
20 changes: 0 additions & 20 deletions .github/workflows/build.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,13 @@ jobs:
- name: Install dependencies
run: yarn install

- name: Check USDT pause and retired build inputs
run: |
node --test tests/services/usdtPause.test.cjs tests/recovery/usdtBackup.test.cjs \
scripts/verify-channel-config.test.cjs ios/scripts/verify-retired-env.test.cjs

- name: Run tests
run: npm run test

- name: Test Android reproducibility tools
run: python3 -B -m unittest scripts/test_compare_android_apks.py reproducibility/test_verify_android_inputs.py
9 changes: 8 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply plugin: 'com.google.gms.google-services'
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
// react-native-config embeds every selected env key, even when JavaScript does not use it.
// Check the resolved env map so direct Gradle builds cannot package retired credentials.
def retiredCredentialKeys = ['GASFREE_API_KEY', 'GASFREE_API_SECRET',
'LETS_EXCHANGE_API_KEY'].collectMany { [it, "RN_${it}"] }
if (retiredCredentialKeys.any { project.ext.env.containsKey(it) }) {
throw new GradleException('Retired API credentials must not be included in an Android build')
}
apply plugin: 'kotlin-android'

/**
Expand Down Expand Up @@ -205,4 +212,4 @@ dependencies {
implementation 'com.itextpdf:itextg:5.5.10'


}
}
1 change: 1 addition & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
15 changes: 13 additions & 2 deletions appcenter-pre-build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
#!/usr/bin/env bash
# Creates an .env from ENV variables for use with react-native-config
set -eu

if [ -n "${RN_GASFREE_API_KEY+x}" ] || [ -n "${RN_GASFREE_API_SECRET+x}" ] || [ -n "${RN_LETS_EXCHANGE_API_KEY+x}" ]; then
printf "Retired API credentials must not be included in a mobile build\n" >&2
exit 1
fi

ENV_WHITELIST=${ENV_WHITELIST:-"^RN_"}
printf "Creating an .env file with the following whitelist:\n"
printf "%s\n" $ENV_WHITELIST
set | egrep -e $ENV_WHITELIST | sed 's/^RN_//g' > .env
printf "\n.env created with contents:\n\n"
cat .env
if grep -Eq '^(RN_)?(GASFREE_API_(KEY|SECRET)|LETS_EXCHANGE_API_KEY)=' .env; then
rm .env
printf "Retired API credentials must not be included in a mobile build\n" >&2
exit 1
fi
printf ".env created\n"
11 changes: 11 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ post_install do |installer|
# :ccache_enabled => true
)

# react-native-config logs and embeds every key from its selected .env file.
# Run the guard in that pod's own phase before its code generator starts.
config_target = installer.pods_project.targets.find { |target| target.name == 'react-native-config' }
config_codegen = config_target&.shell_script_build_phases&.find { |phase| phase.name == '[CP-User] Config codegen' }
raise 'react-native-config codegen phase not found; release credential guard cannot be installed' unless config_codegen

config_codegen.shell_script = <<~SCRIPT + config_codegen.shell_script
set -e
ruby "${PODS_ROOT}/../scripts/verify-retired-env.rb" "${PODS_TARGET_SRCROOT}/ios/ReactNativeConfig" "${SRCROOT}/../.."
SCRIPT

# fixes release issue with xCode 16, bitcode is stripped by default.
bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
Expand Down
17 changes: 17 additions & 0 deletions ios/scripts/verify-retired-env.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Use react-native-config's own reader so this checks the same ENVFILE,
# /tmp/envfile override, and .env fallback that its code generator will use.
reader_directory, environment_root = ARGV
abort('Missing react-native-config environment inputs') unless reader_directory && environment_root

retired_names = %w[GASFREE_API_KEY GASFREE_API_SECRET LETS_EXCHANGE_API_KEY]
retired_names += retired_names.map { |name| "RN_#{name}" }
failure = 'Retired API credentials must not be included in an iOS build'

abort(failure) if retired_names.any? { |name| ENV.key?(name) }

require File.join(reader_directory, 'ReadDotEnv')
dotenv, = read_dot_env(environment_root)
abort(failure) if retired_names.any? { |name| dotenv.key?(name) }
58 changes: 58 additions & 0 deletions ios/scripts/verify-retired-env.test.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const { test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
const { spawnSync } = require('node:child_process');

const verifier = path.join(__dirname, 'verify-retired-env.rb');
const reader = process.env.KEEPER_TEST_RN_CONFIG_READER ||
path.join(__dirname, '..', '..', 'node_modules', 'react-native-config', 'ios', 'ReactNativeConfig');
const secret = 'synthetic-secret-not-for-output';
const retiredNames = ['GASFREE_API_KEY', 'GASFREE_API_SECRET', 'LETS_EXCHANGE_API_KEY'];
retiredNames.push(...retiredNames.map(name => `RN_${name}`));

function verify(contents, additionalEnv = {}) {
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'keeper-ios-env-'));
try {
const envFile = path.join(directory, '.env.test');
fs.writeFileSync(envFile, contents);
return spawnSync('ruby', [verifier, reader, directory], {
cwd: directory,
env: { PATH: process.env.PATH, ENVFILE: envFile, ...additionalEnv },
encoding: 'utf8',
});
} finally {
fs.rmSync(directory, { recursive: true, force: true });
}
}

test('iOS pod guard accepts config without retired credentials', () => {
assert.ok(fs.existsSync(reader), 'Install react-native-config before running this test');
const result = verify('CHANNEL_URL=https://channel.bitcoinkeeper.app/\n');
assert.equal(result.status, 0, result.stderr);
});

for (const name of retiredNames) {
test(`iOS pod guard rejects ${name} in selected ENVFILE before logging its value`,
() => {
const result = verify(`CHANNEL_URL=https://channel.bitcoinkeeper.app/\n${name}=${secret}\n`);
assert.notEqual(result.status, 0);
assert.doesNotMatch(result.stdout + result.stderr, /synthetic-secret-not-for-output/);
});
}

test('iOS pod guard rejects exported retired credentials', () => {
const result = verify(`export GASFREE_API_KEY=${secret}\n`);
assert.notEqual(result.status, 0);
assert.doesNotMatch(result.stdout + result.stderr, /synthetic-secret-not-for-output/);
});

test('iOS pod guard rejects a retired process variable before logging its value',
() => {
const result = verify('CHANNEL_URL=https://channel.bitcoinkeeper.app/\n', {
RN_GASFREE_API_SECRET: secret,
});
assert.notEqual(result.status, 0);
assert.doesNotMatch(result.stdout + result.stderr, /synthetic-secret-not-for-output/);
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"iosProd": "npx react-native run-ios --scheme=hexa_keeper --simulator 'iPhone 16' ",
"start": "react-native start",
"test": "jest",
"test:release": "node --test scripts/release-version.test.cjs && python3 -B -m unittest discover -s scripts -p 'test_release_artifact.py'",
"test:release": "node --test scripts/release-version.test.cjs scripts/verify-channel-config.test.cjs && python3 -B -m unittest discover -s scripts -p 'test_release_artifact.py'",
"version:inspect": "node scripts/release-version.cjs inspect",
"version:check": "node scripts/release-version.cjs check",
"version:apply": "node scripts/release-version.cjs apply",
Expand Down
Loading
Loading