Commit 9029add
committed
backup: reject truncated DynamoDB keys (PR #716, round 3)
Two Codex P2 strict-validation follow-ups.
#117 -- empty table-meta segment.
HandleTableMeta accepted `!ddb|meta|table|` (no encoded segment)
because base64.RawURLEncoding.DecodeString("") returns empty bytes
without error, so the schema would route under the empty table
name. Now rejected with ErrDDBMalformedKey before the JSON decode.
TestDDB_RejectsTableMetaKeyWithEmptySegment.
#303 -- truncated item key.
parseDDBItemKey accepted `!ddb|item|<table>|7|` (gen separator
present, no primary-key payload). The gen-end check was
"genEnd > 0" which a trailing `|` satisfies. Added a follow-up
check that genEnd+1 != len(afterTable) so a payload-less key
surfaces as ErrDDBMalformedKey rather than emit under value-side
attributes only. TestDDB_RejectsItemKeyWithEmptyPrimaryKeyPayload.1 parent 305b14f commit 9029add
2 files changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
116 | 123 | | |
117 | 124 | | |
118 | 125 | | |
| |||
305 | 312 | | |
306 | 313 | | |
307 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
308 | 325 | | |
309 | 326 | | |
310 | 327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
493 | 517 | | |
494 | 518 | | |
495 | 519 | | |
| |||
0 commit comments