Repository navigation
Commit 00d542d
authored
fix(update): npm-hardened global updates no longer roll back
Closes #134177
## What Problem This Solves
Fixes an issue where operators with npm `ignore-scripts=true` could download an OpenClaw update successfully, but strict package verification rejected the retained lifecycle guard and left the old version active.
## Why This Change Was Made
The staged npm install remains fully script-disabled, including for every dependency. Strict package verification runs before any lifecycle code. That boundary allows only the documented legacy guard from the exact `[email protected]` registry target. The shared owner then completes only OpenClaw's pending preinstall and postinstall work, and strict verification runs again before activation.
npm keeps its package-scoped allowance when supported, packaged-dist verification stays strict, and no global script policy changes.
The shipped `2026.8.1` postinstall predates the root lifecycle marker. The owner now finalizes that promoted marker only after both legacy scripts succeed.
## User Impact
Managed npm updates work on hardened hosts without enabling lifecycle scripts for unrelated packages or weakening package verification.
## Evidence
- Published `v2026.8.1` red: `2026.7.1 -> 2026.8.1` staged install exited 0, verification rejected `dist/openclaw-install-guard`, update exited 1, and `2026.7.1` stayed active.
- Main red at `0e0b89663f945324a9a9698a58ff8019fe78da8a`: a varied real-npm `1.0.0 -> 2.2.0` update reproduced the same retained guard and rollback.
- Exact-head green: the real published `[email protected]` package passed the narrow pre-lifecycle check, completed only its two lifecycle scripts, passed strict post-lifecycle verification, and activated `2026.8.1`.
- Security anti-cheat: a guard plus another unexpected dist file runs no lifecycle script, performs no swap, and leaves the old version active.
- CLI and owner tests: `node scripts/run-vitest.mjs src/cli/update-cli.test.ts src/infra/package-lifecycle.test.ts src/infra/package-update-steps.test.ts src/infra/package-update-steps.pnpm11-guard.test.ts` — 329 passed.
- Formatting, focused Oxlint, conflict-marker, max-lines, assertion-safety, test-temp, and diff checks passed.
- Production delta: `+57/-44`, net `+13`. The growth enforces verify-before-execute and strict verify-after-execute around the shipped legacy exception. Tests: `+77/-12`.
GitHub CI owns build, typecheck, platform, and merge gates.
Co-authored-by: Ayaan Zaidi <[email protected]>1 parent ace8a13 commit 00d542d
4 files changed
Lines changed: 134 additions & 56 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
5049 | 5050 | | |
5050 | 5051 | | |
5051 | 5052 | | |
5052 | | - | |
5053 | | - | |
5054 | | - | |
| 5053 | + | |
| 5054 | + | |
| 5055 | + | |
5055 | 5056 | | |
5056 | 5057 | | |
5057 | 5058 | | |
5058 | 5059 | | |
5059 | 5060 | | |
5060 | 5061 | | |
5061 | 5062 | | |
5062 | | - | |
| 5063 | + | |
5063 | 5064 | | |
5064 | 5065 | | |
5065 | 5066 | | |
5066 | | - | |
5067 | | - | |
5068 | | - | |
5069 | | - | |
5070 | | - | |
| 5067 | + | |
| 5068 | + | |
| 5069 | + | |
| 5070 | + | |
| 5071 | + | |
| 5072 | + | |
| 5073 | + | |
5071 | 5074 | | |
5072 | 5075 | | |
5073 | 5076 | | |
| |||
5076 | 5079 | | |
5077 | 5080 | | |
5078 | 5081 | | |
| 5082 | + | |
| 5083 | + | |
| 5084 | + | |
| 5085 | + | |
| 5086 | + | |
5079 | 5087 | | |
5080 | | - | |
| 5088 | + | |
5081 | 5089 | | |
5082 | 5090 | | |
5083 | 5091 | | |
5084 | 5092 | | |
5085 | 5093 | | |
5086 | 5094 | | |
| 5095 | + | |
| 5096 | + | |
| 5097 | + | |
| 5098 | + | |
| 5099 | + | |
| 5100 | + | |
| 5101 | + | |
| 5102 | + | |
| 5103 | + | |
| 5104 | + | |
| 5105 | + | |
| 5106 | + | |
| 5107 | + | |
| 5108 | + | |
| 5109 | + | |
| 5110 | + | |
| 5111 | + | |
| 5112 | + | |
| 5113 | + | |
| 5114 | + | |
| 5115 | + | |
| 5116 | + | |
| 5117 | + | |
| 5118 | + | |
| 5119 | + | |
| 5120 | + | |
| 5121 | + | |
| 5122 | + | |
| 5123 | + | |
| 5124 | + | |
| 5125 | + | |
| 5126 | + | |
| 5127 | + | |
| 5128 | + | |
| 5129 | + | |
| 5130 | + | |
| 5131 | + | |
| 5132 | + | |
| 5133 | + | |
| 5134 | + | |
| 5135 | + | |
| 5136 | + | |
| 5137 | + | |
| 5138 | + | |
| 5139 | + | |
| 5140 | + | |
| 5141 | + | |
| 5142 | + | |
| 5143 | + | |
| 5144 | + | |
| 5145 | + | |
| 5146 | + | |
| 5147 | + | |
| 5148 | + | |
| 5149 | + | |
| 5150 | + | |
| 5151 | + | |
5087 | 5152 | | |
5088 | 5153 | | |
5089 | 5154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | 139 | | |
142 | 140 | | |
143 | 141 | | |
144 | 142 | | |
| 143 | + | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
| |||
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
169 | 174 | | |
170 | 175 | | |
171 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
1101 | 1102 | | |
1102 | 1103 | | |
1103 | 1104 | | |
1104 | | - | |
1105 | | - | |
1106 | | - | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
1117 | | - | |
1118 | | - | |
1119 | | - | |
1120 | | - | |
1121 | | - | |
1122 | | - | |
1123 | | - | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
1133 | | - | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
1140 | | - | |
1141 | | - | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
1147 | 1105 | | |
1148 | 1106 | | |
1149 | 1107 | | |
| |||
1154 | 1112 | | |
1155 | 1113 | | |
1156 | 1114 | | |
1157 | | - | |
| 1115 | + | |
1158 | 1116 | | |
1159 | 1117 | | |
1160 | 1118 | | |
1161 | 1119 | | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
1162 | 1170 | | |
1163 | 1171 | | |
1164 | 1172 | | |
| |||
0 commit comments