Skip to content

flags(bash): files over 4 MB are dropped from --flags without disclosure #699

Open

Description

@jflowers

--flags drops a file larger than kMaxFlagFileBytes (4 MB) without saying so anywhere in the answer. readWhole returns ReadWholeFail::TooLarge, but the scan lambda discloses only Unreadable, then returns without harvesting the file. The root counts (gates=, env=, files=) look complete even though gates are missing. That breaks the "every truncation is disclosed / a count that cannot be a total is a floor" rule.

Repro (not yet run on a main build): a directory with big.sh = : "$RW_BIG_TOKEN" followed by more than 4 MB of comment padding, run with ripwire <dir> --flags. Expected: a distinct oversize disclosure (not counted in unreadable=), with the affected counts labelled as floors. Today the file's gate silently disappears.

The behavior predates #685 (#688 calls it pre-existing). It was raised by CodeRabbit on #685 (thread) and deferred when #685 landed through #688.

Activity

  1. joyful-ii-V-I commented on Nov 19, 2026

    @joyful-ii-V-I
    Collaborator

    I think the 4 MB is small for a runaway safety check, what is a better limit, 32 MB? what is a large code file? also should be disclosed in unreadable

  2. joyful-ii-V-I commented on Nov 22, 2026

    @joyful-ii-V-I
    Collaborator

    Fixed in #720 (open; it closes this issue when it merges). Reported by jflowers; thanks for the precise trace.

    • kMaxFlagFileBytes is now 64 MiB (it was 4 MB). It is a runaway guard. GitHub warns at 50 MB and refuses 100 MB.
    • A file too big to read is now disclosed on the --flags root, in the legend, in --json and in --help, never dropped silently. oversize=N counts it, and oversize_limit=B names the smallest ceiling that dropped one. The other root counts then read as floors, and files= does not include the file. The count covers both places a file can be dropped:
      • the crawl's own size ceiling (--max-file-size, default 4 MB; --skipped lists each file). This is the path your repro actually takes: on main the 5 MB big.sh never reached --flags at all (files="0").
      • the --flags read cap itself, for example a 64 MiB+1 .cmake file, or a file grown past the cap with --max-file-size raised.
    • JSON over the crawl's 256 KB JSON data ceiling is not counted. A .json file holds no #if, option() or env read.
    • Example (a 5 MB big.sh beside a small script): <flags gates="1" ... files="1" oversize="1" oversize_limit="4194304">.
    • oversize_limit= rather than limit=: limit= already means the paging cap on every root.
    • The crawl's 4 MB default is unchanged.
    • Gate: test/bashenvcheck.sh arm 15, using generated fixtures (no large file is committed). It is red on main e267e24 and green on the lane.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions