As a security analyst, you need to create a simple function that detects potential path traversal patterns in a given file path. The function should return true if the path contains any sequences like ../ indicating directory traversal.
Path traversal
Security analyst
Report a typo
Sample Input 1:
/uploads/../../../etc/passwdSample Output 1:
trueSample Input 2:
/uploads/etc/passwdSample Output 2:
falseWrite a program in JavaScript
// Function to detect path traversal
function detectPathTraversal(filePath) {
}
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.