Skip to content

Feature/474 validation sot - #539

Merged
AbuJulaybeeb merged 8 commits into
Stellar-Search:mainfrom
ajulaybeeb:feature/474-validation-sot
Aug 28, 2026
Merged

Feature/474 validation sot#539
AbuJulaybeeb merged 8 commits into
Stellar-Search:mainfrom
ajulaybeeb:feature/474-validation-sot

Conversation

@ajulaybeeb

Copy link
Copy Markdown

📌 Overview

Resolves #474 (Validation Source of Truth).

This PR entirely eliminates scattered, hand-rolled string-matching regexes (/^G[A-Z0-9]{55}$/ and /^G[A-Z2-7]{55}$/) used to validate Stellar addresses across the stack, replacing them with a single Source of Truth powered by @stellar/stellar-sdk's StrKey implementation.

🔍 Technical Approach

  1. Source of Truth (shared/): Added validation.json and a universal JS adapter (stellarValidator.js) that performs robust CRC16 checksum evaluation.
  2. Backend: Patched backend/src/schemas/common.js to rip out the regex export. Refactored the validateKey middlewares in routes/profiles.js and routes/impact.js, as well as 3 CQRS commands in eventSourcing/commands.js to utilize the shared validator.
  3. Frontend & Extension: Updated extension/src/session-state.ts's internal state machine and frontend/pages/submit-project.tsx to stop relying on [A-Z2-7] and directly use the StrKey validation helper already exposed in their modules.

🧪 Testing & Verification

  • Confirmed total codebase removal of the vulnerable regexes (except in historical test mock assertions).
  • Verified stellarValidator.js properly catches malformed checksums that naive shape-checkers previously allowed.

…ross-runtime validation, and custom linting

- Implemented Husky commit-msg and pre-push policy enforcer (Resolves Stellar-Search#476)
- Created scripts/check-invariants.js to run standalone tests on pre-commit (Resolves Stellar-Search#473)
- Scaffolded shared validation schema and replaced backend strkey regex (Resolves Stellar-Search#474)
- Scaffolded eslint-plugin-greenpay for internal rules (Resolves Stellar-Search#475)
- Created shared/validators/stellarValidator.js utilizing @stellar/stellar-sdk's StrKey
- Replaced vulnerable hand-rolled regexes in backend schemas, event sourcing, and routes
- Migrated extension session-state and frontend form UI to the SDK's CRC16 checksum check
- Resolves Stellar-Search#474
…covery tests and remove uninstalled greenpay plugin reference from eslint config
…m-valid stellar addresses in session-recovery test
…olve 500 errors in rate limiter and update routes
@ajulaybeeb
ajulaybeeb force-pushed the feature/474-validation-sot branch from 11eea03 to 86f4001 Compare August 28, 2026 18:14
@AbuJulaybeeb
AbuJulaybeeb merged commit 2ab3d1d into Stellar-Search:main Aug 28, 2026
22 checks passed
@github-actions

Copy link
Copy Markdown

🎉 Merged — thank you, @ajulaybeeb!

Another one in the bag — thank you for contributing!

If you're looking for something to pick up next, the open issues are labelled by area and complexity.

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.

Cross-cutting: One validation source of truth enforced across Node, browser, React Native and Rust

2 participants