Skip to content

Fix: Return correct HTTP status codes on errors and sanitize file paths in compile/upload endpoints#168

Open
Omdeepb69 wants to merge 1 commit intoc2siorg:mainfrom
Omdeepb69:fix/http-status-codes-and-path-traversal
Open

Fix: Return correct HTTP status codes on errors and sanitize file paths in compile/upload endpoints#168
Omdeepb69 wants to merge 1 commit intoc2siorg:mainfrom
Omdeepb69:fix/http-status-codes-and-path-traversal

Conversation

@Omdeepb69
Copy link
Copy Markdown

Two related security and correctness issues fixed in gdbui_server/main.py:

  1. HTTP status codes on errors
    All GDB command endpoints were returning HTTP 200 OK even when an exception
    occurred and success: False was set in the response body. This makes it
    impossible for clients to distinguish success from failure without parsing
    the body. Fixed by returning 500 on exceptions.

  2. Path traversal vulnerability in /compile and /upload_file
    The name parameter from user input was used directly in file paths without
    sanitization. A malicious input like "../../../etc/passwd" could write files
    outside the intended output directory. Fixed by applying
    werkzeug.utils.secure_filename() to all user-supplied filenames.

  3. Output directory creation on startup
    Added os.makedirs(OUTPUT_DIR, exist_ok=True) so the output/ directory is
    created automatically. This fixes a crash on first run in fresh Docker
    deployments where the directory does not exist yet.

These fixes directly address the CI/CD Integration and First Deployment
objectives from the GSoC 2026 project description.

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