Skip to content
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

task arguments #717

Merged
merged 4 commits into from
Aug 24, 2016
Merged

task arguments #717

merged 4 commits into from
Aug 24, 2016

Conversation

kensipe
Copy link
Member

@kensipe kensipe commented Aug 23, 2016

enabling the ability to have the REST API override or add arguments to a job.

@@ -151,7 +151,8 @@ class JobManagementResource @Inject()(val jobScheduler: JobScheduler,
require(jobGraph.lookupVertex(jobName).isDefined, "Job '%s' not found".format(jobName))
val job = jobGraph.getJobForName(jobName).get
log.info("Manually triggering job:" + jobName)
jobScheduler.taskManager.enqueue(TaskUtils.getTaskId(job, DateTime.now(DateTimeZone.UTC), 0), job.highPriority)
jobScheduler.taskManager.enqueue(TaskUtils.getTaskId(job, DateTime.now(DateTimeZone.UTC), 0, Option(arguments).filter(_.trim.nonEmpty))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how job.arguments is scrubbed or sanitized, but looking at this ... seems like someone could easily embed a semi-colon and then append some other command after it - getting two for the price of one. You know, a little shell script injection. Are we worried about those kinds of things here? Or can we assume that someone else already scrubbed (or will scrub )the arguments query parameter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a very good point. It seems that is missed in other parts of the code as well. This was suppose to be just a bug fix. That and the fact we are looking to move the whole thing to metronome I'm not sure if makes sense to spend too much time on it but I will have a look. At least to get rid of the semi-colon.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's a PITA and exists in other parts of the codebase as well, maybe
just file a GH issue for it (because it's a problem in general) so as to
not block this PR

On Wed, Aug 24, 2016 at 8:27 AM, Ken Sipe [email protected] wrote:

In src/main/scala/org/apache/mesos/chronos/scheduler/api/
JobManagementResource.scala
#717 (comment):

@@ -151,7 +151,8 @@ class JobManagementResource @Inject()(val jobScheduler: JobScheduler,
require(jobGraph.lookupVertex(jobName).isDefined, "Job '%s' not found".format(jobName))
val job = jobGraph.getJobForName(jobName).get
log.info("Manually triggering job:" + jobName)

  •  jobScheduler.taskManager.enqueue(TaskUtils.getTaskId(job, DateTime.now(DateTimeZone.UTC), 0), job.highPriority)
    
  •  jobScheduler.taskManager.enqueue(TaskUtils.getTaskId(job, DateTime.now(DateTimeZone.UTC), 0, Option(arguments).filter(_.trim.nonEmpty))
    

its a very good point. It seems that is missed in other parts of the code
as well. This was suppose to be just a bug fix. That and the fact we are
looking to move the whole thing to metronome I'm not sure if makes sense to
spend too much time on it but I will have a look. At least to get rid of
the semi-colon.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/mesos/chronos/pull/717/files/40a7c0b42f1da0b3c60ae7989cf1d44e18d3cb3c#r76046360,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACPVLIlU0O1VzssA_dXMU0SEy9YdkgB2ks5qjDiggaJpZM4Jrgou
.

@kensipe
Copy link
Member Author

kensipe commented Aug 24, 2016

added protection against the evils of the world

@kensipe
Copy link
Member Author

kensipe commented Aug 24, 2016

@jdef thanks!

@kensipe kensipe assigned bbannier and unassigned bbannier Aug 24, 2016
@kensipe kensipe merged commit d1677f9 into master Aug 24, 2016
gkleiman pushed a commit that referenced this pull request Apr 26, 2017
* using arguments if provided otherwise using the job arguments

* fixing tests

* adding additional tests for argument override

* command injection fixed for this feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants