Skip to content

Conversation

ahti
Copy link
Contributor

@ahti ahti commented May 2, 2025

Currently, if you can guess the name of a symlinked dir, and the name of files or directories nested inside, miniserve will not prevent you from accessing them, even when --no-symlinks is passed.

Copy link
Owner

@svenstaro svenstaro left a comment

Choose a reason for hiding this comment

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

Looks good. Just a few nits.

src/main.rs Outdated
Comment on lines 388 to 404
if !no_symlinks {
return true;
}

let mut full_path = base_path.clone();

for component in path.components() {
full_path.push(component);
if full_path.is_symlink() {
return false;
}
}

true
Copy link
Owner

Choose a reason for hiding this comment

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

This logic is now complex enough that I'd like a few comments sprinkled in here.

@ahti ahti force-pushed the symlink-nested-dir branch from 673fb62 to 593091e Compare June 18, 2025 23:52
@svenstaro svenstaro merged commit 563e239 into svenstaro:master Jun 24, 2025
17 checks passed
svenstaro added a commit that referenced this pull request Jun 24, 2025
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