Skip to content

Conversation

@imdominicreed
Copy link
Contributor

@imdominicreed imdominicreed commented Nov 13, 2025

Proposed Changes

  • Allows configurable max manifest size so large TDFs can be decrypted.

Checklist

  • I have added or updated unit tests
  • I have added or updated integration tests (if appropriate)
  • I have added or updated documentation

Testing Instructions

Add tests to TDFSuite to verify manifest loading with max size constraints.
Covers scenarios for manifests just below and above the allowed size limit.
@imdominicreed imdominicreed requested review from a team as code owners November 13, 2025 22:55
@github-actions github-actions bot added comp:sdk A software development kit, including library, for client applications and inter-service communicati size/s labels Nov 13, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Configurable Manifest Size: Introduced a new "manifestMaxSize" field in the "TDFReader" struct, allowing the maximum size of a TDF manifest to be configured.
  • New Configuration Options: Added "WithTDFManifestMaxSize" for "archive.NewTDFReader" and "WithMaxManifestSize" for "TDFReaderConfig" to enable setting the manifest size limit.
  • Default Manifest Size: A default maximum manifest size of 10MB is now applied when creating a "TDFReaderConfig".
  • Integration with SDK: The "SDK.LoadTDF" method now utilizes the configurable manifest size when loading TDF files.
  • New Test Cases: Comprehensive unit tests have been added to verify the correct behavior of the manifest size limits, including scenarios where manifests are just below or above the configured maximum.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

pflynn-virtru
pflynn-virtru previously approved these changes Nov 14, 2025
Copy link
Contributor

Copilot AI left a 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.

@imdominicreed imdominicreed added this pull request to the merge queue Nov 19, 2025
Merged via the queue into opentdf:main with commit e418a4b Nov 19, 2025
39 checks passed
@imdominicreed imdominicreed deleted the feat/manifest-size branch November 19, 2025 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:sdk A software development kit, including library, for client applications and inter-service communicati size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants