Skip to content

Tighten native/Kotlin command validation for exact keyword:value syntax - #40

Merged
XRDOGE-XRPL merged 1 commit into
mainfrom
copilot/update-android-dependencies
Sep 18, 2026
Merged

XRDOGE-XRPL merged 1 commit into
mainfrom
copilot/update-android-dependencies

Conversation

Copilot AI commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

The command validation path allowed malformed keyword :value forms to pass through as valid commands, which could confuse the native state machine and break the expected transport contract. The parser was accepting whitespace before the separator even when the normalized form still looked valid, so the raw command syntax needed to be enforced exactly.

  • Summary

    • Enforce exact keyword:value syntax for native commands, including the transport command contract.
    • Preserve the existing accepted command set while rejecting malformed forms with whitespace before :.
    • Keep Kotlin and native validation aligned so both layers reject the same invalid input.
  • What changed

    • In the Kotlin bridge, command parsing now validates the raw keyword segment before normalization and rejects any whitespace in the prefix (transport :udp is invalid even if normalized text looks acceptable).
    • In the native ClientState parser, the same raw-prefix check is enforced before accepting a command value.
    • Regression coverage was added for malformed transport commands to prevent reintroducing the same edge case.
  • Example

    requireValidNativeCommand("transport :udp") // throws IllegalArgumentException
    requireValidNativeCommand("transport:udp")   // accepted
    requireValidNativeCommand("Transport:udp")   // accepted
  • Impact

    • Commands now match the documented contract: transport:<value>, connect:<server>, player:<name>, etc. must use exact keyword syntax without whitespace before the separator.
    • This closes the parsing ambiguity at the boundary, preventing inconsistent behavior between the JVM and native layers.

Co-authored-by: XRDOGE-XRPL <166251416+XRDOGE-XRPL@users.noreply.github.com>
@XRDOGE-XRPL
XRDOGE-XRPL marked this pull request as ready for review September 18, 2026 09:28
@XRDOGE-XRPL
XRDOGE-XRPL merged commit 74292d0 into main Sep 18, 2026
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.

2 participants