Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: explicitly require tonic v1.12.3 #2357

Merged
merged 1 commit into from
Nov 29, 2024
Merged

Conversation

lklimek
Copy link
Contributor

@lklimek lklimek commented Nov 28, 2024

Issue being fixed or feature implemented

Tonic < 0.12.3 has security vulnerability

Closes #2199

What was done?

Explicitly require tonic >= 0.12.3.

This PR does not change anything, as we already build against 0.12.3 (at least since v1.4.0). It just adds formal requirement.

How Has This Been Tested?

GHA

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Chores
    • Updated dependency versions for improved compatibility and potential bug fixes.

Copy link
Contributor

coderabbitai bot commented Nov 28, 2024

Walkthrough

The pull request modifies the Cargo.toml file for the dapi-grpc package, primarily updating the versions of several dependencies. The tonic and tonic-build dependencies have been upgraded from version 0.12 to 0.12.3, while serde has been specified as version 1.0.197, and serde_bytes has been updated to 0.11.12. The changes ensure compatibility with newer versions while maintaining the existing structure of the file.

Changes

File Change Summary
packages/dapi-grpc/Cargo.toml Updated tonic and tonic-build to 0.12.3, specified serde as 1.0.197, and updated serde_bytes to 0.11.12.

Assessment against linked issues

Objective Addressed Explanation
Upgrade tonic to a patched version to address DoS issue (2199)

Possibly related issues

🐰 In the meadow, I hop with glee,
Updating dependencies, oh what a spree!
Tonic's fixed, no more woes,
With serde and bytes, my code now flows.
Let's dance in the code, with joy and delight,
For a safer tomorrow, our future is bright! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@lklimek lklimek changed the base branch from v1.6-dev to v1.7-dev November 28, 2024 12:07
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
packages/dapi-grpc/Cargo.toml (1)

Line range hint 41-42: Consider separating unrelated dependency updates.

The updates to serde (1.0.197) and serde_bytes (0.11.12) appear unrelated to the security fix for tonic. Consider handling these updates in a separate PR to maintain a focused scope on the security vulnerability fix.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e811ad4 and 477d574.

📒 Files selected for processing (1)
  • packages/dapi-grpc/Cargo.toml (2 hunks)
🔇 Additional comments (3)
packages/dapi-grpc/Cargo.toml (3)

52-52: LGTM! Correct synchronization with tonic version.

The tonic-build version is properly synchronized with the tonic dependency version.


38-41: LGTM! Explicit version requirement addresses security vulnerability.

The update to tonic 0.12.3 properly addresses RUSTSEC-2024-0376 (DoS vulnerability in tonic::transport::Server).

Let's verify there are no other dependencies that might affect tonic's version resolution:

✅ Verification successful

Tonic version update is correctly synchronized across dependencies

The verification confirms that both tonic and tonic-build dependencies are consistently set to version 0.12.3, with no other tonic-related dependencies in the workspace that could affect version resolution. This ensures the security fix for RUSTSEC-2024-0376 is properly applied.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other dependencies that might affect tonic's version
# Look for any other potential tonic dependencies in the workspace
rg --type toml 'tonic.*=.*' 

Length of output: 169


Line range hint 19-27: Verify server feature configuration for security fix.

The security fix in tonic 0.12.3 specifically addresses issues in tonic::transport::Server. The 'server' feature correctly includes the transport module, ensuring the fix will be active when this feature is used.

Let's verify the server feature usage:

✅ Verification successful

Let me verify the server feature configuration by checking the Cargo.toml files and feature dependencies.


Server feature configuration is properly secured

The verification confirms that:

  1. The server feature in dapi-grpc correctly includes tonic/transport and is properly configured
  2. The implementation in rs-drive-abci/src/server.rs uses tonic::transport::Server through the dapi-grpc crate
  3. The feature dependencies are correctly set up to ensure the security fix from tonic 0.12.3 is active
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for server feature usage in the codebase
# Look for potential server implementations using tonic
rg --type rust "tonic::transport::Server"

Length of output: 147


Script:

#!/bin/bash
# Check Cargo.toml files for server feature and tonic dependencies
rg -A 5 'server.*=.*\[' packages/*/Cargo.toml

# Check direct usage of tonic transport in rs-drive-abci
cat packages/rs-drive-abci/src/server.rs

Length of output: 4509

@lklimek lklimek changed the title build(deps): explicitly require tonic 1.12.3 deps: explicitly require tonic 1.12.3 Nov 28, 2024
@lklimek lklimek changed the title deps: explicitly require tonic 1.12.3 build: explicitly require tonic 1.12.3 Nov 28, 2024
@@ -35,7 +35,7 @@ mocks = ["serde", "dep:serde_json"]
[dependencies]
prost = { version = "0.13" }
futures-core = "0.3.30"
tonic = { version = "0.12", features = [
tonic = { version = "0.12.3", features = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it must be =0.12.3 isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we allow upgrades, Patched >=0.12.3 https://rustsec.org/advisories/RUSTSEC-2024-0376.html

@lklimek lklimek requested a review from shumkov November 28, 2024 13:44
@lklimek lklimek added this to the v1.7.0 milestone Nov 29, 2024
@lklimek lklimek changed the title build: explicitly require tonic 1.12.3 build: explicitly require tonic v1.12.3 Nov 29, 2024
@lklimek lklimek merged commit 837e24c into v1.7-dev Nov 29, 2024
55 of 57 checks passed
@lklimek lklimek deleted the deps/tonic-1.12.3 branch November 29, 2024 14:51
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.

RUSTSEC-2024-0376: Remotely exploitable Denial of Service in Tonic
2 participants