cmds/exp/pxeserver, tftpd: keep TFTP requests inside the served dir #3812
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.39) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 135 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.294
Real PR Conversation Timeline
1 comments
"Review active on #3812"
general
weight: 0.35
alhudz
Repro:
pxeserver -tftp-dir /srv/tftp, then a TFTP read of../../etc/shadow. Withtftpd -root /srv/tftpand a dangling link/srv/tftp/x -> /etc/cron.d/x, a TFTP write ofx.Expected: both requests are refused.
Actual:
pxeserverreturns the host's/etc/shadow;tftpdcreates/etc/cron.d/xwith the client's data.Cause:
pxeserverusespack.ag/tftp'sFileServer, which opensfilepath.Join(dir, filepath.Clean(name)), andCleankeeps leading...tftpd'sisValidPathtreats a dangling symlink as a new file, checks only its parent, andos.Createthen follows the link.Fix:
pxeserverserves the directory throughos.Root, keeping the leading-/names PXE clients send working.tftpdrejects a target thatLstats as present but doesn't resolve; it stays on the existing check rather thanos.Rootbecause it is in the TinyGo build list and TinyGo'soshas noRoot.Tests:
main_test.gofor both commands does a real TFTP round trip; the../secret, out-of-root symlink and dangling-link cases fail onmainand pass with this change.