diff --git a/Source/Processes/AuOpen.Unix.cpp b/Source/Processes/AuOpen.Unix.cpp index 621e231b..76bc400f 100644 --- a/Source/Processes/AuOpen.Unix.cpp +++ b/Source/Processes/AuOpen.Unix.cpp @@ -26,11 +26,36 @@ namespace Aurora::Processes AUKN_SYM void OpenUri(const AuString &uri) { + if (AuFS::FileExists(uri)) + { + SysPushErrorGeneric("Exploit attempt? Attempted to open existing file/directory via URI ({})", uri); + return; + } + UnixOpenAsync(uri); } AUKN_SYM void OpenFile(const AuString &file) { - UnixOpenAsync(IO::FS::NormalizePathRet(file)); + auto path = AuIOFS::NormalizePathRet(file); + bool bFileExists {}; + + if (!(bFileExists = AuFS::FileExists(path)) && + !AuFS::DirExists(path)) + { + SysPushErrorGeneric("Exploit attempt? Attempted to open non-existent file/directory. (request: {})", file); + return; + } + + if (bFileExists) + { + if (!AuFS::IsFileBlocked(path)) + { + SysPushErrorGeneric("Exploit attempt? Attempted to open untrusted file/directory. (request: {})", file); + return; + } + } + + UnixOpenAsync(path); } } \ No newline at end of file