-
Notifications
You must be signed in to change notification settings - Fork 24
feat(sdk): adds configurable max manifest sizes #2906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sdk): adds configurable max manifest sizes #2906
Conversation
Add tests to TDFSuite to verify manifest loading with max size constraints. Covers scenarios for manifests just below and above the allowed size limit.
Summary of ChangesHello @imdominicreed, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request implements a new feature in the TDF SDK that allows for the configuration of a maximum manifest size when loading TDF files. This enhancement provides greater control over resource consumption and helps prevent potential issues that could arise from processing unusually large or malformed manifests, thereby improving the robustness and security of the SDK. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Manifests now capped, Size controlled, no overflow, Code runs safe and sound. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a configurable maximum manifest size for TDF files, which is a valuable feature for handling large manifests. The implementation using the functional options pattern is well-done. However, I've found a couple of issues: a misleading error message due to a copy-paste error, and a new test case that is fundamentally flawed in its approach. My review includes suggestions to correct these issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for configurable maximum manifest sizes in TDF decryption, allowing users to decrypt large TDFs with manifests exceeding the previous hard-coded 10 MB limit. The implementation introduces a new WithMaxManifestSize option that can be passed to LoadTDF, which propagates the size limit through the configuration layers to the archive reader.
Key changes:
- Added
WithMaxManifestSize()option function for TDF reader configuration - Refactored
LoadTDF()to initialize configuration before creating the TDF reader to pass the max size parameter - Updated the internal archive reader to accept configurable manifest size limits via options pattern
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| sdk/tdf_config.go | Adds defaultMaxManifestSize constant (10 MB), maxManifestSize field to TDFReaderConfig, and WithMaxManifestSize() option function for configuring the limit |
| sdk/tdf.go | Refactors LoadTDF() to initialize TDFReaderConfig earlier so the max manifest size can be passed to archive.NewTDFReader() |
| sdk/internal/archive/tdf3_reader.go | Adds manifestMaxSize field to TDFReader struct, WithTDFManifestMaxSize() option function, and updates NewTDFReader() to accept options |
| sdk/tdf_test.go | Adds Test_LargeManifest_WithMaxManifest() to verify that manifests below the limit load successfully and manifests above the limit are rejected |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Proposed Changes
Checklist
Testing Instructions