-
Notifications
You must be signed in to change notification settings - Fork 2k
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
job, task group, and task IDs should not allow null characters #9020
Conversation
717e5a8
to
61119f1
Compare
|
||
// task name should not allow null characters | ||
job.TaskGroups[0].Name = "so_much_better" | ||
job.TaskGroups[0].Tasks[0].Name = "ive_had_it_with_these_\000_chars_in_these_names" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆
@@ -3943,6 +3943,8 @@ func (j *Job) Validate() error { | |||
mErr.Errors = append(mErr.Errors, errors.New("Missing job ID")) | |||
} else if strings.Contains(j.ID, " ") { | |||
mErr.Errors = append(mErr.Errors, errors.New("Job ID contains a space")) | |||
} else if strings.Contains(j.ID, "\000") { | |||
mErr.Errors = append(mErr.Errors, errors.New("Job ID contains a null chararacter")) | |||
} | |||
if j.Name == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't come up except when using the API, but Jobs have both a name and an ID. Should we be validating that Job.Name
also doesn't contain a null char?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, good point. i don't see any indexing there, but a quick test showed that null in Name
put a docker job into a failing state:
2020-10-05T12:55:36Z Driver Failure Failed to start container cc77616db08d0701b20b438af789855e56eb343f7ce9c0636c779e399e052177: API error (500): OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"setenv: invalid argument\"": unknown
will update PR to include Job.Name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooh, in addition, the task drivers set the NOMAD_DC
environment variable, which will fail if the node datacenter includes a null character 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and region 🤦++
a048500
to
fa9d0e7
Compare
…racters updated CHANGELOG and upgrade guide
… datacenter, and job name
fa9d0e7
to
b0c2e51
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
resolves #8796
null characters in region, datacenter, job ID/name, task group name, and task name can break a lot of things, including:
changelog summary: