Skip to content

test(SorobanPanel): cover non-array JSON args validation (#118 upgrade) - #141

Merged
k-deejah merged 2 commits into
Sorokit:mainfrom
KayProject:test/sorobanpanel-array-validation
Jun 28, 2026
Merged

test(SorobanPanel): cover non-array JSON args validation (#118 upgrade)#141
k-deejah merged 2 commits into
Sorokit:mainfrom
KayProject:test/sorobanpanel-array-validation

Conversation

@KayProject

Copy link
Copy Markdown
Contributor

Context

All three validation fixes from issue #118 are already implemented on main:

  • TransactionPanel enforces amount >= 0.0000001 (Send disabled + error below threshold) — tested
  • TransactionPanel shows a self-payment warning without blocking submit — tested (asserts the button stays enabled)
  • SorobanPanel rejects non-array JSON args (!Array.isArray(parsed)Arguments must be a JSON array)

The SorobanPanel non-array guard — the actual security fix preventing a non-array reaching invokeContract — had no test. The existing SorobanPanel test only covered malformed JSON syntax (invalid json {), not valid-but-non-array JSON. This PR closes that gap.

Tests added

  • a JSON object {} is rejected with Arguments must be a JSON array
  • a JSON number 42 is rejected with the same error
  • a valid JSON array ["arg1", 42] passes validation and reaches the success state (no validation error)

Verification

  • npm test (SorobanPanel): 5 passed.
  • npm run lint: clean.
  • npm run build: unaffected by this test-only change; note tsc -b has a pre-existing, unrelated TS1484 error in src/verify-exports.ts on main.

Closes #118

Issue Sorokit#118's SorobanPanel guard rejects valid JSON that is not an array
(e.g. {} or 42) so a non-array is never forwarded to invokeContract. The
existing test only covered malformed JSON syntax, leaving the non-array
case — the actual security fix — untested.

Add tests asserting:
- a JSON object {} is rejected with 'Arguments must be a JSON array'
- a JSON number 42 is rejected with the same error
- a valid JSON array passes validation and reaches the success state

SorobanPanel: 5 tests passing. Lint clean.

Closes Sorokit#118
…rray-validation

# Conflicts:
#	src/components/SorobanPanel.test.tsx
@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@KayProject Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@k-deejah
k-deejah merged commit e394ba6 into Sorokit:main Jun 28, 2026
2 of 4 checks passed
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.

fix(security): TransactionPanel amount minimum not JS-enforced, SorobanPanel non-array args not validated, self-payment not warned

2 participants