Repository navigation
fix(sdk): reject non-positive segment sizes in writeStream (DSPX-4496) - #1059
Conversation
`client.encrypt` forwards `windowSize` to the writer unchecked, and its destructuring default only fires on `undefined`. A zero window spun forever in the segmentation loop; a fractional or negative one wrote a manifest whose segment sizes no reader can follow. Fail fast with a ConfigurationError. Also give InvalidFileError its own `name`, like its sibling error classes, so it no longer reports itself as a TdfError. Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe changes set the ChangesInvalid file error name
Segment size validation
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change rejects invalid segment sizes, and no issue requiring a fix before merge was identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks the segment size, Comment |
|



What
writeStreamnow rejects a segment size that isn't a positive integer, throwing aConfigurationError.InvalidFileErrorgets its ownname, like its sibling error classes. It used to report itself asTdfError.Why
client.encryptpasseswindowSizestraight to the writer, and its destructuring default only applies when the value isundefined.windowSize: 0made the segmentation loop spin forever, because it never collects enough bytes to emit a zero-length segment.How to test
cd lib && npm test. The new test "rejects a zero window size instead of hanging" fails onmainby timing out.Risk
Low. Valid segment sizes behave exactly as before.
DSPX-4496 series
mainmainmainmainAesGcmEncryptorSPIDSPX-4496-encrypted-segment-sizeDSPX-4496-aes-gcm-encryptor#1059, #1060 and #1062 stand alone. #1061 ← #1063 ← #1018 is a stack.
Summary by CodeRabbit