fix(data): harden fetch boundary + resolve segmented wall + honest missing signals#61
Closed
jungdaesuh wants to merge 1 commit into
Closed
fix(data): harden fetch boundary + resolve segmented wall + honest missing signals#61jungdaesuh wants to merge 1 commit into
jungdaesuh wants to merge 1 commit into
Conversation
…ssing signals - _slcontour/omfit_compat.load_wall: read the migrated segmented wall schema via devices.feature_at (was reading old flat keys → (None,None) → vessel outline dropped from the live sensor_map_rz node); service/nodes passes the shot through. - data/fetch/remote.py: validate remote_dir at the run_remote consumption boundary — it was interpolated raw into cluster shell commands (mkdir/cd), allowing shell metacharacter injection and, for "-tmp"/"--help", option/argument injection. Reject loudly (external-input security boundary). - data/fetch/toksearch.py: record every requested EFIT-tree signal as missing when MdsSignal is unavailable — they were silently dropped (in neither got nor missing). - service/mock.py: seed the mock RNG from zlib.crc32 (stable across restarts) instead of the per-process-salted builtin hash(). Adds tests/test_data_fetch_hardening.py (load_wall segmented schema + remote_dir accept/reject cases). ruff + ty(src) clean; full suite green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Collaborator
|
Superseded by #68, which is a rebased superset of this PR on current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hardens the data-fetch boundary and fixes two silent data defects surfaced by an
adversarial (Crucible) review. Covered by regression tests.
Related issue
Follow-up to the shot-segmented geometry migration (the
wallschema change).Type of change
src/magnetics/core)src/magnetics/data)src/magnetics/service)gui/web)What changed
_slcontour/omfit_compat.load_wall: read the migrated segmentedwallschema viadevices.feature_at(was reading the old flatr/zkeys →(None, None)→ thevessel outline was silently dropped from the live
sensor_map_rznode);service/nodesthreads the shot through. (Verified live:load_wall('DIII-D', shot)now returns the 257-point outline.)
data/fetch/remote.py: validateremote_dirat therun_remoteconsumptionboundary — it was interpolated raw into cluster shell commands (
mkdir -p,cd),allowing shell-metacharacter injection and, for
--leading values (-tmp,--help),option/argument injection. Rejected loudly (external-input security boundary).
data/fetch/toksearch.py: record every requested EFIT-tree signal as missingwhen
MdsSignalis unavailable — they were silently dropped (in neither the fetchednor the missing report), unlike the mdsthin path.
service/mock.py: seed the mock RNG fromzlib.crc32(stable across restarts)instead of the per-process-salted builtin
hash().How I tested it
uv sync --extra service;uv run ruff format --check ./ruff check ./ty check src/magnetics→ clean;uv run --with pytest pytest -q→ green(
tests/test_data_fetch_hardening.py: load_wall segmented-schema resolution +remote_diraccept/reject cases including--leading option injection).Checklist
ruff+pytest; web:lint+build) — validated locallycore(device-agnostic); none added to service routes🤖 Generated with Claude Code