Skip to content

[Backend] backend/src/validators/user.validator.ts does not validate publicKey format before it reaches the controller #1098

Description

@grantfox-oss

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Why this matters

backend/src/validators/user.validator.ts presumably validates request bodies for user-related routes, but if it doesn't check that a publicKey field matches the Stellar G... (56-char, base32) format before hitting the controller/repository layer, malformed keys propagate deeper into the stack where they fail with less clear errors (or worse, get silently stored).

Acceptance criteria

  • Add a Stellar public key format check (regex or SDK's StrKey.isValidEd25519PublicKey) to the relevant schema
  • Return a clear 400 with a descriptive message on failure
  • Add a test with a malformed key

Files to touch

  • backend/src/validators/user.validator.ts

Out of scope

  • Validating publicKey elsewhere in the codebase (tracked separately for other controllers)
  • Adding key checksum verification beyond format

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Stellar WaveIssues in the Stellar wave programbackendBackend related tasksgood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions