Skip to content

feat(shared): add platform-specific regex validation for card handles #252

@mramansayyad

Description

@mramansayyad

Summary

Introduces strict platform-specific regex pattern checking on card creation and update payloads to prevent broken hyperlinks on developer cards.

Contexts

The POST /cards and PUT /cards/:id endpoints accept string inputs for usernames and profile URLs. Without platform-level constraints, users can submit formatting errors (e.g., spaces or unsupported special characters in a GitHub or Twitter handle). This results in malformed links on both the mobile interface and web backup layouts.

Tasks

  • Define rigid regex verification strings for major platforms (GitHub, Twitter, LinkedIn) within packages/shared/src/platforms.ts.
  • Bind validations inside the core zod input payload schemas.
  • Attach structured validation messages returning 400 Validation Failed if input criteria are violated.
  • Update shared workspace validation tests.

Acceptance Criteria

  • Payloads containing illegal characters for specific developer profiles are blocked with a 400 status.
  • Well-formatted handles pass validation without any latency or regression.
  • Unit tests covering valid/invalid handle boundaries are updated and pass successfully.

Area

shared / backend

Difficulty

Easy

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions