Repository navigation
fix(tier3): preserve MCP validation and local artifact paths - #472
Conversation
Signed-off-by: Narendran Raghavan <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
chrisknvidia
left a comment
There was a problem hiding this comment.
LGTM. Native task MCP declarations, including verifier and step-verifier environments, now go through the shared declaration policy before Harbor parses them, and malformed shapes fail without echoing values. _harbor_mcp_headers rewrites only unescaped bare $VAR to ${VAR}, and leaves $$VAR and already-braced values alone (I probed both). The /logs parent now resolves to a private runtime-logs tree whose role entries are fixed symlinks to the retained host dirs, and transfers of that parent are rejected. eval.py and the custom grader runner read the role-specific env vars, so their outputs don't move. With the locked Harbor 0.25.0, 748 local-environment, local-mode and isolation tests pass, and ruff is clean.
chrisknvidia
left a comment
There was a problem hiding this comment.
Reading this after it merged, so treat what follows as follow-ups.
I read the MCP and path changes line by line. The MCP side and the /logs rework look right; there is one small hardening fix I'd make before merging (below), and the rest are non-blocking notes.
MCP: the new native check runs right after the task.toml parse in _native_task_workdir, before any other validator and before the output directory is touched, and the staged copy is validated again. It covers environment, verifier.environment and steps[].verifier.environment, which are the only places Harbor 0.25's TaskConfig accepts mcp_servers (I checked the 0.25 config model). Malformed shapes and pydantic errors are turned into messages that do not echo values. validate_mcp_server_declarations itself is unchanged, and the
Paths: /logs now maps to a private runtime-logs directory under the run root, with the artifacts staging dir inside it and role aliases pointing at the real host role dirs. _resolve_path normalizes the logical spelling first, which also fixes the old '/logs//agent' case that resolved to an absolute '/agent'. '..' is still not collapsed, so safety rests on the resolve-based allowed-roots check; upload_file, upload_dir, download_file and download_dir all call it, and the reachable set stays the two existing roots (run root and trial dir). The exception is the two new download overrides, see below. Whole-/logs transfers (and any ancestor of runtime-logs) are rejected before the destination is touched, and the lstat checks on restart fail closed if a directory or alias was swapped. stop(delete=True) removes the aliases, not their targets, so retained role logs survive. Native Windows local mode fails closed before the environment starts, so the symlink code is not reachable there.
The one thing I'd fix before merging: download_dir_with_exclusions and download_dir_filtered resolve the source but never call _path_is_within_allowed_local_roots, so a '..' source through a mapped prefix (for example /workspace/../../../etc) still gets past them. It is not a regression, and it looks hard to exploit because Harbor's base code writes its archive under host /tmp, but a one-line check plus a test makes the four transfer methods consistent. Other suggestions are inline and in the list above: one sandboxed (or macOS) run of the new local-environment tests, passing verifier_env for the verifier scopes, a hint in the native MCP error message, and a refresh of the stale CI line in the PR body.
rng1995
left a comment
There was a problem hiding this comment.
Post-merge feedback is addressed by separate proposed repairs: #479 for download allowed roots and #491 for verifier MCP role grants plus safe hints. The existing #479 passed all40local-environment tests onmacOS; #491 has9initial focused passes and10independent staging passes, with broader local/CI runs still under observation. Refreshed the stale CI line using historical merged-head evidence23successful/4skipped checks. No source write or reopening was made to the merged #472 branch, and the proposed fixes are not claimed as current-main changes.
Summary
Follow up on the merged Harbor 0.25 upgrade in #464. Apply the existing MCP declaration policy consistently to native tasks, preserve supported source header placeholders, and collect local artifacts written through the documented log parent.
Before / After
$VAR${VAR}in generated Harbor TOML; retain original source files and agent MCP JSON/logsorHARBOR_LOGS_DIRMalformed native MCP shapes fail without echoing their values. Escaped, malformed and default-bearing credential placeholders remain rejected.
Verification
TaskConfigArtifactHandler, local exec, and Claude prompt boundariesmake lint, sdist/wheel build, changed Python formatting, diff and OSS boundary checks passed; Fern 0 errors, 1 existing warningThe native-policy and bare-header cases failed against the original
a72a6119adapter before the fix. The local parent/artifact and transfer cases also failed before implementation. The focused suites exercise actual Harbor models/staging and artifact collection with controlled local commands and fake credential names; no external MCP requests, vendor-agent inference or paid model calls were made in this follow-up. Actual Codex/Claude Code NVIDIA-backed smoke evidence from the upgrade remains recorded in #464.A broader local four-file attempt was interrupted after five passing tests under host filesystem load and is not reported as a passing suite. Complete final-revision CI will be recorded below.
CI: Merged head
388bd4abcompleted with 23 successful and 4 skipped checks. Post-merge download-boundary hardening is proposed in #479; verifier-role grants and safe validation hints are proposed in #491. Those follow-ups remain separate and are not claimed as merged into main.Local transfer boundaries
Retained role directories keep their host locations. Use
HARBOR_ARTIFACTS_DIRorHARBOR_LOGS_DIR/artifactsfor artifacts, rather than deriving a parent from a role directory or writing../artifactsfrom it. Whole/logstransfers fail before changing the destination; direct role and artifact-directory transfers remain supported. Secure-copy restrictions on symbolic links are unchanged.Review
Three independent post-merge review passes identified the three changes above. A separate independent review of the follow-up implementation found no additional actionable regressions. Inline findings on #464 will link to this PR and their verification.
Release impact
CHANGELOG.mdupdated.