Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add env var name/value length validation
Also, decrease maxlen for value from ~64k*3/4 to a nice round 32k.
  • Loading branch information
randomir committed May 4, 2022
commit e41a76da99f8ff1e667986a1ae54139218cb7346
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