Skip to content

Commit

Permalink
Add env var name/value length validation
Browse files Browse the repository at this point in the history
Also, decrease maxlen for value from ~64k*3/4 to a nice round 32k.
  • Loading branch information
randomir committed Feb 4, 2022
1 parent a33a4a0 commit 52916be
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/dashboard/src/settings/EnvironmentVariables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,18 @@ export default function EnvVars() {
if (name.trim() === '') {
return 'Name must not be empty.';
}
if (name.length > 255) {
return 'Name too long. Maximum name length is 255 characters.';
}
if (!/^[a-zA-Z0-9_]*$/.test(name)) {
return 'Name must match /[a-zA-Z_]+[a-zA-Z0-9_]*/.';
}
if (variable.value.trim() === '') {
return 'Value must not be empty.';
}
if (variable.value.length > 32768) {
return 'Value too long. Maximum value length is 32768 characters.';
}
if (pattern.trim() === '') {
return 'Scope must not be empty.';
}
Expand Down

0 comments on commit 52916be

Please sign in to comment.