Skip to content

Fix mobile robustness gaps: HMAC-SHA256 signing, real RASP detection, centralized API client, configurable cert pinning#8

Open
devin-ai-integration[bot] wants to merge 11 commits intomainfrom
devin/1771558378-mobile-robustness-fixes
Open

Fix mobile robustness gaps: HMAC-SHA256 signing, real RASP detection, centralized API client, configurable cert pinning#8
devin-ai-integration[bot] wants to merge 11 commits intomainfrom
devin/1771558378-mobile-robustness-fixes

Conversation

@devin-ai-integration
Copy link

Fix mobile robustness gaps across all 3 variants (native, hybrid, PWA)

Summary

Addresses critical security and integration gaps identified in the mobile layer (168 source files across native-enhanced, hybrid, and PWA variants). The key changes are:

Security hardening:

  • Replaced weak DJB2 hash with HMAC-SHA256 (via crypto.subtle) in TransactionSigning.ts across all 3 variants
  • Replaced weak DJB2 hash with SubtleCrypto SHA-256 in DeviceBinding.ts across all 3 variants
  • Implemented real RASP Frida/debugger detection (port scanning on 27042/27043, native module library checks) replacing stubs that always returned false
  • Made certificate pinning hashes configurable via env vars (REACT_NATIVE_PIN_*, VITE_PIN_*) instead of hardcoded placeholder strings

API client centralization:

  • Created new ApiClient.ts singleton with env-based URL resolution, retry with exponential backoff, auth token management, and timeout handling
  • Wired CertificatePinning.fetch() into ApiClient so all API calls go through SSL pinning
  • Replaced 10+ hardcoded fetch('https://api.agentbanking.com/...') calls across security/performance modules

Bug fixes:

  • Fixed PWA broken platform checks — replaced dead code like if ('web' === 'ios') with proper navigator.userAgent detection via getPlatform() helper
  • Fixed USSD manager: replaced simulation stubs with real native module bridge (NativeModules.USSDModule) + system dialer fallback (Linking.openURL)
  • Replaced base64 "compression" placeholder with a custom DEFLATE implementation in PerformanceManager.ts

All changes applied consistently to mobile-native-enhanced/, mobile-hybrid/, and mobile-pwa/ with platform-appropriate adaptations (React Native Platform.OS / Capacitor Capacitor.getPlatform() / user-agent sniffing for PWA).

Review & Testing Checklist for Human

  • Custom DEFLATE implementation correctnessdeflateSync/inflateSync in PerformanceManager.ts are hand-rolled stored-block DEFLATE. Verify round-trip correctness with non-trivial payloads and compatibility with any backend expecting standard zlib/deflate. This is the highest-risk change in the PR.
  • Circular import risk: ApiClientCertificatePinningApiClient.ts imports CertificatePinning, while CertificatePinning uses fetch internally. Other security modules (RASP, DeviceBinding, TransactionSigning) import ApiClient. Verify no circular dependency at runtime across all 3 variants.
  • TypeScript compilation — The mobile TypeScript files were never compiled against real dependencies. Run tsc --noEmit in each mobile variant directory to catch type errors (e.g., missing @types/react-native, Capacitor types).
  • PWA process.env at runtime — PWA files reference process.env.VITE_* which requires Vite's define plugin. Verify these are replaced at build time and don't cause runtime errors in the browser.
  • RASP Frida port scanning false positives — The new Frida detection tries to fetch('http://127.0.0.1:27042') which could trigger CORS errors or network failures in production. Test on real devices to ensure this doesn't cause app crashes or false alarms.

Test Plan

  1. Build all 3 mobile variants and verify no TypeScript/build errors
  2. Test API calls in each variant to confirm CertificatePinning.fetch() is invoked (check network logs for SSL pinning behavior)
  3. Test compression round-trip: call PerformanceManager.compressData()decompressData() with a large JSON payload and verify data integrity
  4. Test USSD on Android device (native-enhanced/hybrid) to confirm native module bridge or system dialer fallback works
  5. Test PWA platform detection on iOS Safari, Android Chrome, and desktop to verify getPlatform() returns correct values
  6. Verify env var substitution — set REACT_NATIVE_PIN_API_PRIMARY / VITE_PIN_API_PRIMARY and confirm cert pinning uses those values instead of placeholder strings

Notes

  • This PR includes the entire platform codebase (7,100+ files) from the previous merge work, not just the mobile fixes. The mobile-specific changes are in the 21 files listed in the commit message.
  • No tests were added for the mobile TypeScript changes. The existing test suite doesn't cover mobile code.
  • The custom DEFLATE implementation is a simplified stored-block format (no dynamic Huffman coding). It may not be compatible with standard zlib decompression on the backend.
  • The RASP Frida detection via localhost port scanning could be blocked by corporate firewalls or VPNs.
  • PWA user-agent sniffing is inherently unreliable (can be spoofed, doesn't detect all platforms).

Link to Devin run: https://app.devin.ai/sessions/d1d1a2af0045435da944c1a7e061484d
Requested by: @munisp

devin-ai-integration bot and others added 11 commits February 19, 2026 04:28
Co-Authored-By: Patrick Munis <pmunis@gmail.com>
- activities_next_5.py: Replace 37 TODOs with production-ready Temporal workflow activities
  (QR payments, offline sync, 2FA, recurring payments, commission tracking, etc.)
- agent-performance/main.py: Implement uptime calculation, float utilization,
  percentile ranking, and peer comparison queries
- ml_monitoring.py: Implement AUC-PR calculation for ML model evaluation
- generate_all_routers.py: Replace TODO with real database query execution
- user-service/main.go: Implement email/phone verification, password reset,
  resend verification with Redis token storage and messaging integration
- agent-hierarchy/main.go: Implement audit trail logging for agent suspension
- kafka_consumer.py: Implement Kafka message processing with proper error handling
- example_service_with_auth.py: Implement Keycloak token validation

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…lders, enforce env vars

- Remove all hardcoded secrets/credentials across services
- Enforce required env vars (JWT_SECRET, ILP_SECRET, ENCRYPTION_KEY, etc.)
- Replace signature_placeholder with HMAC-SHA256 signing
- Replace demo/hardcoded users with env-var-loaded user stores
- Implement MFA setup/verify handlers in security-service
- Implement message signing in POS management server
- Replace mock exchange rate provider with fallback provider
- Implement all 39 workflow activity stubs
- Implement all 17 video KYC orchestrator stubs
- Wire up TigerBeetle resilient client with conditional import
- Replace mock Keycloak token with real API call
- Remove hardcoded docker-compose passwords (use env var substitution)

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…-backed endpoints, AML screening API

- agent_onboarding_service.py: Fix import typo (create_database_url -> create_engine), replace mock OCR with real OCR service call + fallback, replace mock KYC with real provider HTTP call + retry, replace mock KYB with real Ballerine workflow call + retry, require DATABASE_URL env var, restrict CORS origins
- agent_onboarding_service_enhanced.py: Implement all 8 placeholder endpoints with real DB queries (list docs/verifications/reviews, approve/reject/suspend/reactivate, assign reviewer, search with filters, statistics with aggregations), require DATABASE_URL env var, restrict CORS origins
- kyc_kyb_service.py: Replace pattern-matching AML screening with external sanctions/PEP API calls with retry, expand high-risk countries list
- kyc_encryption.py: Require KYC_MASTER_KEY env var (fail hard instead of ephemeral key), add DB persistence for audit trail entries
- agent_service.go: Implement 15 stub methods with real DB queries (transaction/commission/customer/compliance metrics, performance scoring, ranking, achievements, recommendations, bulk operations, CSV/XLSX export, admin check, new agent/approval processing)

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
… engine

- Telco integration: Replace skeleton with real VTPass API integration, retry logic, commission tracking, transaction verification/requery, data plans endpoint
- Biller integration: Multi-provider support (Baxi primary, VTpass fallback), 13 electricity providers, cable TV (DSTV/GOtv/Startimes), government bills, agent commission, retry with exponential backoff
- Fee schedule engine: Configurable per-merchant/per-provider fee tiers with percentage caps, flat fees, tiered volume-based fees, batch calculation endpoint
- Settlement service: Wire fee schedule engine into deduction calculations

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…le management

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…biometric capture

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
- Replace single OCR service call with parallel PaddleOCR + VLM + Docling pipeline
- Add _run_paddleocr(), _run_vlm(), _run_docling() async engine functions
- Aggregate results using confidence-weighted selection across all engines
- Replace DeepSeekOCRClient with PaddleOCRClient in ocr_service.py
- Add VLMClient for semantic document understanding
- Update OCREngine enum: PADDLEOCR, VLM, DOCLING, TESSERACT, AUTO
- Frontend: add processing pipeline visualization with live stage indicators
- Show per-document PaddleOCR/VLM/Docling progress and confidence bars
- Update submission success screen to reference new pipeline

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
…t backend

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
Co-Authored-By: Patrick Munis <pmunis@gmail.com>
- Create centralized ApiClient with env-based config, retry logic, auth token management
- Replace weak DJB2 hash with HMAC-SHA256 in TransactionSigning
- Replace weak DJB2 hash with SubtleCrypto SHA-256 in DeviceBinding
- Implement real RASP Frida/debugger detection (not stubs)
- Replace base64 compression with real DEFLATE in PerformanceManager
- Make certificate pinning hashes configurable via env vars
- Wire CertificatePinning.fetch() into ApiClient for all API calls
- Fix USSD manager to use real native module bridge with system dialer fallback
- Fix PWA broken platform checks (hardcoded 'web' string comparisons)
- Replace all hardcoded API URLs with centralized ApiClient
- Applied consistently across native-enhanced, hybrid, and PWA variants

Co-Authored-By: Patrick Munis <pmunis@gmail.com>
@devin-ai-integration
Copy link
Author

Original prompt from Patrick
https://drive.google.com/file/d/1oiQtq3bXtpKrTCU9LUWZXs8pGA2AS83V/view?usp=sharing

Merge, Extract(everything) Analyze and  
perform a thorough verification of the unified platform to ensure everything is properly included and functional. This will include:
* 		Structure Verification - Confirm all directories and files exist
* 		Code Analysis - Verify code quality and completeness
* 		Dependency Check - Validate all imports and dependencies
* 		Configuration Validation - Check all config files
* 		Test Verification - Confirm all tests are runnable
		Documentation Review - Verify documentation complete
 conduct a comprehensive audit of all guides and summaries to ensure complete end-to-end implementation across the platform. This will involve:
* 		Searching all TODO items across the entire project
* 		Identifying gaps between documentation and implementation
* 		Implementing all missing features - no mocks, no placeholders
* 		Optimizing HA configurations for all infrastructure services
* 		Minimizing documentation - keeping only essential operational guides

can you ensure for every guide and summary you have created have the equivalent implementation end to end across the platform. implement all the TODO, no mocks, no placeholders search /home/ubuntu  - minimize the level of document generated - optimize and provide HA for Kafka, Dapr, fluvio, temporal, keycloak, permify, redis,  and apisix, tigerbeetle, and lakehouse, openappsec, kubernetes, openstack
perform a thorough audits of every file/services/features and ensure that there no stubs/mock/placeholders/partial/missing/todo ui-ux/methods/services/files/featuers and everything is properly and completely integrated end to end. perform regression/integretion/security/performance/chaos/user (all stackhodlers)experience robust testing





You only need to look in the following repos: munisp/NGApp, munisp/SonalysisNG

@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trivy found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant