mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
sentinel: copy jobs to prevent mutation
It's unclear whether Sentinel code can mutate values passed to the eval, so ensure it cannot by copying the job.
This commit is contained in:
committed by
Mahmood Ali
parent
ce3d58191d
commit
5dbccce4de
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user