Skip to content

Commit

Permalink
Remove obsecure Machinery 'result' field from job status response.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Mar 13, 2024
1 parent 2af83ff commit 3453e21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
14 changes: 6 additions & 8 deletions internal/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,9 @@ func (co *Core) GetJobStatus(jobID string) (models.JobStatusResp, error) {
}

return models.JobStatusResp{
JobID: out.TaskUUID,
State: out.State,
Results: out.Results,
Error: out.Error,
JobID: out.TaskUUID,
State: out.State,
Error: out.Error,
}, nil
}

Expand All @@ -213,10 +212,9 @@ func (co *Core) GetJobGroupStatus(groupID string) (models.GroupStatusResp, error
)
for i, j := range res {
jobs[i] = models.JobStatusResp{
JobID: j.TaskUUID,
State: j.State,
Results: j.Results,
Error: j.Error,
JobID: j.TaskUUID,
State: j.State,
Error: j.Error,
}

if j.State == tasks.StateSuccess {
Expand Down
9 changes: 3 additions & 6 deletions models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package models

import (
"time"

"github.com/RichardKnop/machinery/v1/tasks"
)

// JobReq represents a job request.
Expand Down Expand Up @@ -31,10 +29,9 @@ type JobResp struct {

// JobStatusResp represents the response of a single job.
type JobStatusResp struct {
JobID string `json:"job_id"`
State string `json:"state"`
Results []*tasks.TaskResult `json:"results"`
Error string `json:"error"`
JobID string `json:"job_id"`
State string `json:"state"`
Error string `json:"error"`
}

// GroupReq represents a Jobrequest group.
Expand Down

0 comments on commit 3453e21

Please sign in to comment.