Skip to content

fix(sdk): validate journey payloads without interrupting verification - #297

Merged
e271828- merged 3 commits into
mainfrom
fix/journey-serialization
Nov 3, 2026
Merged

e271828- merged 3 commits into
mainfrom
fix/journey-serialization

Conversation

@e271828-

@e271828- e271828- commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Native JSON journey containers bypassed validation, allowing cycles to overflow the stack and non-finite numbers to discard the full parameter update. Primitive byte/character arrays also changed their Jackson payloads.

Recursively validate native containers and preserve byte/character-array encodings. If journey serialization fails, omit only userjourney, preserve valid MFA/rqdata, and continue verification. Emit a payload-free warning through Android Log.w so it remains visible in release builds. Do not invoke failure callbacks or change retry/lifecycle behavior for an optional journey omission. Skip setData when no valid parameters remain.

Document migration of manual POJO/enum/UUID values. Keep these fixes under the unreleased 5.2.0 version. Follow-up to #290.

Validation:

  • Full repository ./gradlew check passes (pre-commit hook).
  • 305 SDK unit tests pass in each debug/release variant, including graceful fallback across render modes, loaded states, and visible/invisible flows.
  • 20 Android 13 device tests pass; one existing test is skipped. Real WebViews confirm valid MFA/rqdata delivery, omitted bad journeys, and continued execution, including journey-only requests.
  • Checkstyle, PMD, and release lint pass.
  • Five additional array compatibility fixtures were generated with Jackson 2.13.5.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Diffuse report:

OLD: sdk-main.aar
NEW: sdk-pr.aar

 AAR      │ old       │ new       │ diff   
──────────┼───────────┼───────────┼────────
      jar │ 102.5 KiB │   103 KiB │ +498 B 
 manifest │     411 B │     411 B │    0 B 
      res │  28.3 KiB │  28.3 KiB │    0 B 
    other │     765 B │     765 B │    0 B 
──────────┼───────────┼───────────┼────────
    total │   132 KiB │ 132.5 KiB │ +498 B 

 JAR     │ old │ new │ diff       
─────────┼─────┼─────┼────────────
 classes │  63 │  63 │  0 (+0 -0) 
 methods │ 877 │ 883 │ +6 (+6 -0) 
  fields │ 293 │ 293 │  0 (+0 -0)
AAR
 size    │ diff   │ path          
─────────┼────────┼───────────────
 103 KiB │ +498 B │ ∆ classes.jar 
─────────┼────────┼───────────────
 103 KiB │ +498 B │ (total)
JAR
METHODS:

   old │ new │ diff       
  ─────┼─────┼────────────
   877 │ 883 │ +6 (+6 -0) 
  
  + android.util.Base64 encodeToString(byte[], int) → String
  + java.lang.String <init>(char[])
  + org.json.JSONArray length() → int
  + org.json.JSONArray opt(int) → Object
  + org.json.JSONObject get(String) → Object
  + org.json.JSONObject keys() → Iterator

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Benchmark report:

Test name Time ms. (median) Allocations (median)
com.hcaptcha.sdk.HCaptchaBenchmarkTest.EMULATOR_UNLOCKED_benchmarkInvisibleVerification +730.78 +35
com.hcaptcha.sdk.HCaptchaBenchmarkTest.EMULATOR_UNLOCKED_benchmarkInvisibleVerificationColdRun +817.79 -2792
com.hcaptcha.sdk.HCaptchaBenchmarkTest.EMULATOR_UNLOCKED_benchmarkInvisibleSetup +3.85 -2837
com.hcaptcha.sdk.HCaptchaDebugInfoTest.EMULATOR_UNLOCKED_benchmarkDebugInfo +14.28 -6482
com.hcaptcha.sdk.HCaptchaDebugInfoTest.EMULATOR_UNLOCKED_benchmarkDebugSys +43.83 +39

@e271828-
e271828- merged commit b06037e into main Nov 3, 2026
13 checks passed
@e271828-
e271828- deleted the fix/journey-serialization branch November 3, 2026 18:56
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