security: fix path traversal vulnerability in FRI download endpoint (fixes #262)#315
Merged
pradeeban merged 3 commits intoControlCore-Project:devfrom Feb 14, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a critical path traversal vulnerability (Issue #262) in the FRI server's /download endpoint that allowed attackers to read arbitrary files on the server. The fix implements multiple layers of validation to ensure requested file paths remain within the intended directory boundaries.
Changes:
- Added comprehensive path validation including checks for missing parameters, absolute paths, directory traversal sequences, and final boundary verification
- Imported
abortfrom Flask for proper HTTP error responses - Enhanced security through defense-in-depth approach with multiple validation layers
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Author
|
thank you @pradeeban please review another PR's also.... |
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.
@pradeeban
Summary
This PR resolves Issue #262 by preventing path traversal in the FRI server
/downloadendpoint.Previously, the
fetchparameter was used directly insend_from_directorywithout sanitization. This allowed directory traversal attacks such as:which could expose arbitrary files on the server.
Changes Made
fetchparameter (HTTP 400)os.path.normpath..directory traversal components (HTTP 400)Security Impact
Scope
fri/server/main.py)Testing
fetchparameter → 400../../etc/passwdtraversal → 400..%2F..%2Fetc%2Fpasswd→ 400C:\Windows\...//etc/passwd) → 400..\..\etc\passwd) → 400All tests passed locally.