Question 230
A file export endpoint joins user-provided filenames to a server directory and can resolve encoded dot-dot components to private paths. Which next step is most appropriate under the stated conditions?
Explanation
Correct Answer
Enforce approved document identifiers and constrain canonical paths to an authorized root. File access must enforce boundaries after normalization and authorization.
Incorrect Answers
“Filter literal ../ but fail to normalize encoded traversal sequences” asserts more certainty than the records allow. Verify whether traversal variants never return files outside the user's authorized set.
The generalization “Strip the exact string ../ but continue joining untrusted filenames to filesystem paths” does not follow from the available artifacts. Removing literal dot-dot before decoding can be bypassed by alternate encodings.
“Restrict filename extensions without enforcing canonical directory boundaries” excludes a plausible alternative without testing it. The source case reports that a file export endpoint joins user-provided filenames to a server directory and can resolve encoded dot-dot components to private paths.