VulnerableApp
VulnerableApp copied to clipboard
Update PathTraversalVulnerability.java
Key Changes Explained:
-
Enhanced security checks: Added checks to prevent Path Traversal attacks by verifying that the file name does not contain ".." and is within the list of allowed file names.
-
Improved error handling: Changed the HTTP response codes to more accurately reflect the nature of the error (e.g., returning 404 Not Found for missing files and 403 Forbidden for unauthorized access attempts).
-
Condition validation: Immediately returns a 400 Bad Request if the precondition is not met, which helps in quickly identifying issues with request parameters.
-
Error Logging: Now logs different types of errors distinctly for better diagnostics.