Skip to content

fix(scripts): prevent parseArg from truncating argument values with colons (Fixes #861) - #885

Closed
kleitonbernardino-lab wants to merge 1 commit into
MergeFi:mainfrom
kleitonbernardino-lab:fix/invoke-parsearg-colon-861
Closed

kleitonbernardino-lab wants to merge 1 commit into
MergeFi:mainfrom
kleitonbernardino-lab:fix/invoke-parsearg-colon-861

Conversation

@kleitonbernardino-lab

Copy link
Copy Markdown

Fixes #861

Summary

Prevent parseArg in scripts/invoke.mjs from silently truncating argument values containing colons, and reject arguments without a colon separator.

Root Cause

parseArg previously destructured the result of raw.split(":") into [type, value]. Because String.prototype.split(":") without a limit produces an array of all segments, destructuring only took the first two segments and silently dropped everything after the second colon. Any value with colons (such as timestamps, symbols, or nested payload formats) was silently truncated, while an argument missing a colon left value as undefined.

Changes

  • Replaced raw.split(":") with raw.indexOf(":") to slice only at the first delimiter, keeping the rest of the string as value.
  • Threw a clear descriptive error when no colon delimiter is present.
  • Updated scripts/invoke.test.mjs:
    • Fixed pre-existing test fixtures using invalid address checksum and .bool() method.
    • Added unit test asserting rejection when input lacks a colon delimiter.
    • Added unit test verifying that arguments with colons in the value portion are preserved rather than truncated.

Verification

Ran test suite:

npm test

Result: 29 passed, 0 failed, 10 suites (100% pass).

…olons (Fixes MergeFi#861)

Signed-off-by: Kleiton Bernardino <kleiton.bernardino@gmail.com>
@vercel

vercel Bot commented Nov 11, 2026

Copy link
Copy Markdown

@kleitonbernardino-lab is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

@chonilius chonilius closed this Nov 12, 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.

scripts/invoke.mjs's parseArg splits on ':' and keeps only the first two segments, silently truncating any value containing a colon

2 participants