Skip to content

fix(caip): add input validation to createCaip10AccountId#67

Open
ak68a wants to merge 1 commit intoagentcommercekit:mainfrom
ak68a:fix/caip10-validation
Open

fix(caip): add input validation to createCaip10AccountId#67
ak68a wants to merge 1 commit intoagentcommercekit:mainfrom
ak68a:fix/caip10-validation

Conversation

@ak68a
Copy link

@ak68a ak68a commented Mar 25, 2026

Summary

  • Validate chainId against caip2ChainIdRegex and address against caip10AccountAddressRegex before creating the account ID
  • Add test cases for invalid inputs

createCaip10AccountId previously performed no validation, allowing malformed chain IDs and addresses to propagate silently. The regex patterns were already defined in the module but not being used. This brings the function in line with caip10Parts(), which already validates its input.

Test plan

  • Existing CAIP tests pass
  • New tests verify rejection of invalid chain IDs and addresses

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 25, 2026

Warning

Rate limit exceeded

@ak68a has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 29 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ff85e688-7f62-43d1-8f07-45474d9a57be

📥 Commits

Reviewing files that changed from the base of the PR and between f0e8c6c and d370f60.

📒 Files selected for processing (2)
  • packages/caip/src/caips/caip-10.test.ts
  • packages/caip/src/caips/caip-10.ts
✨ 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 and usage tips.

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.

1 participant