Repository navigation
Remove per-allocation limits and apply repository trust policies - #3245
Draft
Sebastian Thiel (Byron) wants to merge 2 commits into
Draft
Sebastian Thiel (Byron) wants to merge 2 commits into
Sebastian Thiel (Byron) wants to merge 2 commits into
Conversation
Sebastian Thiel (Byron)
force-pushed
the
rust-1.100-alloc
branch
from
November 25, 2026 13:06
cc285bc to
b43b0c8
Compare
Byron needs services to process untrusted Git data without risking the server process. Per-allocation limits constrain individual buffers but cannot bound the memory retained across operations, caches, and workers. A rejecting allocator also makes existing infallible collection operations abort when a quota is exhausted. Use a separate process with OS resource limits for that containment guarantee instead. Remove `alloc_limit_bytes` from pack, index, object-database, commit-graph, and porcelain APIs, along with `gitoxide.objects.allocLimit`, `gitoxide.objects.allocLimitIfReducedTrust`, and `GIT_ALLOC_LIMIT`. Remove the reduced-trust fallback and the separate metadata-limit multiplier. Retain fallible reservations, checked sizes, and structural validation; keep allocation failures classified as resource exhaustion. The generic `gix-error` allocation-limit classification remains available to callers. Reject pack object counts that cannot fit into the data, bound speculative delta-tree capacity by the pack size, and reject impossible index-tree child counts before reserving. Update callers, fixtures, fuzz targets, and regression coverage. Document process isolation, worker concurrency, and execution-time limits in `SECURITY.md`. Replace the measuring-allocator experiment completely, including its Rust 1.100 requirement, dependencies, and associated adaptations. Validation: - `gix-pack`, `gix-index`, `gix-odb`, and `gix-commitgraph` test suites; pack tests also pass with parallel traversal enabled - Repository tests, configuration-tree tests, environment overrides, and configuration-cache tests; native FSEvents tests pass outside the sandbox - Workspace Clippy with all targets and warnings denied; formatting - Affected API documentation and standalone pack/index fuzz-target builds Related discussion: #3244 Follow-up CIFuzz validation: - Keep a 64 MiB decoding budget in the pack fuzz target so malformed entry headers cannot make the fuzzer request multi-gigabyte buffers. Rejecting the allocation is insufficient because libFuzzer reports sanitizer allocation failures before `try_reserve()` can return an error. - Replayed the CIFuzz out-of-memory artifact and ran the target under ASan for 30 seconds without failure. The pack fuzz regression tests pass.
Sebastian Thiel (Byron)
force-pushed
the
rust-1.100-alloc
branch
from
November 25, 2026 13:28
b43b0c8 to
330bf27
Compare
Applications need to reduce resource use and implicit allowances when opening repositories they do not fully trust. Provide an opening policy callback that can inspect the resolved configuration and final trust, including changes due to `safe.directory` and checkout ownership. Append the assignments as commented `Source::Api` entries after file, CLI, API, and environment configuration, before caching settings or creating the object database. Keep the callback in the opening options so reloads and related repository opens compute their own overrides. Leave the configuration as resolved for full trust. For reduced trust, disable object and delta caches, use one worker where configurable, and set conservative transport, replacement-ref, recursive fetch, and verification options. Some Git settings are recorded for future support. Callers can replace the default policy through the builder. Tests cover override precedence and provenance, late trust changes, reload and callback errors, and policy inheritance across worktrees. Validation: the full `gix` test suite, workspace Clippy with warnings as errors, formatting, and the minimal SHA-1 build passed.
Sebastian Thiel (Byron)
force-pushed
the
rust-1.100-alloc
branch
from
November 25, 2026 14:11
330bf27 to
721df42
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tasks
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Summary
Remove the per-allocation limits from pack, index, object database, and commit-graph operations. Remove
gitoxide.objects.allocLimit,gitoxide.objects.allocLimitIfReducedTrust, andGIT_ALLOC_LIMIT. Keep fallible reservations and reject impossible counts using the bytes available in packs and index extensions. The allocator experiment and its Rust 1.100 requirement are dropped.Add
gix::open::Options::config_overrides_by_trust()in a separate commit. The callback receives the resolved configuration and final repository trust. Its assignments are appended after file, CLI, API, and environment overrides, with comments that identify the opening policy. Reloads and related opens evaluate the policy for the repository being opened.The default policy adds no overrides for full trust. Reduced trust disables object and delta caches, sets pack, index, and checkout workers to one, and tightens selected transport, credential, replace-ref, and recursion settings. Explicit transport allowlists and per-submodule fetch settings retain their usual precedence. The policy also records Git verification settings for future support.
Context
Services handling untrusted Git data need to contain memory exhaustion without taking down the server process. Per-allocation caps can stop individual oversized buffers while still allowing memory to accumulate across workers and retained delta bases. The experimental allocator could also turn quota rejection in an infallible collection operation into a process abort. The library keeps the checks that can reject impossible sizes or report failed reservations as errors. Services that need an enforced memory boundary can use worker processes with OS resource limits, as described in
SECURITY.md.Related to #3244, which reports memory retained by pack delta traversal. This change removes the old allocation caps and documents the containment boundary. Aggregate retained-delta accounting is outside its scope.
Validation
gixtest suite, including policy precedence, final trust, reloads, and related opens.gixbuild.