Multiple choice technology security

Which methods in the TCS SAPI can be used to prevent Path Traversal?

  1. isValidDirectory( java.lang.String context, java.lang.String input)

  2. isValidDirectory( java.lang.String context, java.lang.String input) and isValidFileName(java.lang.String context, java.lang.String input)

  3. isSafeDirectoryPath(java.lang.String context, java.lang.String input,boolean allowNull) and isSafeFileName(java.lang.String context, java.lang.String input,boolean allowNull)

  4. ValidateDirectoryPath(java.lang.String context, java.lang.String input,boolean allowNull)

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The TCS SAPI provides isSafeDirectoryPath() and isSafeFileName() methods to prevent Path Traversal attacks. These methods validate that directory paths and filenames don't contain malicious sequences like '../' that could allow attackers to access files outside the intended directory. The allowNull parameter determines whether null/empty values should be considered valid.