-
-
Notifications
You must be signed in to change notification settings - Fork 249
feat: add input validation for entity names #1043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat: add input validation for entity names #1043
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||
apps/platform/src/components/dashboard/environment/addEnvironmentDialogue/index.tsx
Show resolved
Hide resolved
|
@Allan2000-Git, please resolve all open reviews! |
|
@Allan2000-Git, please resolve all open reviews; otherwise this PR will be closed after Tue Jul 08 2025 18:32:15 GMT+0000 (Coordinated Universal Time)! |
User description
Description
This PR introduces a utility function
validateAsciiInputto ensure input strings (workspace, project, secret, variable & environment names) contain only ASCII alphanumeric characters (A-Z,a-z,0-9). It returnstruefor valid inputs andfalseotherwise.Fixes #929
Test cases
Valid:
validateAsciiInput("Hello123")
validateAsciiInput("A1B2C3")
validateAsciiInput("abcDEF")
validateAsciiInput("1234567890")
Invalid:
validateAsciiInput("Hello World")
validateAsciiInput("abc@123")
validateAsciiInput("name#")
validateAsciiInput("💡idea")
validateAsciiInput("abc-def")
validateAsciiInput("abc_def")
validateAsciiInput("abc.123")
Dependencies
N/A
Future Improvements
N/A
Mentions
@rajdip-b
Screenshots of relevant screens
Screen.Recording.2025-07-01.at.11.21.28.PM.1.mov
Developer's checklist
If changes are made in the code:
PR Type
Bug fix, Enhancement
Description
Add ASCII validation for entity names (workspace, project, environment, secret, variable)
Prevent unicode characters causing slug generation issues
Display validation errors with red borders and messages
Disable form submission when validation fails
Changes diagram
flowchart LR A["User Input"] --> B["validateAsciiInput()"] B --> C{"ASCII Only?"} C -->|Yes| D["Enable Submit"] C -->|No| E["Show Error & Disable Submit"] E --> F["Red Border & Error Message"]Changes walkthrough 📝
utils.ts
Add ASCII validation utility functionapps/platform/src/lib/utils.ts
validateAsciiInput()function with alphanumeric regex validationindex.tsx
Add environment name ASCII validationapps/platform/src/components/dashboard/environment/addEnvironmentDialogue/index.tsx
index.tsx
Add project name ASCII validationapps/platform/src/components/dashboard/project/createProjectDialogue/index.tsx
index.tsx
Add secret name ASCII validationapps/platform/src/components/dashboard/secret/addSecretDialogue/index.tsx
index.tsx
Add variable name ASCII validationapps/platform/src/components/dashboard/variable/addVariableDialogue/index.tsx
add-workspace-dialog.tsx
Add workspace name ASCII validationapps/platform/src/components/shared/add-workspace-dialog.tsx