Skip to content

Commit f35d885

Browse files
committed
Improve recommendation PathInjection
1 parent 3f63cb3 commit f35d885

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

javascript/frameworks/cap/src/path-traversal/PathInjection.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Additionally if user-provided input is used to create file contents this can als
88

99
CAP applications using CDS Utils should not use user-provided input without sanitization.
1010

11+
The sanitization stragety can vary depending on what types of paths are satisfactory as user-provided input. A simple approach to sanitization is to check user-provided input against an allow list. Other potential approaches include checking components of paths or normalizing them to make sure that the path does not escape the expected root folder.
12+
13+
Normalization techniques should be carefully considered and simple naive replacement strategies will not be sufficient, for example replacing any match of a parent directory reference (`../`) in the sample `.../...//` will still result in the path `../` being used which could escape the intended directory.
14+
1115
## Examples
1216

1317
This CAP service directly uses user-provided input to construct a path.

0 commit comments

Comments
 (0)