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

Prevent illegal request path from crashing program #1285

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

cyqsimon
Copy link
Contributor

@cyqsimon cyqsimon commented Dec 6, 2023

I experienced a service crash today due to a request that contains an illegal character in its path. The request seems to be a malicious vulnerability scan, but it shouldn't crash the program nonetheless. This PR makes sure this doesn't happen.

Logs:

Dec 06 04:07:59 HOSTNAME miniserve[1012]: thread 'actix-rt|system:0|arbiter:1' panicked at 'called `Result::unwrap()` on an `Err` value: http::Error(InvalidUri(InvalidUriChar))', /build/path/miniserve-0.24.0/src/listing.rs:171:10

@svenstaro
Copy link
Owner

Thanks! Could you perhaps also add a test for this? For extra points, proptest would be perfect for finding stuff such as this!

@cyqsimon
Copy link
Contributor Author

Ugh. That's not going to be trivial because I don't actually know what the offending request was. And going the distance to learn and add a new testing framework needs more time than I'm willing to commit. Sorry ¯\_(ツ)_/¯.

And to be honest I find it a bit overkill to test for what amounts to an "avoid using unwrap" anyways.

@svenstaro
Copy link
Owner

Ok don't worry. I'll add the test case.

@svenstaro svenstaro merged commit ac1aa75 into svenstaro:master Jan 3, 2024
19 checks passed
svenstaro added a commit that referenced this pull request Jan 3, 2024
@cyqsimon cyqsimon deleted the listing-crash-fix branch January 26, 2024 04:35
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