Commit b05ec87
committed
backup: PR810 r3 — codex r3 P1 (Windows reserved names via filepath.IsLocal)
Codex r3 P1: validateChecksumRelPath rejected `..`-traversal and
absolute paths but accepted Windows reserved device names like
CON / NUL / COM1 / CONOUT$. On Windows, os.Open of those names
yields the host's console / device rather than a regular file
under the dump root, so verification can succeed/fail based on
host device state instead of dump contents.
Fix: replace the explicit absolute/traversal checks with
filepath.IsLocal (Go 1.20+), which delegates path-locality to
the stdlib. On Windows IsLocal additionally rejects the
reserved device names; on Unix the names look like ordinary
files (and would be hashed if they exist under root, the
honest dump shape).
Empty / `.` are still explicitly rejected because IsLocal
considers `.` local (it stays within the subtree, but it
names the root directory, which is not a hashable regular
file). The post-Clean recheck below IsLocal is belt-and-braces
against a future stdlib change.
Tests:
- TestValidateChecksumRelPath_RejectsWindowsDeviceNames pins
the rejection. The reserved-name check is Windows-only by
filepath.IsLocal's contract, so the test skips on non-Windows;
the lexical fix itself runs on every platform.
- TestValidateChecksumRelPath_AcceptsHonestPaths cross-checks
the IsLocal switchover does not regress the five legitimate
Phase 0a dump-tree shapes (Redis blob, S3 nested object,
DynamoDB schema, SQS messages.jsonl).
Caller audit (CLAUDE.md "semantic-change → grep all callers"):
- validateChecksumRelPath only called from
verifyOneChecksumLine → VerifyChecksums; the latter has no
production callers (test-only). The semantic change is
purely rejection-side tightening on Windows; honest CHECKSUMS
unaffected.
Self-review:
1. Data loss — none (read-side hardening).
2. Concurrency — none.
3. Performance — IsLocal is O(path-len); a single pass.
4. Data consistency — Windows device-name escape closed.
5. Test coverage — two new tests; existing five-shape
traversal-path table test still passes.1 parent 2bb8cd7 commit b05ec87
2 files changed
Lines changed: 94 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
263 | 267 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
271 | 276 | | |
272 | | - | |
273 | | - | |
274 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
275 | 286 | | |
276 | 287 | | |
277 | 288 | | |
278 | 289 | | |
279 | | - | |
280 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
281 | 293 | | |
282 | 294 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
287 | 299 | | |
288 | | - | |
| 300 | + | |
289 | 301 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | 302 | | |
296 | 303 | | |
297 | 304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
247 | 311 | | |
248 | 312 | | |
249 | 313 | | |
| |||
0 commit comments