Skip to content

chore: raise dependency floors to the patched versions - #3

Open
piscisaureus wants to merge 1 commit into
mainfrom
dependency-floors
Open

piscisaureus wants to merge 1 commit into
mainfrom
dependency-floors

Conversation

@piscisaureus

Copy link
Copy Markdown
Member

The previous update only moved Cargo.lock, which consumers of this crate
ignore; a downstream lockfile could keep the vulnerable versions while
still satisfying aws-sdk-s3 = "1" and friends. The direct floors now
require aws-sdk-s3 1.163 (which in turn requires the fixed
aws-smithy-json, lru and time), bytes 1.12.2, tokio 1.54 and rand 0.8.8.

The previous update only moved Cargo.lock, which consumers of this crate
ignore; a downstream lockfile could keep the vulnerable versions while
still satisfying `aws-sdk-s3 = "1"` and friends. The direct floors now
require aws-sdk-s3 1.163 (which in turn requires the fixed
aws-smithy-json, lru and time), bytes 1.12.2, tokio 1.54 and rand 0.8.8.

@avocet-bot avocet-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.

Review: chore: raise dependency floors to the patched versions

PR: #3
Reviewed head SHA: 48b9bd0ad0d1e9624a56961862107822cafc05dc
Verdict: Non-blocking comment — the change is a safe net improvement, but one of its five stated security goals (time) is not actually achieved and the commit message overstates the protection.


What this PR does (background for readers unfamiliar with the repo)

vnotify is a small Rust library crate ("efficiently monitor S3 changes without external dependencies"). It is consumed by other projects as a dependency.

A crate has two places where versions live:

  • Cargo.toml declares version requirements (floors) for direct dependencies, e.g. aws-sdk-s3 = "1". These requirements are what every downstream consumer inherits and must satisfy.
  • Cargo.lock records the exact versions resolved for one particular build. For a library crate, Cargo.lock is ignored by downstream consumers — Cargo re-resolves each consumer's own lockfile from the requirements in Cargo.toml.

That distinction is the entire point of this PR. A previous change bumped only Cargo.lock, which protects nobody downstream: a consumer could still resolve an old, vulnerable version of a transitive dependency as long as it satisfied the loose Cargo.toml floor ("1", "0.8", etc.). This PR raises the requirement floors in Cargo.toml so that the vulnerable versions no longer satisfy them:

aws-sdk-s3 = "1"      -> "1.163"
bytes      = "1"      -> "1.12.2"
rand       = "0.8"    -> "0.8.8"
tokio      = "1"      -> "1.54"

The rationale (commit message) is that aws-sdk-s3 = "1.163" transitively "requires the fixed aws-smithy-json, lru and time", while bytes, tokio, and rand are floored directly.


Verification approach

Because the whole PR is a claim about what downstream lockfiles are forced to resolve, Cargo.lock in this repo cannot prove it (it only shows this build's resolution, which is already fully patched). I reconstructed the forcing analysis from the crates.io sparse index and the OSV advisory database rather than trusting the commit message:

  • aws-sdk-s3 1.163.0 direct requirements (crates.io index): aws-sigv4 ^1.6.6, aws-smithy-types ^1.9.5, aws-smithy-json ^0.65.1, lru ^0.18.2. time is not a direct dependency of aws-sdk-s3.
  • aws-sigv4 1.6.6 requires time ^0.3.35; aws-smithy-types 1.9.5 requires time ^0.3.4.
  • In this repo's resolved graph, only aws-sigv4 and aws-smithy-types pull time at all (confirmed against Cargo.lock).

Finding (Important, non-blocking): the time floor is not forced to the patched version; the commit message's time claim is false

Background / intended behavior. The commit message asserts that raising aws-sdk-s3 to 1.163 "in turn requires the fixed aws-smithy-json, lru and time." The relevant time advisory is RUSTSEC-2026-0009 / GHSA-r6v5-fh4h-64xc — a stack-exhaustion Denial-of-Service — which affects the range [0.3.6, 0.3.47) and is fixed in 0.3.47 (both confirmed via OSV).

Why the implementation does not meet that intent. The strongest floor the entire aws-sdk-s3 = "1.163" chain imposes on time is ^0.3.35 (through aws-sigv4 1.6.6). A caret requirement ^0.3.35 is satisfied by any 0.3.x with x >= 35, which includes the still-vulnerable 0.3.35 … 0.3.46. Nothing anywhere in the dependency graph forces time >= 0.3.47.

Failure scenario / practical impact. A downstream consumer of vnotify — the exact threat model this PR is written for — can produce a lockfile that pins aws-sigv4 1.6.6 + aws-smithy-types 1.9.5 + time at, say, 0.3.40, fully satisfy aws-sdk-s3 = "1.163" (and every other floor in this PR), and still ship the vulnerable time and remain exposed to the DoS. This repo's own Cargo.lock happens to resolve time 0.3.55 (patched), but that lockfile does not travel to consumers, so it provides them no protection. The PR therefore closes the json/lru/bytes/rand gaps but leaves the time gap open, contradicting its own commit message.

Suggested remedy (either is acceptable).

  1. Add a direct floor time = "0.3.47" to [dependencies]. Taking a direct dependency on a crate you do not call is the only mechanism Cargo offers to force a transitive floor for consumers; this is a recognized pattern for exactly this situation. (src/lib.rs does not reference time, so there is no code impact.) Or
  2. If forcing time is out of scope, correct the commit message to drop the time claim and note that time cannot be force-upgraded via aws-sdk-s3 alone.

Anchor: Cargo.toml:12 (the aws-sdk-s3 = "1.163" floor relied upon to force time).


Everything else checks out

The other four floors are valid semver, exist on the registry, build under the pinned toolchain, and genuinely force their patched versions:

dep floor imposed advisory fixed in forced?
aws-smithy-json ^0.65.1 (via aws-sdk-s3) GHSA-8ffr-xgwf-xj56 0.62.7 yes
lru ^0.18.2 (via aws-sdk-s3) RUSTSEC-2026-0253 0.18.2 yes (exactly)
bytes 1.12.2 (direct) RUSTSEC-2026-0007 1.11.1 yes
rand 0.8.8 (direct) RUSTSEC-2026-0097 (0.8 line) 0.8.6 yes
  • Lockfile consistency. Cargo.lock resolves aws-sdk-s3 1.163.0, aws-smithy-json 0.65.1, lru 0.18.5, bytes 1.12.2, rand 0.8.8, time 0.3.55, tokio 1.54.1 — all consistent with the new floors and all patched. No inconsistency between Cargo.toml and Cargo.lock.
  • MSRV / toolchain. aws-sdk-s3 1.163.0 declares rust-version = 1.94.1, the highest among the bumped deps; rust-toolchain.toml pins 1.95.0, so it compiles. Headroom is only one minor — worth noting that any future floor bump requiring >1.95 would also need a toolchain bump.
  • API usage (src/lib.rs). The crate uses aws_sdk_s3 (ByteStream, Client, SdkError::ServiceError, get_object/head_object with NoSuchKey/NotFound, conditional writes, list_objects_v2), bytes::Bytes, rand::Rng / thread_rng().gen() (not deprecated until rand 0.9), and tokio oneshot / mpsc::unbounded_channel / JoinSet / time::timeout / sleep. All are stable and present in the floored versions; nothing newly requires or breaks under these minimums. The floors are higher than the code strictly needs, which is the intended security posture, not an over-tight-pin defect.
  • Regressions. None. For time specifically the PR does not regress — it is simply incomplete relative to its stated goal.

Review skill evidence

I invoked the Claude Code pr-review-toolkit:code-reviewer subagent (via the Task tool) to perform the primary review of the diff at head 48b9bd0. Its central finding — that aws-sdk-s3 = "1.163" floors time only at 0.3.35, below the patched 0.3.47 — I then independently verified rather than relying on it (per prior experience of subagent-fabricated facts): I confirmed aws-sdk-s3 1.163.0's requirements and aws-sigv4 1.6.6 / aws-smithy-types 1.9.5's time requirements against the crates.io sparse index, confirmed the advisory range/fix ([0.3.6, 0.3.47) → 0.3.47) against the OSV API, and confirmed via Cargo.lock that only those two crates pull time.


Bottom line

Safe to merge as a net security improvement — it does not regress anything and the crate's own build is fully patched. However, I am leaving this as a comment rather than approving because the PR's stated protection for time is not actually delivered to downstream consumers and the commit message asserts otherwise. Recommend adding time = "0.3.47" as a direct floor (preferred) or amending the commit message before merge.

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.

2 participants