i have some trouble with a little XSS.
This is my PHP/JS Code:
$('#fileTree').fileTree({
path: '<?php echo $path; ?>/',
script: 'something.php',
expandedFolders: ['data'],
multiFolder: true,
},
function (file) {
alert(file);
}
);
First of all, i know this is vulnerable to XSS.
the code works well if $path doesnt contain special characters. in my case, $path contains '/somedir/customers/hi'all/orders/'.
Here is an example:
$('#fileTree').fileTree({
path: '/somedir/customers/Hi'All!-e.v/',
script: 'something.php',
expandedFolders: ['data'],
multiFolder: true,
},
function (file) {
alert(file);
}
Normaly i would use htmlspecialchars() to avoid XSS, but here it will convert the "'" to "'" and this will break my application, because i use the "path" value on windows/unix directorys.
Anybody here have an idea how i can solve my problem?