diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index c5a1100..6aeb2e8 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -1,5 +1,8 @@ name: Droid Commander Production Android Build, Signing & Security Scanning +permissions: + contents: read + on: pull_request: types: [opened, synchronize, reopened] @@ -90,3 +93,98 @@ jobs: - name: Run Jest Test Suite run: npm test -- --passWithNoTests + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Create temporary debug signing keystore + run: | + keytool -genkeypair -v \ + -keystore android/app/debug.keystore \ + -storepass android \ + -alias androiddebugkey \ + -keypass android \ + -keyalg RSA -keysize 2048 -validity 10000 \ + -dname "CN=Android Debug,O=Android,C=US" \ + -noprompt + + - name: Build debug APK + run: | + chmod +x android/gradlew + cd android + ./gradlew --no-daemon assembleDebug + + - name: Upload debug APK + uses: actions/upload-artifact@v4 + with: + name: droid-commander-debug-apk + path: android/app/build/outputs/apk/debug/*.apk + if-no-files-found: error + retention-days: 14 + + build-release-apk: + name: Build signed production release APK + needs: sast-static-analysis + if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + environment: production + steps: + - name: Checkout Codebase + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v5 + with: + java-version: '17' + distribution: 'zulu' + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + + - name: Install Dependencies + run: npm ci + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Configure release signing + env: + ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} + ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} + ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} + ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} + ANDROID_KEYSTORE_PATH: ${{ runner.temp }}/droid-commander-release.keystore + run: | + set -euo pipefail + for name in ANDROID_KEYSTORE_BASE64 ANDROID_KEYSTORE_PASSWORD ANDROID_KEY_ALIAS ANDROID_KEY_PASSWORD; do + if [ -z "${!name}" ]; then + echo "::error::Missing required GitHub Actions secret: $name" + exit 1 + fi + done + printf '%s' "$ANDROID_KEYSTORE_BASE64" | base64 --decode > "$ANDROID_KEYSTORE_PATH" + chmod 600 "$ANDROID_KEYSTORE_PATH" + echo "ANDROID_KEYSTORE_PATH=$ANDROID_KEYSTORE_PATH" >> "$GITHUB_ENV" + echo "ANDROID_KEYSTORE_PASSWORD=$ANDROID_KEYSTORE_PASSWORD" >> "$GITHUB_ENV" + echo "ANDROID_KEY_ALIAS=$ANDROID_KEY_ALIAS" >> "$GITHUB_ENV" + echo "ANDROID_KEY_PASSWORD=$ANDROID_KEY_PASSWORD" >> "$GITHUB_ENV" + + - name: Build signed release APK + env: + ANDROID_VERSION_CODE: ${{ github.run_number }} + ANDROID_VERSION_NAME: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || format('manual-{0}', github.run_number) }} + run: | + chmod +x android/gradlew + cd android + ./gradlew --no-daemon assembleRelease + + - name: Upload signed release APK + uses: actions/upload-artifact@v4 + with: + name: droid-commander-release-apk + path: android/app/build/outputs/apk/release/*.apk + if-no-files-found: error + retention-days: 30 diff --git a/android/app/build.gradle b/android/app/build.gradle index cbe86df..cf66777 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -32,7 +32,9 @@ react { // The list of variants to that are debuggable. For those we're going to // skip the bundling of the JS bundle and the assets. By default is just 'debug'. // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. - // debuggableVariants = ["liteDebug", "prodDebug"] + // Package the JavaScript bundle in BOTH debug and release APKs. This makes the CI debug APK installable without Metro. + // Keep this empty: the default ["debug"] skips JS bundling for debug builds. + debuggableVariants = [] /* Bundling */ // A list containing the node command and its flags. Default is just 'node'. diff --git a/app/(tabs)/_layout.tsx b/app/(tabs)/_layout.tsx index 3d54bb1..f13b6a7 100644 --- a/app/(tabs)/_layout.tsx +++ b/app/(tabs)/_layout.tsx @@ -1,7 +1,7 @@ import { Tabs } from "expo-router"; import { useSafeAreaInsets } from "react-native-safe-area-context"; -import { HapticTab } from "../../components/HapticTab"; +import { HapticTab } from "../../components/haptic-tab"; import { IconSymbol } from "@/components/ui/icon-symbol"; import { palette } from "@/constants/commander"; import { Platform } from "react-native"; diff --git a/app/(tabs)/wireless-diagnostics-screen.tsx b/app/(tabs)/wireless-diagnostics-screen.tsx index e1152c2..4cca851 100644 --- a/app/(tabs)/wireless-diagnostics-screen.tsx +++ b/app/(tabs)/wireless-diagnostics-screen.tsx @@ -60,19 +60,6 @@ export default function WirelessDiagnosticsScreen() { )} - - Wi-Fi Networks ({wifiNetworks.length}) - {wifiNetworks.map((net, idx) => ( - - - {net.ssid} {net.isConnected ? "(Connected)" : ""} - 4Text style={styles.itemSub}>BSSID: {net.bssid} | {net.security} - - {net.rssi} dBm - - ))} - - Wi-Fi Networks ({wifiNetworks.length}) {wifiNetworks.map((net, idx) => ( diff --git "a/app/\357\277\274/vulnerability-scanner-screen-v3.tsx" "b/app/\357\277\274/vulnerability-scanner-screen-v3.tsx" index 8c2966f..b6cd236 100644 --- "a/app/\357\277\274/vulnerability-scanner-screen-v3.tsx" +++ "b/app/\357\277\274/vulnerability-scanner-screen-v3.tsx" @@ -103,7 +103,7 @@ export default function VulnerabilityScannerScreenV3() { {/* Header */} - Live Host Uulnerability Scanner v2 + Live Host Vulnerability Scanner v2 Offline Multi-Gate CVE Correlation & Firmware Risk Engine @@ -127,8 +127,7 @@ export default function VulnerabilityScannerScreenV3() { {/* Device Telemetry Snapshot */} - Collecte -‰eyË^t Host Telemetry + Collected Host Telemetry Device ID: @@ -183,10 +182,10 @@ export default function VulnerabilityScannerScreenV3() { > {report.overallRiskScore.toFixed(1)} / 10.0 - pText style={styles.scoreLabel}>CVSS v3.1 Composite Risk Score + CVSS v3.1 Composite Risk Score - + {report.summary.criticalCount} Critical @@ -258,4 +257,78 @@ export default function VulnerabilityScannerScreenV3() { Automated Remediation Playbook: - {item.signature.remediationAction&jÚâ \ No newline at end of file + {item.signature.remediationAction} + + + + )) + )} + + + )} + + ); +} + +const styles = StyleSheet.create({ + container: { flex: 1, backgroundColor: "#0A0E17" }, + content: { padding: 16 }, + header: { marginBottom: 16 }, + title: { fontSize: 20, fontWeight: "bold", color: "#F8FAFC" }, + subtitle: { fontSize: 13, color: "#94A3B8", marginTop: 2 }, + card: { + backgroundColor: "#1E293B", + borderRadius: 12, + padding: 16, + marginBottom: 16, + borderWidth: 1, + borderColor: "#334155", + }, + cardTitle: { fontSize: 16, fontWeight: "600", color: "#38BDF8", marginBottom: 12 }, + primaryButton: { + backgroundColor: "#0284C7", + paddingVertical: 12, + borderRadius: 8, + alignItems: "center", + }, + buttonText: { color: "#FFFFFF", fontWeight: "600", fontSize: 14 }, + metaGrid: { flexDirection: "row", flexWrap: "wrap", justifyContent: "space-between" }, + metaItem: { width: "48%", marginBottom: 10 }, + metaLabel: { fontSize: 12, color: "#64748B" }, + metaValue: { fontSize: 13, fontWeight: "600", color: "#F1F5F9", marginTop: 2 }, + metaValueSmall: { fontSize: 11, fontWeight: "500", color: "#CBD5E1", marginTop: 2 }, + scoreContainer: { alignItems: "center", marginVertical: 12 }, + scoreValue: { fontSize: 32, fontWeight: "bold" }, + scoreLabel: { fontSize: 12, color: "#94A3B8", marginTop: 2 }, + summaryBadgeRow: { flexDirection: "row", justifyContent: "space-around", marginTop: 8 }, + badge: { paddingHorizontal: 10, paddingVertical: 4, borderRadius: 16, borderWidth: 1 }, + badgeText: { fontSize: 12, fontWeight: "bold" }, + cleanStateText: { color: "#10B981", fontSize: 14, fontWeight: "500", textAlign: "center", marginVertical: 12 }, + cveCard: { + backgroundColor: "#0F172A", + borderRadius: 8, + padding: 12, + marginBottom: 12, + borderLeftWidth: 4, + borderLeftColor: "#38BDF8", + }, + cveHeader: { flexDirection: "row", justifyContent: "space-between", alignItems: "center" }, + cveId: { fontSize: 14, fontWeight: "bold", color: "#38BDF8" }, + badgeGroup: { flexDirection: "row", gap: 6 }, + miniBadge: { paddingHorizontal: 6, paddingVertical: 2, borderRadius: 4 }, + miniBadgeText: { color: "#FFFFFF", fontSize: 10, fontWeight: "bold" }, + cveTitle: { fontSize: 13, fontWeight: "600", color: "#F8FAFC", marginTop: 6 }, + cveDesc: { fontSize: 12, color: "#94A3B8", marginTop: 4 }, + sectionHeader: { fontSize: 12, fontWeight: "600", color: "#CBD5E1", marginTop: 8 }, + reasonText: { fontSize: 11, color: "#94A3B8", marginLeft: 4, marginTop: 2 }, + remediationBox: { + backgroundColor: "#1E293B", + borderRadius: 6, + padding: 8, + marginTop: 10, + borderWidth: 1, + borderColor: "#334155", + }, + remediationHeader: { fontSize: 11, fontWeight: "bold", color: "#38BDF8" }, + remediationText: { fontSize: 11, color: "#E2E8F0", marginTop: 2 }, +}); diff --git a/modules/droid-commander-usb-host/android/src/main/java/com/droidcommander/usb/DroidCommanderUsbHostModule.kt b/modules/droid-commander-usb-host/android/src/main/java/com/droidcommander/usb/DroidCommanderUsbHostModule.kt index ad95bfc..5652fd6 100644 --- a/modules/droid-commander-usb-host/android/src/main/java/com/droidcommander/usb/DroidCommanderUsbHostModule.kt +++ b/modules/droid-commander-usb-host/android/src/main/java/com/droidcommander/usb/DroidCommanderUsbHostModule.kt @@ -4,6 +4,7 @@ import android.content.Intent import android.os.Build import android.provider.Settings import android.util.Base64 +import java.util.zip.CRC32 import expo.modules.kotlin.modules.Module import expo.modules.kotlin.modules.ModuleDefinition @@ -155,5 +156,4 @@ class DroidCommanderUsbHostModule : Module() { } } -import java.util.zip.CRC32 // FAIL_CLOSED ENFORCE_EXECUTION_GATES diff --git a/privileged-action-ledger-schema.ts b/privileged-action-ledger-schema.ts index d0162ad..4fc50d3 100644 --- a/privileged-action-ledger-schema.ts +++ b/privileged-action-ledger-schema.ts @@ -167,7 +167,4 @@ CREATE TABLE IF NOT EXISTS \`used_nonces\` ( ); `; -export class PrivilegedActionLedger { - static recordAction(...args: any[]): any { return {}; } - static record(...args: any[]): any { return {}; } -} + diff --git a/tsconfig.json b/tsconfig.json index b2925da..9961d11 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,11 @@ "skipLibCheck": true, "noImplicitAny": false, "strict": false, - "esModuleInterop": true + "esModuleInterop": true, + "baseUrl": ".", + "paths": { + "@/*": ["./*"] + } }, "include": [ "/*.ts", @@ -18,4 +22,4 @@ "**/*.jsx", "global.d.ts" ] -} \ No newline at end of file +}