fix(xcecli): assert own hostname as FROM_HOST at submission time (bug-1676, gitea #44)

JobSubmitRequest gains a FromHost field, populated in BuildJobRequest()
via os.Hostname(). Matches how traditional batch schedulers report the
submitting host, and sidesteps having the server derive it from the
connection (which apiserver was doing via ctx.ClientIP() -- an IP not
a hostname, and spoofable via X-Forwarded-For since this apiserver
never configures gin's TrustedProxies).

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:28 +00:00
parent 590e2a726e
commit 4fad788430
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
3 changed files with 37 additions and 0 deletions

View file

@ -338,6 +338,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"` // bug-1676: submitting host's own hostname, set by BuildJobRequest via os.Hostname()
OutDir string `json:"out_dir,omitempty"`
InFile string `json:"in_file,omitempty"`
OutFile string `json:"out_file,omitempty"`