Merge pull request #7051 from hashicorp/b-copy-jobs-oss

sentinel: copy jobs to prevent mutation
This commit is contained in:
Mahmood Ali
2020-02-03 10:49:44 -05:00
committed by GitHub

View File

@@ -242,8 +242,9 @@ func (j *Job) Register(args *structs.JobRegisterRequest, reply *structs.JobRegis
}
}
// Enforce Sentinel policies
policyWarnings, err := j.enforceSubmitJob(args.PolicyOverride, args.Job)
// Enforce Sentinel policies. Pass a copy of the job to prevent
// sentinel from altering it.
policyWarnings, err := j.enforceSubmitJob(args.PolicyOverride, args.Job.Copy())
if err != nil {
return err
}