Skip to content

Comments

🛡️ Sentinel: [HIGH] Fix Arbitrary File Read in Archive Module#777

Open
adolago wants to merge 1 commit intomainfrom
sentinel-fix-archive-symlink-7524086818539629066
Open

🛡️ Sentinel: [HIGH] Fix Arbitrary File Read in Archive Module#777
adolago wants to merge 1 commit intomainfrom
sentinel-fix-archive-symlink-7524086818539629066

Conversation

@adolago
Copy link
Owner

@adolago adolago commented Feb 19, 2026

🛡️ Sentinel: [CRITICAL] Fix Arbitrary File Read via Symlink in Archive Module

🚨 Severity: HIGH
💡 Vulnerability: The archive module followed symbolic links when creating archives. If an attacker could place a symlink in the source directory pointing to a sensitive file (e.g., /etc/passwd), the archive would contain the content of that file.
🎯 Impact: Arbitrary file read / Information disclosure.
🔧 Fix: Modified ArchiveModule to use fs::symlink_metadata instead of fs::metadata to detect symlinks.

  • For tar archives: Added logic to create a tar::Header with EntryType::Symlink and set the link name, appending it without content.
  • For zip archives: Added logic to set Unix permissions 0o120777 (S_IFLNK) and write the target path as the file content, which is the standard way to store symlinks in zip files.
    ✅ Verification: Added a regression test test_archive_symlink_security in src/modules/archive.rs that creates a symlink to a sensitive file and asserts that the resulting archive contains a symlink entry and DOES NOT contain the sensitive content. Confirmed that the test fails before the fix and passes after the fix.

PR created automatically by Jules for task 7524086818539629066 started by @dolagoartur

The archive module previously followed symbolic links when creating archives,
which could lead to sensitive file disclosure if a symlink to a sensitive file
was present in the source directory.

This change modifies `ArchiveModule` to check for symbolic links using `fs::symlink_metadata`
and store them as symbolic links in the archive (for both tar and zip formats),
rather than following them and storing the target content.

A regression test `test_archive_symlink_security` has been added to verify the fix.

Co-authored-by: dolagoartur <146357947+dolagoartur@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 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.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d9f2a96bf8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +204 to +205
header.set_path(relative_path)?;
header.set_link_name(target)?;

Choose a reason for hiding this comment

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

P1 Badge Handle long symlink names via tar builder helpers

The symlink branch now constructs tar headers directly with set_path/set_link_name, which skips the builder’s GNU long-name/long-link handling and causes archive creation to fail when a symlink path or target exceeds tar header limits (a realistic case in deeply nested dependency trees). In this function, long regular-file paths still work because append_path_with_name emits the extension records, so this is a regression specific to symlink entries.

Useful? React with 👍 / 👎.

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