Skip to content

[Security Issue] Apply secure_filename to snapshot_path for security hardening #688

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shyun020
Copy link

Description

  • Security fix – Resolved a path injection vulnerability in the snapshot_path parameter.

This change uses secure_filename from werkzeug.utils to sanitize the snapshot_path value obtained from user input, preventing malicious path traversal or unauthorized file access.

Problem

Previously, the snapshot_path parameter was used without validation. An attacker could exploit this by passing values like ../../etc/passwd, potentially gaining access to sensitive files on the server. This posed a serious path injection security risk.

Code Change

from werkzeug.utils import secure_filename

snapshot_path = secure_filename(request.args.get("snapshot_path"))

The secure_filename function ensures the input is converted to a safe, valid filename, effectively blocking directory traversal attempts.

Test Plan

  • Attempted path injection using snapshot_path=../../etc/passwd
  • Before fix: Able to access unintended paths
  • After fix: Filename is sanitized (e.g., becomes etc_passwd), preventing unauthorized access

@shyun020 shyun020 requested a review from Seagh0098 April 14, 2025 01:51
@shyun020
Copy link
Author

shyun020 commented Apr 26, 2025

@ARajgor I'd appreciate it if you could review the unit tests I wrote 🙏

@shyun020
Copy link
Author

@ARajgor

knock knock

1 similar comment
@shyun020
Copy link
Author

shyun020 commented May 2, 2025

@ARajgor

knock knock

@shyun020
Copy link
Author

shyun020 commented May 2, 2025

@Seagh0098

knock knock

@shyun020
Copy link
Author

shyun020 commented May 9, 2025

@Seagh0098

knock knock

@rohanod
Copy link

rohanod commented May 9, 2025

@Seagh0098

knock knock

How mature

@shyun020
Copy link
Author

shyun020 commented May 9, 2025

@Seagh0098
knock knock

How mature

Why so serious? 😏

@shyun020
Copy link
Author

shyun020 commented Jun 3, 2025

May I ask how long it will take for the final merge? Also, has the CI process been completed?

@Seagh0098

@shyun020 shyun020 requested a review from Seagh0098 June 3, 2025 06:22
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.

3 participants