Skip to content

verifier_tools/verify: Add cache for tree leaf download.#6

Merged
billy-lau merged 1 commit into
android:mainfrom
billy-lau:main
Jun 12, 2026
Merged

verifier_tools/verify: Add cache for tree leaf download.#6
billy-lau merged 1 commit into
android:mainfrom
billy-lau:main

Conversation

@billy-lau

Copy link
Copy Markdown
Member

This change vastly improves execution time and bandwidth consumption when performing inclusion proof test repeatedly, especially when doing that against hundreds of apps at a time.

verifier.go:

  • removed a superfluous trailing forward slash char in log base url.
  • now calls the revised BinaryInfosIndex function.

reader.go:

  • modified the BinaryInfosIndex function to take the size of tree as parameter, and reads from cache instead of directly downloading from URL.
  • introduced a readCachedInfoFile function that tries to read from temp local storage for existing content before downloading from URL.
    • the freshness of the cached content is checked against the log checkpoint, which is always downloaded per call.

Change-Id: Ia3a8e790e26ff352635215fd257447f9263f3437

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 local caching mechanism for binary info files in the transparency log verifier to avoid redundant downloads. It updates BinaryInfosIndex to accept a treeSize parameter and cache files locally using the user's cache directory. The review feedback highlights a potential path traversal vulnerability where binaryInfoFilename is used directly in the cache path construction, recommending sanitization with filepath.Base. Additionally, the reviewer notes issues with the cleanup logic, specifically glob pattern injection and aggressive cache invalidation that could disrupt concurrent runs, suggesting a safer directory-reading approach with age-based deletion thresholds.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread verifier_tools/verify/internal/tiles/reader.go
Comment thread verifier_tools/verify/internal/tiles/reader.go Outdated
This change vastly improves execution time and bandwidth
consumption when performing inclusion proof test repeatedly,
especially when doing that against hundreds of apps at a time.

verifier.go:
- removed a superfluous trailing forward slash char in log base url.
- now calls the revised `BinaryInfosIndex` function.

reader.go:
- modified the `BinaryInfosIndex` function to take the size of tree
  as parameter, and reads from cache instead of directly downloading
  from URL.
- introduced a `readCachedInfoFile` function that tries to read from
  temp local storage for existing content before downloading from URL.
  - the freshness of the cached content is checked against the log
    checkpoint, which is always downloaded per call.

Change-Id: Ia3a9e790e26ff352635215fd257447f927d7fd24
@billy-lau billy-lau merged commit 0838ae6 into android:main Jun 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant