Repository navigation
Description
PastaClaw flagged this while reviewing #6242, where it was deferred to a follow-up instead of being fixed in that pull request. This issue tracks the follow-up.
String rejection errors lose the field name or the decoding reason (suggestion)
Impact: A Kotlin developer diagnosing rejected query text, token inputs, funding arguments, or persisted fields can get an error that does not identify the failing value or why it was rejected.
Where: packages/rs-unified-sdk-jni/src/queries.rs:58-78 at ecf7f4de5437:
platform/packages/rs-unified-sdk-jni/src/queries.rs
Lines 58 to 78 in ecf7f4d
| fn opt_c_string(env: &mut JNIEnv, value: &JString) -> Result<Option<CString>, ()> { | |
| if value.is_null() { | |
| return Ok(None); | |
| } | |
| let s = match crate::support::read_jstring(env, value) { | |
| Ok(s) => s, | |
| Err(e) => { | |
| let _ = env.exception_clear(); | |
| crate::support::throw_sdk_exception(env, 1, &format!("string argument {e}")); | |
| return Err(()); | |
| } | |
| }; | |
| match CString::new(s) { | |
| Ok(c) => Ok(Some(c)), | |
| Err(_) => { | |
| crate::support::throw_sdk_exception( | |
| env, | |
| 1, | |
| "string argument contained an interior NUL", | |
| ); | |
| Err(()) |
The new rejections stop the operation, but several adapters discard information needed to fix the input.
queries.rsandtokens.rsreportstring argumenteven for calls with multiple text inputs;funding.rsnames the field but drops theJStringErrorreason. The persistence field readers know the field name, butwith_bridge_loadturns the propagated decoder error into a generic callback failure. Carry the field and decoder reason into the argument error or restore diagnostic without logging the string itself.
Origin
- Pull request: fix(kotlin-sdk): reject malformed UTF-16 string arguments at the JNI boundary #6242
- Review thread: fix(kotlin-sdk): reject malformed UTF-16 string arguments at the JNI boundary #6242 (comment)
- Filed by PastaClaw when it accepted the deferral, as nothing else tracked it.
Activity