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 May 4, 2022
1 parent 403309e commit e41a76d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/gitpod-protocol/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,18 @@ export namespace UserEnvVar {
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-Z_]+[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 e41a76d

Please sign in to comment.