Repository navigation
Commit f023506
* Start fix for #432
Assisted-by: Claude Code:claude-opus-5-5
* Pin npm aliases in the npm 6 lock mirror
A lockfileVersion 2 package-lock.json keeps a legacy `dependencies`
mirror for npm 6, which spells an alias install as
`"lp": {"version": "npm:left-pad@1.3.0"}`. Hosted scans matched mirror
nodes on a plain version only, so the alias node silently stayed on
the registry, and a lockfileVersion 1 alias lock pinned nothing at all
("no package-lock.json entry"). Rollback could not restore such a node
either.
Every reader of the legacy tree now decodes the alias through one
helper. Hosted scans rewire the alias node with the rest, and rollback
restores it. npm 6 fetches an aliased dependency from the registry
whatever `resolved` says, so under npm 6 the pinned lock fails closed
(EINTEGRITY) instead of installing unpatched bytes, and the run warns
`redirect_npm_legacy_alias_client`.
Refs #432
Assisted-by: Claude Code:claude-opus-5-5
* Vendor npm aliases in the npm 6 lock mirror
Vendoring skipped the v2 mirror node of an npm alias with
`vendor_legacy_alias_skipped`, so npm 6 installed the unpatched
registry tarball through it. npm 6 does install an alias node from a
`file:` resolved (checked against npm 6.14.18), so the node is now
rewired like every other mirror node and revert restores it.
Refs #432
Assisted-by: Claude Code:claude-opus-5-5
* Withhold VEX when the npm 6 mirror is unpatched
Lockfile-only VEX read a v2 lock's `packages` half only, so it attested
`not_affected` for a package whose legacy mirror (what npm 6 installs
from) still resolved to the registry, as locks written before this fix
do for npm aliases. Such a ref is now diagnosed as unattributable and
not attested. A lockfileVersion 1 alias node is read as an install of
its target package.
Fixes #432
Assisted-by: Claude Code:claude-opus-5-5
* Let a stale npm 6 mirror contest the sibling lock
When npm-shrinkwrap.json's legacy mirror still resolved a package from
the registry, VEX dropped the shrinkwrap's own ref but still attested
the same package from package-lock.json, although npm 6 installs from
the shrinkwrap. A mirror node off Socket now counts as resolving the
package elsewhere, so the sibling lock's ref is contested too.
Refs #432
Assisted-by: Claude Code:claude-opus-5-5
* Port vex alias test fix from #851
Main has been red since #605: two commands::vex_consumed tests assume
the name-keyed resolver never returns npm-aliased copies, but #605
taught it to probe bundled store trees. Port #851's test-only fix so
this PR's CI runs on a green base. It becomes a no-op once #851 lands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EgBZwmqgXLZaRGyfDFoWwp
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1714299 commit f023506
15 files changed
Lines changed: 918 additions & 160 deletions
File tree
- crates
- socket-patch-cli/tests
- socket-patch-core
- src
- patch/redirect
- upstream
- vendor
- lock_inventory
- vex/discover
- tests/fixtures
- redirect/npm/package-lock-v3/legacy-alias-mirror-v2
- expected
- input
- vex-discover-golden
- docs
- testing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1177 | 1177 | | |
1178 | 1178 | | |
1179 | 1179 | | |
1180 | | - | |
1181 | | - | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
1182 | 1185 | | |
1183 | 1186 | | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
1187 | | - | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
1191 | | - | |
1192 | | - | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
1193 | 1219 | | |
1194 | 1220 | | |
1195 | | - | |
1196 | | - | |
1197 | | - | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
1206 | | - | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
1211 | | - | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
1216 | | - | |
1217 | | - | |
1218 | | - | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
1224 | | - | |
1225 | | - | |
1226 | | - | |
1227 | | - | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
1228 | 1226 | | |
1229 | | - | |
| 1227 | + | |
1230 | 1228 | | |
1231 | 1229 | | |
| 1230 | + | |
1232 | 1231 | | |
1233 | 1232 | | |
1234 | 1233 | | |
1235 | | - | |
| 1234 | + | |
1236 | 1235 | | |
1237 | 1236 | | |
1238 | 1237 | | |
1239 | 1238 | | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
1243 | | - | |
1244 | | - | |
1245 | | - | |
1246 | | - | |
1247 | | - | |
| 1239 | + | |
1248 | 1240 | | |
1249 | 1241 | | |
1250 | | - | |
1251 | | - | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
1252 | 1245 | | |
| 1246 | + | |
1253 | 1247 | | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
1265 | | - | |
1266 | | - | |
1267 | | - | |
1268 | | - | |
1269 | | - | |
1270 | | - | |
1271 | | - | |
1272 | | - | |
1273 | | - | |
1274 | | - | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
1275 | 1357 | | |
1276 | 1358 | | |
1277 | 1359 | | |
| |||
0 commit comments