Skip to content

Commit 9391aaf

Browse files
Stop downloading vlt artifacts during hosted scans (#2013)
A hosted scan of a vlt project downloaded every granted patch archive the way vlt fetches it, and withheld the dependency (`redirect_vlt_artifact_unverifiable`) when the server re-gzipped it. That guarded against patch.socket.dev's CDN re-encoding archives, which vlt rejects with EINTEGRITY. The patch server has sent archives with `Cache-Control: no-transform` since depscan #26856 and #26867, and production serves them unencoded today. On any mirror that still re-encodes, `vlt ci` fails closed with EINTEGRITY, so nothing installs unpatched bytes. So the scan no longer fetches the archives. It pins vlt dependencies directly, without a full download of every patched package per run. The in-memory hosted engine (the Node addon and `hosted-bundle`) has no network, so it used to withhold every vlt dependency as "offline"; it now pins them the way the disk flow does. The warm-tree heal now checks the Socket-owned lock instances this run confirmed in `vlt-lock.json`. With no patch record and no hidden lock it reports the copy as undeterminable (asking for `vlt ci`) instead of comparing it against downloaded archive bytes. The vlt backtest still probes the live artifact itself: a must-patch hosted cell records `blocked-by-server-encoding` when its probe sees a content-encoded response, without running the CLI. Assisted-by: Claude Code:claude-opus-5-5
1 parent 101e0e1 commit 9391aaf

35 files changed

Lines changed: 267 additions & 2379 deletions

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2919,8 +2919,7 @@ jobs:
29192919
--ignored --nocapture --test-threads=4 2>&1 | tee hosted-e2e.log || status=$?
29202920
echo "::endgroup::"
29212921
if [ "$status" -eq 0 ]; then
2922-
# The vlt leg (probe-driven: the clean refusal while the artifact
2923-
# is content-encoded, the full install proof once it is not).
2922+
# The vlt leg: the hosted pin and the fresh-checkout install proof.
29242923
python3 scripts/check-vlt-legs.py \
29252924
--manifest crates/socket-patch-cli/tests/vlt-leg-manifest.json hosted-e2e.log
29262925
exit $?

‎.github/workflows/vlt-compatibility.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,10 @@ jobs:
466466
# minutes (EAI_NONAME) while the service is up; see the action.
467467
uses: ./.github/actions/pin-socket-hosts
468468
- name: Backtest against production
469-
# Every hosted cell probes the artifact first; it records
470-
# blocked-by-server-encoding only when that probe saw a non-identity
471-
# Content-Encoding and the CLI refused cleanly. Any other failure is an
472-
# error.
469+
# Every hosted cell probes the artifact first; a must-patch cell
470+
# records blocked-by-server-encoding (without running the CLI) only
471+
# when that probe saw a non-identity Content-Encoding. Any other
472+
# failure is an error.
473473
shell: bash
474474
env:
475475
VLT_TEST_VERSION: ${{ matrix.vlt }}

‎.github/workflows/vlt-serve-watchdog.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: vlt serve watchdog
33
# vlt hashes the wire body of a registry tarball and asks for
44
# `accept-encoding: gzip;q=1.0, identity;q=0.5`, so a patch artifact that
55
# patch.socket.dev (or its CDN) serves content-encoded fails `EINTEGRITY` on
6-
# every vlt release, and hosted mode refuses to pin it
7-
# (`redirect_vlt_artifact_unverifiable`). This job fetches the public free
6+
# every vlt release (hosted mode pins it without downloading it, relying on
7+
# the server's `Cache-Control: no-transform`). This job fetches the public free
88
# minimist artifact exactly that way and fails when the response is
99
# content-encoded or its sha512 differs from the API's integrity, which pages
1010
# through the repository's workflow-failure notification.

‎crates/socket-patch-cli/CLI_CONTRACT.md‎

Lines changed: 2 additions & 3 deletions
Large diffs are not rendered by default.

‎crates/socket-patch-cli/src/commands/scan/hosted.rs‎

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -870,23 +870,6 @@ async fn run_redirect_selected_untracked(
870870
);
871871
}
872872

873-
// vlt artifact preflight: before any takeover or rewrite (dry runs
874-
// included), each in-scope artifact is fetched as vlt fetches it. A
875-
// failure while vlt drives withholds the dep from every rewriter;
876-
// otherwise only from the vlt rewrite.
877-
let vlt_preflight = {
878-
let deps: Vec<(&str, &DepOverride)> = candidates
879-
.iter()
880-
.filter(|c| c.dep.ecosystem == "npm")
881-
.map(|c| (c.purl.as_str(), &c.dep))
882-
.collect();
883-
vlt::artifact_preflight(common, api_client, &deps).await
884-
};
885-
engine::withhold_everywhere(
886-
&mut candidates,
887-
&vlt_preflight.withheld_everywhere,
888-
&mut skipped,
889-
);
890873
// A NEW row the lockfiles already pin on the patch server these
891874
// references name (not a configured one, so the recorded view's
892875
// discovery could not see it) is ALREADY: decided here, before the lock
@@ -1257,20 +1240,12 @@ async fn run_redirect_selected_untracked(
12571240
.then(|| (read.clone(), python_metadata.clone()));
12581241
// A retracted takeover rewrites again without it (see below).
12591242
let takeover_metadata = takeover.is_staged().then(|| python_metadata.clone());
1260-
let mut done = engine::rewrite(
1261-
&view,
1262-
read,
1263-
&candidates,
1264-
python_metadata,
1265-
&vlt_preflight.withheld_from_vlt,
1266-
rewrite_options(),
1267-
)
1268-
.await;
1243+
let mut done =
1244+
engine::rewrite(&view, read, &candidates, python_metadata, rewrite_options()).await;
12691245

12701246
// The rollout gate (§5.2): every write-free check has run — grants,
1271-
// purl/url, vlt preflight, takeover refusals, wheel metadata, and the
1272-
// rewrite above, whose confirmation probe proves a NEW row would be
1273-
// pinned. Only then is the budget spent; deferred rows leave the
1247+
// purl/url, takeover refusals, wheel metadata, and the rewrite above,
1248+
// whose confirmation probe proves a NEW row would be pinned. Only then is the budget spent; deferred rows leave the
12741249
// rewrite set, which is rewritten again without them.
12751250
if let (Some(gate), Some((read, python_metadata))) = (rollout.as_mut(), second_pass) {
12761251
let eligible: std::collections::HashSet<(String, String)> = done
@@ -1290,15 +1265,8 @@ async fn run_redirect_selected_untracked(
12901265
let before = candidates.len();
12911266
candidates.retain(|c| !deferred.contains(&(sel_purl(c), c.dep.patch_uuid.clone())));
12921267
if candidates.len() != before {
1293-
done = engine::rewrite(
1294-
&view,
1295-
read,
1296-
&candidates,
1297-
python_metadata,
1298-
&vlt_preflight.withheld_from_vlt,
1299-
rewrite_options(),
1300-
)
1301-
.await;
1268+
done =
1269+
engine::rewrite(&view, read, &candidates, python_metadata, rewrite_options()).await;
13021270
}
13031271
}
13041272
// A staged takeover the rewrite did not pin must not happen: undo every
@@ -1330,7 +1298,6 @@ async fn run_redirect_selected_untracked(
13301298
read,
13311299
&candidates,
13321300
takeover_metadata.clone().unwrap_or_default(),
1333-
&vlt_preflight.withheld_from_vlt,
13341301
rewrite_options(),
13351302
)
13361303
.await;
@@ -1553,7 +1520,6 @@ async fn run_redirect_selected_untracked(
15531520
.get(lock_key)
15541521
.or_else(|| done.files.get(lock_key))
15551522
.map(String::as_str),
1556-
preflight: &vlt_preflight,
15571523
records: &records,
15581524
confirmed: &confirmed,
15591525
confirmed_vlt: &rewrite.confirmed_vlt_uuids,
@@ -1729,7 +1695,6 @@ async fn run_redirect_selected_untracked(
17291695
// rewriter's own warnings first (e.g. `no package-lock.json`), then the
17301696
// record, package-manager, stale-install, takeover and prune warnings.
17311697
let mut engine_warnings = rewrite.warnings.clone();
1732-
engine_warnings.extend(vlt_preflight.warnings.iter().cloned());
17331698
engine_warnings.extend(record_warnings);
17341699
engine_warnings.extend(done.rush_warnings.iter().cloned());
17351700
engine_warnings.extend(done.pnpm_warnings.iter().cloned());
@@ -2234,9 +2199,6 @@ fn describe_skip_reason(reason: &str) -> String {
22342199
(see the warning)"
22352200
.into()
22362201
}
2237-
"redirect_vlt_artifact_unverifiable" => {
2238-
"vlt could not verify the hosted artifact (see the warning)".into()
2239-
}
22402202
"redirect_unattributable" => {
22412203
"lockfile discovery could not attribute its pin to one package version, so \
22422204
nothing was written for it (reconcile the project's lockfiles; --json has the \
@@ -3808,10 +3770,6 @@ mod tests {
38083770
describe_skip_reason("redirect_bun_lockb_invalid"),
38093771
describe_skip_reason("redirect_bun_lock_unsupported")
38103772
);
3811-
assert_eq!(
3812-
describe_skip_reason("redirect_vlt_artifact_unverifiable"),
3813-
"vlt could not verify the hosted artifact (see the warning)"
3814-
);
38153773
assert_eq!(
38163774
describe_skip_reason("redirect_vlt_lock_unsupported"),
38173775
"vlt-lock.json blocks the vendored-to-hosted migration (see the warning)"

0 commit comments

Comments
 (0)