Skip to content

🛡️ Sentinel: [HIGH] Fix Symlink Traversal Vulnerability in read_dir#298

Draft
EffortlessSteven wants to merge 2 commits intomainfrom
sentinel-fix-symlink-traversal-4700526285745016192
Draft

🛡️ Sentinel: [HIGH] Fix Symlink Traversal Vulnerability in read_dir#298
EffortlessSteven wants to merge 2 commits intomainfrom
sentinel-fix-symlink-traversal-4700526285745016192

Conversation

@EffortlessSteven
Copy link
Copy Markdown
Member

🚨 Severity: HIGH
💡 Vulnerability: Unfiltered calls to fs::read_dir were inadvertently following symbolic links. Attackers could create symbolic links pointing outside the expected file boundaries (sandbox escape), opening up the possibility for arbitrary file reads or unintentional file deletions during operations such as cache clearing and status inspection.
🎯 Impact: Bypassing directory sandboxes could allow external code exfiltration or overwriting critical system files.
🔧 Fix: Added .filter(|e| !e.file_type().is_ok_and(|ft| ft.is_symlink())) (and equivalent manual continue loops where streams weren't chained) across crates/xchecker-engine, crates/xchecker-receipt, crates/xchecker-utils, and crates/xchecker-status.
Verification: Verified by passing cargo test --workspace --lib and ensuring cargo clippy --workspace passes cleanly with no warnings.


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

This commit explicitly filters out symbolic links (`is_symlink()`) across all instances of `fs::read_dir` file loops. Failing to do so would transparently allow file operations to walk outside the intended directory sandbox structure. Affected crates include engine, receipt, utils, and status.
@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 Mar 25, 2026

Warning

Rate limit exceeded

@EffortlessSteven has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e8283b83-582a-4be9-89ad-c9840d2aa052

📥 Commits

Reviewing files that changed from the base of the PR and between 4138f8e and 0c998cb.

📒 Files selected for processing (11)
  • .jules/sentinel.md
  • crates/xchecker-engine/src/orchestrator/handle.rs
  • crates/xchecker-receipt/src/writer.rs
  • crates/xchecker-status/src/artifact.rs
  • crates/xchecker-utils/src/cache.rs
  • fix.py
  • fix_again.py
  • fix_again2.py
  • fix_one_more.py
  • fix_sigterm.py
  • tests/test_unix_process_termination.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentinel-fix-symlink-traversal-4700526285745016192

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.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical security vulnerability by preventing symbolic links from being followed during various file system operations. The changes enhance the integrity of sandboxed environments within the system, mitigating the risk of unauthorized access or modification of files outside their intended boundaries. This ensures that operations like cache clearing and status inspection remain secure and confined.

Highlights

  • Vulnerability Fix: Addressed a HIGH severity symlink traversal vulnerability in calls to fs::read_dir across multiple crates.
  • Sandbox Escape Prevention: Prevented potential sandbox escapes, arbitrary file reads, or unintentional file deletions by ensuring symbolic links are not inadvertently followed.
  • Implementation: Introduced explicit symlink filtering using .filter(|e| !e.file_type().is_ok_and(|ft| ft.is_symlink())) or manual continue loops where stream chaining was not applicable.
  • Scope of Fix: Applied the necessary security fixes to xchecker-engine, xchecker-receipt, xchecker-utils, and xchecker-status crates.
  • Documentation: Added a new markdown file (.jules/sentinel.md) documenting the vulnerability, lessons learned, and prevention strategies for future reference.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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 symlink traversal vulnerability by introducing explicit checks to filter out symbolic links when iterating through directory entries using fs::read_dir across various modules, including xchecker-engine, xchecker-receipt, xchecker-status, and xchecker-utils. A new sentinel markdown file has also been added to document this vulnerability and its prevention. There is no feedback to provide as no review comments were made.

This commit explicitly filters out symbolic links (`is_symlink()`) across all instances of `fs::read_dir` file loops to prevent directory sandbox escapes. It also addresses CI test instability by migrating legacy `kill(pid, 0)` checks in process termination tests to `child.try_wait()` and increasing mock sleep durations to accommodate slow CI execution environments.
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