fix(apiserver): pass client-asserted FromHost through unchanged (bug-1676, gitea #44)

CreateJob now does FromHost: req.FromHost, a straight passthrough of
whatever xcecli (or any other client) sends in JobSubmitRequest.FromHost,
instead of deriving it server-side via ctx.ClientIP().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AgYRU3zDTqNGV5Jk8aiKLg
This commit is contained in:
Rongsong Shen 2026-08-24 15:14:33 +00:00
parent 4fad788430
commit fe8818b19b
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
2 changed files with 2 additions and 1 deletions

View file

@ -1480,7 +1480,7 @@ func (j JobController) CreateJob(ctx *gin.Context) {
UserPriority: req.JobPriority,
DependCond: req.DependCond,
CWD: req.CWD,
FromHost: ctx.ClientIP(), //use ip now, need use hostname ?
FromHost: req.FromHost, // bug-1676: client-asserted hostname, passed through unchanged
PreExecCmd: req.PreExecCmd,
PostExecCmd: req.PostExecCmd,
RequeueErrorValues: req.RequeueErrorValues,

View file

@ -662,6 +662,7 @@ type JobSubmitRequest struct {
ChkpntDir string `json:"chkpnt_dir,omitempty"`
InitChkpntPeriod int `json:"init_chkpnt_period,omitempty"`
CWD string `json:"cwd,omitempty"`
FromHost string `json:"from_host,omitempty"` // client-asserted submitting hostname (bug-1676) -- passed through unchanged, not derived server-side
OutDir string `json:"out_dir,omitempty"`
InFile string `json:"in_file,omitempty"`
OutFile string `json:"out_file,omitempty"`