Courseiva
Java I/O API and Securing ApplicationseasyMultiple ChoiceObjective-mapped

1Z0-829 Java I/O API and Securing Applications Practice Question

A web application allows users to upload profile pictures. The application saves the files to a directory using the original filename provided by the user. After a security review, the team discovered a critical path traversal vulnerability. Which remediation is most effective in preventing exploitation while maintaining usability?

⚠ Common exam trap

Test-takers frequently think sanitizing input (Option B) or checking extensions (Option C) is sufficient, but they fail to realize that path traversal can be achieved through encoding tricks or by combining traversal sequences with valid extensions.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Generate a random UUID as the filename and store the original filename in a database.

Generating a random UUID as the filename eliminates the user's control over the file path, making path traversal attacks impossible. The original filename can be stored in a database for display purposes, preserving usability while ensuring the file is saved with a safe, unpredictable name.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Store the files in a database BLOB instead of the filesystem.

    Why it's wrong here

    Storing in a database avoids filesystem paths but may introduce other security issues and performance overhead.

  • Sanitize the filename by removing all occurrences of "../" and "/".

    Why it's wrong here

    Blacklisting is unreliable; attackers can use encoding or other tricks.

  • Check that the file extension is allowed (e.g., .jpg, .png) and no special characters.

    Why it's wrong here

    File extension validation does not prevent path traversal.

  • Generate a random UUID as the filename and store the original filename in a database.

    Why this is correct

    By not using the user-provided filename in the path, traversal is impossible.

About these practice questions

Courseiva writes every 1Z0-829 question from scratch — 513 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.