Skip to content

fix(deps): libz-sys 1.1.33 and chrono → jiff (RUSTSEC-2026-0544, -0543) - #1201

Merged
hyperpolymath merged 2 commits into
mainfrom
claude/rustsec-libz-jiff
Nov 17, 2026
Merged

hyperpolymath merged 2 commits into
mainfrom
claude/rustsec-libz-jiff

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What

  • RUSTSEC-2026-0544 (vulnerability). libz-sys 1.1.31 → 1.1.33, via cargo update -p libz-sys, which locks one package. zlib 1.3.1.2–1.3.2 overflow the heap in gz_vacate(). The workspace reaches it through git2 → libgit2-sys.

  • RUSTSEC-2026-0543 (unmaintained). chrono → jiff in all four crates (cli, data, adapters, integration). The owner ruled on 2026-11-17 to migrate rather than ignore the advisory.

    chrono jiff
    DateTime<Utc> Timestamp
    Utc::now() Timestamp::now()
    .to_rfc3339() .to_string()
    .timestamp() .as_second()
    Duration::days(n) SignedDuration::from_hours(24 * n)
    DateTime::from_timestamp(s, 0) Timestamp::from_second(s)
    DateTime::<Utc>::from(SystemTime) Timestamp::try_from(...).ok()
    .format(...) .strftime(...)

    Timestamp - Timestamp is a calendar Span in jiff, so the two duration() helpers and the parallelism assertion now use duration_since, which returns a SignedDuration.

  • New adapters/tests/timestamp_wire_tests.rs. It pins the shapes the forge adapters deserialise:

    • Z, +00:00, milliseconds, microseconds and a non-UTC offset all parse to the same instant;
    • a naive time is refused, as chrono refused it;
    • RFC 3339 round-trips;
    • the epoch conversion radicle.rs uses gives the same result.
  • Docs. The dependency table in docs/api/rust-api.adoc and the code samples in docs/integration/github-registry.adoc now name jiff.

Why

cargo-deny started failing on main and on every PR as soon as these advisories were published (e.g. #1198's Rust License & Ban Check). chrono has no safe upgrade.

Evidence

  • cargo-deny 0.21.0, with the repo's deny.toml (the same config CI uses):
    • on main: advisories FAILED, with error[unmaintained] RUSTSEC-2026-0543 and error[vulnerability] RUSTSEC-2026-0544;
    • on this branch: advisories ok, bans ok, licenses ok, sources ok.
  • ci.yml's commands, all --locked, all pass: cargo check --workspace --all-targets, cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace --all-targets (every suite ok, including the 4 new wire tests) and cargo test --workspace --doc.
  • The epoch value in the test is checked independently: date -u -d @1794935190 gives 2026-11-17T17:06:30Z.
  • No user-visible format change. No Timestamp is printed with Display; I checked every field of type Timestamp and the only other use is a sort_by_key, where the ordering is the same.
  • Serialised JSON still parses, but its fractional seconds may print differently. chrono printed 0, 3, 6 or 9 digits after the decimal point; jiff prints only as many as needed. Both are valid RFC 3339.
  • chrono is still listed in Cargo.lock, but only as serde_with's optional dependency, which isn't enabled (testcontainers takes serde_with's default features). cargo tree -i chrono --target all prints nothing, and cargo-deny doesn't count it.
  • AsciiDoc: rust-api.adoc builds clean. github-registry.adoc has the same 2 warnings as on main (a section level at line 1288, and the optional rouge gem).

Not done

  • No live forge API was called. The wire test covers the documented shapes.

Generated by Claude Code

Two RustSec advisories published 2026-11-17 turned cargo-deny red on main
and every PR:

* RUSTSEC-2026-0544 (vulnerability): zlib 1.3.1.2-1.3.2 overflow the heap
  in gz_vacate(). libz-sys reaches the workspace through git2 ->
  libgit2-sys. `cargo update -p libz-sys` moves 1.1.31 -> 1.1.33.
* RUSTSEC-2026-0543 (unmaintained): chrono, all versions, no safe upgrade.
  Owner ruling 2026-11-17: migrate rather than ignore. jiff replaces it in
  all four crates: DateTime<Utc> -> Timestamp, Utc::now -> Timestamp::now,
  to_rfc3339 -> to_string, timestamp() -> as_second(), Duration::days(n) ->
  SignedDuration::from_hours(24 * n), and Timestamp - Timestamp (a calendar
  Span in jiff) -> duration_since. No timestamp is printed with Display, so
  no user-visible format changes; chrono stays in Cargo.lock only as
  serde_with's optional, inactive dependency, which cargo-deny does not
  count.

adapters/tests/timestamp_wire_tests.rs pins the forge shapes the adapters
deserialise (Z, +00:00, millis, micros, a non-UTC offset), the refusal of a
naive time, the RFC 3339 round trip, and the epoch conversion radicle.rs
uses.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01J4QvDfvetbJ5z7uREtbJWw
@hyperpolymath
hyperpolymath marked this pull request as ready for review November 17, 2026 17:20
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 6aaea461-33db-4234-882f-3d86f1978a4e
Commits

Reviewing files that changed from the base of the PR and between 49d5e45 and eb44190.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 30

  • Cargo.toml
  • adapters/Cargo.toml
  • adapters/src/bitbucket.rs
  • adapters/src/codeberg.rs
  • adapters/src/forge.rs
  • adapters/src/github.rs
  • adapters/src/gitlab.rs
  • adapters/src/radicle.rs
  • adapters/src/sourcehut.rs
  • adapters/tests/timestamp_wire_tests.rs
  • cli/Cargo.toml
  • cli/src/commands/batch.rs
  • cli/src/commands/deposit.rs
  • cli/src/commands/fleet.rs
  • cli/src/commands/hooks.rs
  • cli/src/commands/scan.rs
  • cli/src/commands/search.rs
  • cli/src/commands/withdraw.rs
  • data/Cargo.toml
  • data/src/cache.rs
  • data/src/dragonfly.rs
  • docs/api/rust-api.adoc
  • docs/integration/github-registry.adoc
  • integration/Cargo.toml
  • integration/src/ci_simulation/assertions.rs
  • integration/src/ci_simulation/mod.rs
  • integration/src/ci_simulation/scenarios.rs
  • integration/tests/arangodb_test.rs
  • integration/tests/fleet_test.rs
  • integration/tests/registry_test.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copy link
Copy Markdown
Owner Author

SonarCloud Quality Gate (20.4% duplication on new code): this PR does not cause it, and I'm leaving it as is.

The duplicated blocks were already on main. Sonar's duplications API for this PR names two places:

  • integration/src/ci_simulation/mod.rs: the three simulator impls are copies of each other (blocks of 150 to 260 lines at about lines 1117, 1414 and 1706).
  • cli/src/commands/search.rs: the mock SearchResultItem literals at lines 323 to 495.

This PR changes one line inside each copy (Utc::now() → Timestamp::now(), Duration → SignedDuration). Because of that, Sonar counts the whole copied block as new code. That gives 60 of the 294 new lines.

Removing the duplication means merging the three simulators into one generic impl. That refactor is unrelated to the RustSec fix, so it doesn't belong here. The gate is also ERROR on main today (5.1% duplication overall).

The checks this PR exists for now pass: Rust License & Ban Check succeeds on 9804bd4.


Generated by Claude Code

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
20.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@hyperpolymath
hyperpolymath merged commit 0a258da into main Nov 17, 2026
98 of 99 checks passed
@hyperpolymath
hyperpolymath deleted the claude/rustsec-libz-jiff branch November 17, 2026 18:42
hyperpolymath pushed a commit that referenced this pull request Nov 17, 2026
…iew tier opens nothing

- A grid lane is now a `uses:` value ending in /hypatia-scan-reusable.yml.
  A line such as `- uses: actions/checkout@v4 # hypatia-scan-reusable.yml`
  matched before, so a repository with no grid lane was flagged. Two
  regression tests: the name in an inline comment is not a lane; a quoted
  value is.
- README: the review tier is queued in gitbot-fleet, and no step opens a PR
  from it; dispatch-runner.sh and live issue publication are quarantined
  (gitbot-fleet docs/AUTOMATION-QUARANTINE.adoc).
- CLAUDE.md data flow: process-review-findings.sh's live publication is
  quarantined too.

mix test: 3601 tests, 0 failures. Also merges main (RUSTSEC fixes #1201).

Claude-Session: https://claude.ai/code/session_01J4QvDjqj5DHRRCrDiGeTmq
Co-Authored-By: Claude <[email protected]>
hyperpolymath added a commit that referenced this pull request Nov 18, 2026
… fits an exponent (#1205)

## What

**1. `integration/src/ci_simulation/mod.rs`: one lifecycle instead of
three copies** (2086 → about 1690 lines)
- `MockGitHubActions`, `MockGitLabCI` and `MockCircleCI` each carried a
~260-line copy of the whole `SimulatedCI` lifecycle.
- That lifecycle is now written once, as `impl<P: SimProvider>
SimulatedCI for P`, over a shared `SimBuildStore`.
- Each provider supplies only `kind()`, `store()` and `initial_jobs()`.
- **Behaviour change (owner ruling: one strict core).** The copies had
drifted. GitLab and CircleCI:
  - let a completed build be cancelled;
  - concluded `Success` even after a failed job;
  - ignored job `needs`;
  - reported `critical_findings = 0`.

All three providers now follow the strict lifecycle GitHub already had.
Each provider's job layout is unchanged.
- **Also fixed (aa09a2e, found by CodeRabbit, the same line is on
`main`).** A workflow job's `needs` held job ids (`"build"`), but
`advance_build` checks them against job names (`"Build"`). So the
default workflow's `Test` job never started.

**2. `test/kyaml_complexity_test.exs`: the KYAML linear-time test**
- **Before:** `t(20k)/t(5k) < 10` in an async module. On #1198 it
measured 11.4 for the current, linear parser.
- **Now:** a synchronous module fits the exponent `k` in `t ∝ n^k` by
least squares over 2,500, 5,000, 10,000 and 20,000 entries. Each size
takes the best of five runs, each in a fresh process. It asserts `k <
1.4`.
- A fourth test checks the fit itself on exact power laws.
- The old test is removed from `test/kyaml_test.exs`.

## Why

- **Simulator:** SonarCloud failed its duplication gate on every PR that
touched the three copies (20.4% on #1201), and the copies had already
diverged into bugs.
- **KYAML:** the two-point wall-clock ratio is noisy enough to fail on a
loaded runner.

## Evidence

**Simulator**
- **ci.yml's Rust commands pass on the workspace:**
  - `cargo check --all-targets --locked`;
  - `cargo fmt --check`;
  - `cargo clippy --all-targets -D warnings`;
  - `cargo test --all-targets`: every test binary ok;
  - `cargo test --doc`.
- **Four new tests run each lifecycle rule against all three
providers.** As a negative control I appended them to `main`'s `mod.rs`.
Three fail there for GitLab CI:
  - cancel returns `Ok(())`;
  - the conclusion is `Some(Success)`;
  - `critical_findings` is `0`.

  The job-layout test passes on both versions.
- **`the_default_workflow_advances_to_completion_through_its_needs`**
fails without aa09a2e. The jobs stop at `[("Build", Completed), ("Test",
Queued)]`.
- **SonarCloud:** quality gate passes, 0.0% duplication on new code.

**KYAML exponent, five fits per shape, measured locally**

| shape | current parser | pre-fix parser (6a3407a) |
|---|---|---|
| map | 1.00 to 1.15 | 1.74 to 1.88 |
| seq | 0.99 to 1.16 | 1.87 to 2.02 |
| flow | 0.98 to 1.04 | 1.56 to 1.69 |

- **Under load:** with one CPU-bound process per scheduler, the current
parser's map shape fits **0.98 and 1.01**. Those two fits completed; the
run hit its 25-minute timeout before the others.
- **Reductions were tried and rejected.** The pre-fix map shape fits
1.06 on reductions, because its quadratic copying ran in BIFs, so a
reductions test would let that regression through.
- **Elixir suite:** `mix test` gives 3709 tests, 0 failures, 3 skipped
(246 excluded). It ran while another VM was saturating every scheduler.
- `mix compile --warnings-as-errors` and `mix format --check-formatted`
are clean.
- The self-scan reports 0 findings on the changed files.

## Not done

- **`governance / Validate Hypatia Baseline` fails, but this PR doesn't
cause it.** It is red on `main` since #1204 (RE011). See the comment on
this PR for the three ways to fix it.
- The `generate_mock_results()` duplication in
`cli/src/commands/search.rs`. It's mock search data, not the CI
simulator, so I left it for its own change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01J4QvDfvetbJ5z7uREtbJWw

---------

Co-authored-by: Claude <[email protected]>
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.

3 participants