Skip to content

🛡️ Sentinel: [CRITICAL] Fix Path Truncation Vulnerability#3488

Draft
EffortlessSteven wants to merge 2 commits intomainfrom
jules-sentinel-path-truncation-830514392079978534
Draft

🛡️ Sentinel: [CRITICAL] Fix Path Truncation Vulnerability#3488
EffortlessSteven wants to merge 2 commits intomainfrom
jules-sentinel-path-truncation-830514392079978534

Conversation

@EffortlessSteven
Copy link
Copy Markdown
Member

🚨 Severity: CRITICAL
💡 Vulnerability: The validate_model_request function validated file extensions (like .gguf) using string operations but failed to check for null bytes (\0). This could allow attackers to bypass extension validation by appending a null byte followed by the required extension, causing underlying C APIs to load arbitrary files.
🎯 Impact: Attackers could potentially bypass file extension checks and load arbitrary files on the filesystem, leading to potential data exposure or code execution.
🔧 Fix: Added an explicit check for null bytes (\0) in the model_path during validation.
✅ Verification: Ran cargo test -p bitnet-server --lib security::tests:: and cargo clippy -p bitnet-server -- -D warnings. Both passed.


PR created automatically by Jules for task 830514392079978534 started by @EffortlessSteven

@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 40098036-bc8b-4b13-865c-4d29097e8238

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jules-sentinel-path-truncation-830514392079978534

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a path truncation vulnerability by implementing a null byte check in the model path validation and documenting the vulnerability in the sentinel log. A review comment suggests broadening this check to include all control characters using char::is_control for improved security and to prevent issues like log injection.


// Prevent path traversal attacks
if model_path.contains("..") || model_path.contains("~") {
if model_path.contains("..") || model_path.contains("~") || model_path.contains('\0') {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-medium medium

While blocking null bytes (\0) is critical to prevent path truncation and extension bypass when interacting with C APIs, it is a security best practice to reject all control characters in user-provided file paths. This broader check helps prevent other potential issues, such as log injection or unexpected behavior in downstream processing. Consider using char::is_control to catch all such characters.

Suggested change
if model_path.contains("..") || model_path.contains("~") || model_path.contains('\0') {
if model_path.contains("..") || model_path.contains("~") || model_path.contains(char::is_control) {

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.

1 participant