GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing github.com — Read Maven checksums.sha256 one way and never drop user lines by mikolalysenko · Pull Request #2016 · SocketDev/socket-patch Conversation
|
| Site | Uses |
|---|---|
| Hosted merge and drop | edit. A file is written only when its text changes. A grant hash that isn't 64 hex digits writes no checksum line and warns redirect_maven_trusted_checksums_invalid_hash; the -socket version pin still lands. |
| Hosted unenforced-pin warning | config_enforces + pinned + the wrapper rule |
| Discovery | enforced + pinned. VEX attests integrity only when Maven checks it, and hosted's judgment and discovery's now match. |
| Unwind | edit. The "resolver lines left" warning uses config_has_written_settings (presence). |
Golden change: in redirect-maven.json, mvn-config-merge/expected goes from locked_integrity: Sha256Hex(ccc…) to null. That fixture keeps the user's originAware=true, under which Maven reads checksums-<repoId>.sha256, not this file, so the old attestation was false.
/code-review high)Each finding was confirmed with a failing test on the previous head (26d9d3b) before it was fixed.
-Dk=v token inside a longer line no longer counts. Only whole-line arguments do.config_enforces now checks all five settings Maven reads the file by, not just the switch. failIfMissing doesn't decide whether a committed line is checked, so it isn't required. The unwind keeps presence semantics on purpose: its warning is about leftover lines hosted mode may have written, and a partial or switched-off set is still worth removing.restore_mvn no longer returns early. Grant hashes are validated when written.maven_reads = false and doesn't attest.TRUSTED_CHECKSUMS_ON is gone. CONFIG_ARGS and the keys share one literal per prefix.edit writes into one buffer, with no per-line format!. It still scans once for which owned paths are present before writing. A true single pass can't know whether an owned path appears later without moving that line, and moving it would churn a file the user ordered. The scan is one cheap parse of a tens-of-lines file.maven_checksums_merge_keeps_every_user_line: fails before the first commit, passes after. User lines in single-space, *, tab, comment and stray-text form survive a pin and a re-pin.maven_checksums_owned_lines_go_whatever_their_hash: hosted re-pin with stale hashes, and refusal of an invalid grant hash.checksums_unwind_drops_owned_lines_whatever_their_hash and checksums_unwind_reads_every_spelling_and_keeps_crlf: the unwind.checksums_attest_only_what_maven_enforces: discovery across config, wrapper and spelling cases.formats::maven::trusted_checksums (12 tests).every_fail_closed_rewriter_fixture_yields_the_patch_uuid_not_the_token now expects no integrity for mvn-config-merge, for the originAware=true reason above.cargo test -p socket-patch-core --lib -- formats::maven vex::discover:: patch::redirect:: vendor::jvm::: 1591 passed, golden included. socket-patch-cli e2e_vex_lockfile + in_process_get_hosted_ecosystems filtered to maven: 20 passed.cargo clippy --locked --workspace --all-features -- -D warnings and cargo fmt --all -- --check are clean.maven.config (merge_mvn_config) is unchanged.SHA256 (path) = hash lines are not interpreted. They are kept verbatim.basedir spelled differently from what hosted writes (for example an absolute path to the same directory) counts as not enforced. That errs toward claiming less./code-review high on ec69ff3, cloud routine)Fixed in a53a056. Each test below failed on ec69ff3.
maven_checksums_owned_lines_go_whatever_their_hash (extended).maven.config its own way: confirmed and fixed. merge_mvn_config keyed settings by the raw line[..=eq] prefix. A user's indented, --define k=v, --define=k=v or quoted setting wasn't seen, so hosted appended its own line, and that later line won. The user's value was silently overridden, against the documented contract. The writer now uses maven_config_line_properties, discovery's reader. Test: maven_config_conflict_in_any_spelling_keeps_the_user_value.config_has_written_settings is presence-based again (maven_config_properties, which also sees a -Dk=v token joined onto a longer line). This matches round 1's "the unwind keeps presence semantics". Test: config_enforces_needs_every_setting_maven_reads_the_file_by (the assertion is flipped).docs/ecosystems.md now describe the five-setting and wrapper rule and the redirect_maven_trusted_checksums_invalid_hash warning.Declined:
basedir spellings (${maven.multiModuleProjectDirectory}/..., trailing /). These still count as not enforced. That errs toward claiming less (owner decision 4), as the "Not done" section already says.maven.config read twice in discovery, and the trusted_checksums fn/module name clash. Both are minor and left as is.Tests (cloud run): cargo test -p socket-patch-core --lib -- formats::maven vex::discover:: patch::redirect:: vendor::jvm:: gives 1591 passed. The one failure, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, fails only because the container runs as root, where chmod 0555 doesn't block. CLI e2e_vex_lockfile and in_process_get_hosted_ecosystems filtered to maven pass. clippy and fmt are clean.
Note
Medium Risk
Touches hosted Maven wiring, rollback/unwind, and VEX attestation for checksum pins; behavior is more conservative (fewer false attestations) but changes long-standing merge semantics.
Overview
Hosted Maven used to merge .mvn/checksums/checksums.sha256 by splitting on two spaces, re-sorting, and dropping lines it could not parse (single-space/sha256sum-style lines, comments, CRLF quirks). That logic lived separately from discovery, unwind, and the “unenforced pin” warning, so the same file was judged inconsistently.
This PR adds formats::maven::trusted_checksums, a pure module shared by the hosted rewriter, rollback/unwind, and VEX discovery. It tolerantly parses user lines but only treats exact <64 lowercase hex> <path> entries as Maven-enforced pins; edit rewrites owned paths in canonical form, drops superseded pins, inserts with the file’s dominant line ending, and keeps every other line byte-for-byte. config_enforces / enforced align on Maven 3.9+ whole-line maven.config arguments (via new maven_config_line_properties) plus wrapper ≥ 3.9.4.
Behavior changes: invalid grant SHA-256 (not 64 hex) skips checksum lines with redirect_maven_trusted_checksums_invalid_hash (version suffix still applies); VEX no longer attests checksum integrity when config/wrapper/spelling means Maven would not enforce (e.g. mvn-config-merge with originAware=true → locked_integrity: null in golden).
Reviewed by Cursor Bugbot for commit ec69ff3. Configure here.
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The hosted Maven merge re-parsed .mvn/checksums/checksums.sha256 on a two-space separator, rebuilt the file from that map and silently dropped every line it could not split that way: a user's single-space or `*` (binary marker) sha256sum line, a tab-separated line, a comment, any stray text. It also normalized a CRLF file to LF and re-sorted it. The file and the maven.config switch were read four different ways (discovery, the hosted merge, its drop filter, the unenforced-pin warning) plus a fifth in the upstream unwind. They now share one pure reader in formats::maven::trusted_checksums: - parse_line / entries: tolerant read of what sha256sum-style tools emit (any run of spaces/tabs, an optional `*`, CRLF, surrounding blanks; a 64-digit hex hash). Each entry records whether it is in the exact `<hash> <path>` shape maven-resolver's own reader honours. - pinned: path -> hash of the lines Maven enforces, a later line winning (as in SummaryFileTrustedChecksumsSource). - edit: rewrites owned paths in place, drops named paths, inserts new entries in sorted position (else appends) with the file's own line ending, and keeps every other line byte for byte. - switch_on: the trusted-checksums switch rule, decided once: read maven.config with the existing shared maven_config_properties reader (one argument per line, `#` comments, -Dk / --define, later wins) and judge the value as the resolver does (Boolean.parseBoolean). Discovery, the hosted merge/drop/warning and the unwind all use it. Discovery now attests integrity only from lines Maven itself enforces; a tolerated spelling is recognised (and replaced or dropped when it names a path hosted owns) but pins nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
bugbot run Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Labeled Ready for review (burn-down agent).
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Review fixes on the shared trusted_checksums reader: - The enforcement rule (config_enforces) now needs every setting Maven reads .mvn/checksums/checksums.sha256 by, with the resolver's defaults: the post-processor on, checksumAlgorithms naming SHA-256, the summary-file source on, its basedir at .mvn/checksums and originAware off. Settings are whole-line arguments only (Maven 3.9+, the only line that enforces), never a -Dk=v token inside a longer line; the per-line reading is split out of maven_config_properties as maven_config_line_properties. - enforced() adds the wrapper rule the hosted rewriter already warned on (an Apache Maven < 3.9.4 ignores the files). Discovery attests only through it, so VEX never claims integrity Maven does not check: the mvn-config-merge fixture keeps the user's originAware=true and its golden loses its integrity. - An uppercase-hex line no longer counts as read by Maven (it compares to its own lowercase digest). - Lines for a path hosted mode owns are recognised whatever their hash, so a stale SRI or truncated line is replaced, dropped on re-pin and dropped by the unwind; a grant hash that is not 64 hex digits writes no checksum line (redirect_maven_trusted_checksums_invalid_hash). - edit collapses an owned path to one line, inserts ahead of the comment block directly above the line it lands before, and inserts with the file's dominant line ending; it writes into one buffer. - The written maven.config args and the keys read come from one literal per settings prefix (CONFIG_ARGS, re-exported as MVN_CONFIG_ARGS). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Final review brief (for the human approver)What it does: adds one pure module, Risk: low to medium. The logic is pure, unit-tested and idempotent. VEX output changes on purpose: integrity is no longer attested for Look here
Verified
Changes I made: none. Open questions (nits, none blocking)
Auto-merge is not armed yet because Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
bugbot run Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ec69ff3. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ready for review re-confirmed at the new head (burn-down agent).
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Second review round on the Trusted Checksums change. - The hosted writer (`merge_mvn_config`) still keyed settings by the raw `line[..=eq]` prefix, so a user's indented, `--define k=v` or quoted setting was not seen, hosted appended its own line after it, and that later line won, silently overriding the user's value. It now reads the file with `maven_config_line_properties`, the reader discovery judges enforcement with, and reports such a setting as `redirect_maven_trusted_checksums_conflict`. - A grant whose sha256 is not 64 hex digits writes no checksum line, but a line an earlier release wrote for the same suffixed version (its hash mangled) stayed, and Maven fails the build on a mismatched line. Those paths are now dropped, on a fresh pin and on a re-run alike. - The rollback's leftover-settings warning keys on presence again (`maven_config_properties`, which also sees a `-Dk=v` token joined onto a longer line), not on Maven 3.9's enforcement reading. - The discovery module doc and docs/ecosystems.md describe the stricter attestation rule and the invalid-hash warning. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was an error while loading. Please reload this page.
Conflicts with #2011 (Go workspace override) and #2016 (Maven checksums.sha256): - UnattestedKind / vex_sources notes / CLI_CONTRACT rows: keep both sides' kinds (MavenProfileUnpatched, MavenConfigOverride and GoWorkspaceOverride); the unattested-references bullet now counts seven cases. - discover/maven.rs trusted_checksums: keep this branch's read-once .mvn/maven.config text parameter, with main's enforced()/pinned() body that also reads the Maven Wrapper version. Co-Authored-By: Claude <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.