Skip to content

Reject duplicate Web App data keys - #4

Open
KnightNiwrem wants to merge 2 commits into
claude/ci-setup-mamr2pfrom
fix/reject-duplicate-init-data-keys
Open

Reject duplicate Web App data keys#4
KnightNiwrem wants to merge 2 commits into
claude/ci-setup-mamr2pfrom
fix/reject-duplicate-init-data-keys

Conversation

@KnightNiwrem

@KnightNiwremKnightNiwrem commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • reject duplicate URLSearchParams keys before token-based HMAC validation
  • apply the same fail-fast check before third-party Ed25519 verification
  • cover repeated signed fields, hash, and signature in regression tests

Testing

  • formatting and lint checks pass
  • source type-check passes
  • 25 tests pass

Summary by cubic

Reject duplicate Web App data keys before HMAC or Ed25519 verification to prevent ambiguous parsing and signature bypass via repeated parameters. Previously duplicates were accepted with the last value used; now any duplicate key causes validation to return false.

  • Applies to both validateWebAppData and validateWebAppDataThirdParty; covers duplicates in signed fields and meta fields (query_id, chat_type, hash, signature).
  • Introduces a fail-fast hasDuplicateKeys helper for simpler, centralized detection; public API and return values are unchanged.
  • Adds regression tests for both paths to assert rejection of duplicates.

Migration

  • Ensure Web App init data has unique keys. Do not send repeated hash, signature, or any other duplicate parameters.

Written for commit daf0a42. Summary will update on new commits.

Review in cubic

@coderabbitai

coderabbitaiBot commented Aug 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: da865d7c-0e6a-459f-81df-f1c59fd92c97

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@KnightNiwrem
KnightNiwrem marked this pull request as ready for review August 22, 2026 12:18

@cubic-dev-aicubic-dev-aiBot 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.

No issues found across 2 files

Re-trigger cubic

Sign up for freeto 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

@KnightNiwrem