Skip to content

fix(mobile): validate WalletConnect request id and topic in parseSignAuthEntryRequest (Fixes #1173) - #1203

Open
namdamdoi68-oss wants to merge 1 commit into
ancore-org:mainfrom
namdamdoi68-oss:fix/issue-1173-wc-id-topic-validation
Open

fix(mobile): validate WalletConnect request id and topic in parseSignAuthEntryRequest (Fixes #1173)#1203
namdamdoi68-oss wants to merge 1 commit into
ancore-org:mainfrom
namdamdoi68-oss:fix/issue-1173-wc-id-topic-validation

Conversation

@namdamdoi68-oss

@namdamdoi68-oss namdamdoi68-oss commented Aug 1, 2026

Copy link
Copy Markdown

Validates that event.id is a finite number and event.topic is a non-empty string in parseSignAuthEntryRequest before XDR parsing. Fixes #1173.

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation of WalletConnect authorization requests.
    • Invalid or incomplete request IDs, topics, sessions, and authorization entries are now rejected with clear errors.
    • Numeric request IDs provided as strings and topics with surrounding whitespace are handled correctly.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@namdamdoi68-oss, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0366a4ef-5ca2-4b3a-b405-c36e7a165389

📥 Commits

Reviewing files that changed from the base of the PR and between 1069675 and 08378c9.

📒 Files selected for processing (2)
  • apps/mobile-wallet/src/components/SignAuthEntryApprovalSheet.tsx
  • apps/mobile-wallet/src/components/__tests__/SignAuthEntryApprovalSheet.test.tsx
📝 Walkthrough

Walkthrough

parseSignAuthEntryRequest now validates WalletConnect request IDs, topics, and sessions before parsing auth-entry data. Tests cover normalization and invalid request data.

Changes

WalletConnect request validation

Layer / File(s) Summary
Parser validation and coverage
apps/mobile-wallet/src/components/SignAuthEntryApprovalSheet.tsx, apps/mobile-wallet/src/components/__tests__/SignAuthEntryApprovalSheet.test.tsx
The parser validates safe request IDs, non-blank topics, and object sessions. Tests cover normalized fields, invalid IDs, blank topics, missing authEntry, and missing sessions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies validation of the mobile WalletConnect request ID and topic.
Linked Issues check ✅ Passed The changes satisfy issue [#1173] by validating request IDs and topics and adding tests for invalid input before XDR parsing.
Out of Scope Changes check ✅ Passed The implementation and tests remain within the WalletConnect request validation scope described in issue [#1173].
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/mobile-wallet/src/components/SignAuthEntryApprovalSheet.tsx`:
- Around line 66-77: Update the request-ID validation around rawId in
SignAuthEntryApprovalSheet so only numeric values and non-blank, trimmed strings
are coerced before parsing; reject whitespace-only strings and non-scalar values
such as arrays instead of allowing them to become 0. Preserve rejection of
booleans, missing values, NaN, and infinities, and add coverage for '   ' and
[].
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 43327b04-bcb2-4912-8389-a5a452344c54

📥 Commits

Reviewing files that changed from the base of the PR and between 4f8d69c and 2b00c86.

📒 Files selected for processing (2)
  • apps/mobile-wallet/src/components/SignAuthEntryApprovalSheet.tsx
  • apps/mobile-wallet/src/components/__tests__/SignAuthEntryApprovalSheet.test.tsx

Comment thread apps/mobile-wallet/src/components/SignAuthEntryApprovalSheet.tsx Outdated
@namdamdoi68-oss
namdamdoi68-oss force-pushed the fix/issue-1173-wc-id-topic-validation branch 2 times, most recently from d8781af to 1069675 Compare August 2, 2026 20:53

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/mobile-wallet/src/components/SignAuthEntryApprovalSheet.tsx`:
- Around line 93-96: Strengthen the validation in the session-handling flow
around the existing event.session check before casting to SessionTypes.Struct.
Replace the object-only guard with a WalletConnect session shape predicate or
schema validation that rejects arrays and incomplete objects such as [] and {},
while accepting valid sessions; add coverage for these malformed values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 775012bb-055a-473d-b0eb-3dd7ebde6872

📥 Commits

Reviewing files that changed from the base of the PR and between 2b00c86 and 1069675.

📒 Files selected for processing (2)
  • apps/mobile-wallet/src/components/SignAuthEntryApprovalSheet.tsx
  • apps/mobile-wallet/src/components/__tests__/SignAuthEntryApprovalSheet.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/mobile-wallet/src/components/tests/SignAuthEntryApprovalSheet.test.tsx

Comment thread apps/mobile-wallet/src/components/SignAuthEntryApprovalSheet.tsx Outdated
…parseSignAuthEntryRequest

Signed-off-by: namdamdoi68-oss <namdamdoi68@gmail.com>
@namdamdoi68-oss
namdamdoi68-oss force-pushed the fix/issue-1173-wc-id-topic-validation branch from 1069675 to 08378c9 Compare August 2, 2026 21:05
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.

[MOBILE] parseSignAuthEntryRequest does not validate WalletConnect request id/topic (Number(event.id) can be NaN)

1 participant