mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Whitelist base path
This commit is contained in:
@@ -70,9 +70,10 @@ ReadCallback::Result FileReader::readFile(string const& _kind, string const& _so
|
||||
strippedSourceUnitName.erase(0, 7);
|
||||
|
||||
auto canonicalPath = normalizeCLIPathForVFS(m_basePath / strippedSourceUnitName, SymlinkResolution::Enabled);
|
||||
FileSystemPathSet extraAllowedPaths = {m_basePath.empty() ? "." : m_basePath};
|
||||
|
||||
bool isAllowed = false;
|
||||
for (boost::filesystem::path const& allowedDir: m_allowedDirectories)
|
||||
for (boost::filesystem::path const& allowedDir: m_allowedDirectories + extraAllowedPaths)
|
||||
if (isPathPrefix(normalizeCLIPathForVFS(allowedDir, SymlinkResolution::Enabled), canonicalPath))
|
||||
{
|
||||
isAllowed = true;
|
||||
|
||||
Reference in New Issue
Block a user