Skip to content

Commit b80310b

Browse files
committed
feat: add validation for manual env variable key input
- Added yup regex validation for env key field in add-new-agent form - Keys must start with letter/underscore, contain only alphanumeric and underscores
1 parent e299a9d commit b80310b

File tree

1 file changed

+4
-1
lines changed
  • console/workspaces/pages/add-new-agent/src/form

1 file changed

+4
-1
lines changed

console/workspaces/pages/add-new-agent/src/form/schema.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ export const addAgentSchema = yup.object({
108108
.array()
109109
.of(
110110
yup.object({
111-
key: yup.string().trim(),
111+
key: yup.string().trim().matches(
112+
/^$|^[A-Za-z_][A-Za-z0-9_]*$/,
113+
'Key must start with a letter or underscore, and contain only letters, numbers, or underscores'
114+
),
112115
value: yup.string().trim(),
113116
})
114117
)

0 commit comments

Comments
 (0)