```csharp public static string readFile(string path) { bool valid = fals

public static string readFile(string path)
{
bool valid = false;
// Disallow absolute paths
valid = !Path.IsPathRooted(path);
if (valid)
{
path = Path.Join(ApiManager.Instance.UserScriptsPath(), path);
// Check path is a subdirectory of User folder
valid = _IsSubdirectory(path, App.UserPath());
}
if (!valid)
{
// TODO think long and hard about security
Debug.LogWarning($"Path is not a subdirectory of User folder: {path}");
return null;
}
public static string readFile(string path)
{
bool valid = false;
// Disallow absolute paths
valid = !Path.IsPathRooted(path);
if (valid)
{
path = Path.Join(ApiManager.Instance.UserScriptsPath(), path);
// Check path is a subdirectory of User folder
valid = _IsSubdirectory(path, App.UserPath());
}
if (!valid)
{
// TODO think long and hard about security
Debug.LogWarning($"Path is not a subdirectory of User folder: {path}");
return null;
}
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?