kmlgen: restrict HTTP server exposure - #1727
Merged
Merged
Conversation
Contributor
|
Merged, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1726.
This changes the KMLGen HTTP server in two ways:
bind_addresssetting, defaulting to127.0.0.1instead of listening on all interfacesOther bind addresses can still be configured explicitly. For example:
When a specific non-loopback address is configured, that address is also used in the generated NetworkLink URL. Loopback and wildcard binds continue to use
localhost.The file restriction resolves the requested path and compares its canonical path exactly with the generated mission KML path before allowing
SimpleHTTPRequestHandlerto serve it.Testing
I reproduced #1726 before applying the patch and then ran the same full MAVProxy/KMLGen workflow against the patched code.
The patched instance produced:
This verifies that the generated mission KML is still served, while
flight.tlogand an unrelated file in the same log directory are no longer accessible. It also verifies that the normal server binds to127.0.0.1by default.Standalone full-application regression test
Run:
My patched run returned:
I also ran focused regression checks for:
127.0.0.1binding0.0.0.0bindingGETandHEADfor the generated mission KMLflight.tlog,networklink.kml, and unrelated log-directory filesRepository checks:
All passed.