Skip to content

fix(validation): validate managementToken format using regex#6259

Open
Abfa41 wants to merge 2 commits into
JhaSourav07:mainfrom
Abfa41:fix/management-token-validation
Open

fix(validation): validate managementToken format using regex#6259
Abfa41 wants to merge 2 commits into
JhaSourav07:mainfrom
Abfa41:fix/management-token-validation

Conversation

@Abfa41

@Abfa41 Abfa41 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #6192

This PR adds format validation for the managementToken field to ensure malformed tokens are rejected during schema validation instead of failing later during authentication.

Changes made

  • Added regex validation for managementToken.
  • Enforced the required cpn_ prefix.
  • Restricted token characters to base64url-safe characters (A-Z, a-z, 0-9, _, -).
  • Preserved existing length constraints and optional behavior.
  • Added a clear validation error message for malformed tokens.
  • Updated notification route test fixtures to use management tokens that match the enforced cpn_ token format.

Benefits

  • Provides immediate feedback for invalid tokens.
  • Improves debuggability for developers.
  • Reduces confusion caused by generic authentication failures.
  • Prevents malformed values from progressing further into the application.

Validation Rules

Accepted format:

cpn_xxxxxxxxxxxxxxxxx

Rejected examples:

abc_token
cpn token
cpn@token

@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

@Abfa41 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jun 21, 2026
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

Asset PR Size Base Size Difference Status
static/chunks/9389-[hash].js 6.25 KB 6.19 KB +0.07 KB (+1.12%) 🔴 Regression

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3710.74 KB 3710.63 KB +0.11 KB (+0.00%)
Total CSS 290.64 KB 290.64 KB 0 B

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.

fix(validation): managementToken format not validated - accepts any string (MEDIUM)

1 participant