Integrating latest 47acbe8

This commit is contained in:
alexpete
2021-03-25 13:57:57 -07:00
parent 448c549698
commit 75dc720198
10312 changed files with 2711566 additions and 671451 deletions
@@ -86,8 +86,8 @@ Connection::Connection(bool isUserCreatedConnection, qintptr socketDescriptor, Q
connect(m_connectionWorker, &AssetProcessor::ConnectionWorker::ConnectionEstablished, this, &Connection::OnConnectionEstablished, Qt::BlockingQueuedConnection);
connect(m_connectionWorker, &AssetProcessor::ConnectionWorker::ErrorMessage, this, &Connection::ErrorMessage);
connect(m_connectionWorker, &AssetProcessor::ConnectionWorker::IsAddressWhiteListed, this, &Connection::IsAddressWhiteListed);
connect(this, &Connection::AddressIsWhiteListed, m_connectionWorker, &AssetProcessor::ConnectionWorker::AddressIsWhiteListed);
connect(m_connectionWorker, &AssetProcessor::ConnectionWorker::IsAddressInAllowedList, this, &Connection::IsAddressInAllowedList);
connect(this, &Connection::AddressIsInAllowedList, m_connectionWorker, &AssetProcessor::ConnectionWorker::AddressIsInAllowedList);
}
void Connection::Activate(qintptr socketDescriptor)
@@ -202,9 +202,9 @@ Q_SIGNALS:
void Error(unsigned int connId, QString errorString);
// the token is just any identifier to identify a particular connection, potentially from the same host.
// the response (AddressIsWhiteListed) will have the same token as was sent.
void IsAddressWhiteListed(QHostAddress hostAddress, void* token);
void AddressIsWhiteListed(void* token, bool result);
// the response (AddressIsInAllowedList) will have the same token as was sent.
void IsAddressInAllowedList(QHostAddress hostAddress, void* token);
void AddressIsInAllowedList(void* token, bool result);
//metrics
void NumOpenRequestsChanged();
@@ -51,20 +51,20 @@ ConnectionManager::ConnectionManager(QObject* parent)
ConnectionManagerRequestBus::Handler::BusConnect();
QTimer::singleShot(0, this, SLOT(UpdateWhiteListFromBootStrap()));
QTimer::singleShot(0, this, SLOT(UpdateAllowedListFromBootStrap()));
}
void ConnectionManager::UpdateWhiteListFromBootStrap()
void ConnectionManager::UpdateAllowedListFromBootStrap()
{
m_whiteListedAddresses.clear();
QString whitelist = AssetUtilities::ReadWhitelistFromSettingsRegistry();
AZStd::vector<AZStd::string> whitelistaddressList;
AzFramework::StringFunc::Tokenize(whitelist.toUtf8().constData(), whitelistaddressList, ", \t\n\r");
for (const AZStd::string& whitelistaddress : whitelistaddressList)
m_allowedListAddresses.clear();
QString allowedlist = AssetUtilities::ReadAllowedlistFromSettingsRegistry();
AZStd::vector<AZStd::string> allowedlistaddressList;
AzFramework::StringFunc::Tokenize(allowedlist.toUtf8().constData(), allowedlistaddressList, ", \t\n\r");
for (const AZStd::string& allowedlistaddress : allowedlistaddressList)
{
m_whiteListedAddresses << whitelistaddress.c_str();
m_allowedListAddresses << allowedlistaddress.c_str();
}
Q_EMIT SyncWhiteListAndRejectedList(m_whiteListedAddresses, m_rejectedAddresses);
Q_EMIT SyncAllowedListAndRejectedList(m_allowedListAddresses, m_rejectedAddresses);
}
@@ -121,8 +121,8 @@ unsigned int ConnectionManager::internalAddConnection(bool isUserConnection, qin
}
Connection* connection = new Connection(isUserConnection, socketDescriptor, this);
connect(connection, &Connection::IsAddressWhiteListed, this, &ConnectionManager::IsAddressWhiteListed);
connect(this, &ConnectionManager::AddressIsWhiteListed, connection, &Connection::AddressIsWhiteListed);
connect(connection, &Connection::IsAddressInAllowedList, this, &ConnectionManager::IsAddressInAllowedList);
connect(this, &ConnectionManager::AddressIsInAllowedList, connection, &Connection::AddressIsInAllowedList);
connection->SetConnectionId(connectionId);
connect(connection, &Connection::StatusChanged, this, &ConnectionManager::OnStatusChanged);
@@ -496,31 +496,31 @@ void ConnectionManager::NewConnection(qintptr socketDescriptor)
addConnection(socketDescriptor);
}
void ConnectionManager::WhiteListingEnabled(bool enabled)
void ConnectionManager::AllowedListingEnabled(bool enabled)
{
m_whiteListingEnabled = enabled;
m_allowedListingEnabled = enabled;
}
void ConnectionManager::AddWhiteListedAddress(QString address)
void ConnectionManager::AddAddressToAllowedList(QString address)
{
UpdateWhiteListFromBootStrap();
while (m_whiteListedAddresses.removeOne(address)) {}
m_whiteListedAddresses << address;
AssetUtilities::WriteWhitelistToBootstrap(m_whiteListedAddresses);
Q_EMIT SyncWhiteListAndRejectedList(m_whiteListedAddresses, m_rejectedAddresses);
UpdateAllowedListFromBootStrap();
while (m_allowedListAddresses.removeOne(address)) {}
m_allowedListAddresses << address;
AssetUtilities::WriteAllowedlistToBootstrap(m_allowedListAddresses);
Q_EMIT SyncAllowedListAndRejectedList(m_allowedListAddresses, m_rejectedAddresses);
}
void ConnectionManager::RemoveWhiteListedAddress(QString address)
void ConnectionManager::RemoveAddressFromAllowedList(QString address)
{
UpdateWhiteListFromBootStrap();
while (m_whiteListedAddresses.removeOne(address)) {}
AssetUtilities::WriteWhitelistToBootstrap(m_whiteListedAddresses);
Q_EMIT SyncWhiteListAndRejectedList(m_whiteListedAddresses, m_rejectedAddresses);
UpdateAllowedListFromBootStrap();
while (m_allowedListAddresses.removeOne(address)) {}
AssetUtilities::WriteAllowedlistToBootstrap(m_allowedListAddresses);
Q_EMIT SyncAllowedListAndRejectedList(m_allowedListAddresses, m_rejectedAddresses);
}
void ConnectionManager::AddRejectedAddress(QString address, bool surpressWarning)
{
UpdateWhiteListFromBootStrap();
UpdateAllowedListFromBootStrap();
bool alreadyRejected = false;
while (m_rejectedAddresses.removeOne(address)) { alreadyRejected = true; }
m_rejectedAddresses << address;
@@ -528,21 +528,21 @@ void ConnectionManager::AddRejectedAddress(QString address, bool surpressWarning
{
Q_EMIT FirstTimeAddedToRejctedList(address);
}
Q_EMIT SyncWhiteListAndRejectedList(m_whiteListedAddresses, m_rejectedAddresses);
Q_EMIT SyncAllowedListAndRejectedList(m_allowedListAddresses, m_rejectedAddresses);
}
void ConnectionManager::RemoveRejectedAddress(QString address)
{
UpdateWhiteListFromBootStrap();
UpdateAllowedListFromBootStrap();
while (m_rejectedAddresses.removeOne(address)) {}
Q_EMIT SyncWhiteListAndRejectedList(m_whiteListedAddresses, m_rejectedAddresses);
Q_EMIT SyncAllowedListAndRejectedList(m_allowedListAddresses, m_rejectedAddresses);
}
void ConnectionManager::IsAddressWhiteListed(QHostAddress incominghostaddr, void* token)
void ConnectionManager::IsAddressInAllowedList(QHostAddress incominghostaddr, void* token)
{
if (!m_whiteListingEnabled)
if (!m_allowedListingEnabled)
{
Q_EMIT AddressIsWhiteListed(token, true);
Q_EMIT AddressIsInAllowedList(token, true);
return;
}
@@ -550,9 +550,9 @@ void ConnectionManager::IsAddressWhiteListed(QHostAddress incominghostaddr, void
if (incominghostaddr != QHostAddress::Null)
{
// any ipv4 address will be like ::ffff:A.B.C.D, we have to retrieve A.B.C.D for comparision with the whitelisted addresses.
// any ipv4 address will be like ::ffff:A.B.C.D, we have to retrieve A.B.C.D for comparision with the allowedlisted addresses.
// for example Qt will tell us the ipv6 (::ffff:127.0.0.1) for 127.0.0.1,
// but the whitelist below will report ipv4 (127.0.0.1) and ipv6 (::1), and they both won't match to ipv6 (::ffff:127.0.0.1).
// but the allowedlist below will report ipv4 (127.0.0.1) and ipv6 (::1), and they both won't match to ipv6 (::ffff:127.0.0.1).
bool wasConverted = false;
quint32 incomingIPv4 = incominghostaddr.toIPv4Address(&wasConverted);
if (wasConverted)
@@ -567,29 +567,29 @@ void ConnectionManager::IsAddressWhiteListed(QHostAddress incominghostaddr, void
QHostInfo incomingInfo = QHostInfo::fromName(incomingIpAddress);
QString whitelist = AssetUtilities::ReadWhitelistFromSettingsRegistry();
QString allowedlist = AssetUtilities::ReadAllowedlistFromSettingsRegistry();
AZStd::vector<AZStd::string> whitelistaddressList;
AzFramework::StringFunc::Tokenize(whitelist.toUtf8().constData(), whitelistaddressList, ", \t\n\r");
AZStd::vector<AZStd::string> allowedlistaddressList;
AzFramework::StringFunc::Tokenize(allowedlist.toUtf8().constData(), allowedlistaddressList, ", \t\n\r");
// allow localhost, loopback regardless, there's no good reason to accidentally lock yourself out your own computer.
for (const auto& address : QNetworkInterface::allAddresses()) // allAdresses returns the ip address of all local interfaces.
{
whitelistaddressList.push_back(address.toString().toUtf8().constData());
allowedlistaddressList.push_back(address.toString().toUtf8().constData());
}
// does the incoming connection match any entries?
for (const AZStd::string& whitelistaddress : whitelistaddressList)
for (const AZStd::string& allowedListaddress : allowedlistaddressList)
{
//address range matching
size_t maskLocation = whitelistaddress.find('/');
size_t maskLocation = allowedListaddress.find('/');
if (maskLocation != AZStd::string::npos)
{
//x.x.x.x/0 is all addresses
int mask = atoi(whitelistaddress.substr(maskLocation + 1).c_str());
int mask = atoi(allowedListaddress.substr(maskLocation + 1).c_str());
if (mask == 0)
{
Q_EMIT AddressIsWhiteListed(token, true);
Q_EMIT AddressIsInAllowedList(token, true);
return;
}
else
@@ -602,35 +602,35 @@ void ConnectionManager::IsAddressWhiteListed(QHostAddress incominghostaddr, void
//QT should first do a check and see if we are comparing convertible protocols before just early outing.
//If it wasn't convertible to ipv4 then we know it is ipv6 in which case the protocols will match which make this unnecessary, but still correct.
QHostAddress ha(incomingIpAddress);
if (ha.isInSubnet(QHostAddress::parseSubnet(whitelistaddress.c_str())))
if (ha.isInSubnet(QHostAddress::parseSubnet(allowedListaddress.c_str())))
{
Q_EMIT AddressIsWhiteListed(token, true);
Q_EMIT AddressIsInAllowedList(token, true);
return;
}
}
}
else//direct address matching
{
QHostInfo whiteInfo;
QHostAddress whiteHostAddress(whitelistaddress.c_str());
if ((whiteHostAddress.isNull()))
QHostInfo allowedInfo;
QHostAddress allowedHostAddress(allowedListaddress.c_str());
if ((allowedHostAddress.isNull()))
{
whiteInfo = QHostInfo::fromName(QString::fromUtf8(whitelistaddress.c_str()));
allowedInfo = QHostInfo::fromName(QString::fromUtf8(allowedListaddress.c_str()));
}
else
{
QList<QHostAddress> addresses;
addresses << whiteHostAddress;
whiteInfo.setAddresses(addresses);
addresses << allowedHostAddress;
allowedInfo.setAddresses(addresses);
}
for (const auto& whiteAddress : whiteInfo.addresses())
for (const auto& allowedAddress : allowedInfo.addresses())
{
for (const auto& address : incomingInfo.addresses())
{
if (address == whiteAddress)
if (address == allowedAddress)
{
Q_EMIT AddressIsWhiteListed(token, true);
Q_EMIT AddressIsInAllowedList(token, true);
return;
}
}
@@ -639,7 +639,7 @@ void ConnectionManager::IsAddressWhiteListed(QHostAddress incominghostaddr, void
}
AddRejectedAddress(incomingIpAddress);
Q_EMIT AddressIsWhiteListed(token, false);
Q_EMIT AddressIsInAllowedList(token, false);
}
void ConnectionManager::AddBytesReceived(unsigned int connId, qint64 add, bool update)
@@ -109,10 +109,10 @@ Q_SIGNALS:
void ReadyToQuit(QObject* source);
void SyncWhiteListAndRejectedList(QStringList whiteList, QStringList rejectedList);
void SyncAllowedListAndRejectedList(QStringList allowedList, QStringList rejectedList);
// this is a response to the whitelist request with that same token.
void AddressIsWhiteListed(void* token, bool result);
// this is a response to the allowedlist request with that same token.
void AddressIsInAllowedList(void* token, bool result);
void FirstTimeAddedToRejctedList(QString ipAddress);
@@ -123,10 +123,10 @@ public Q_SLOTS:
void MakeSureConnectionMapEmpty();
void NewConnection(qintptr socketDescriptor);
void WhiteListingEnabled(bool enabled);
void IsAddressWhiteListed(QHostAddress hostAddress, void* token);
void AddWhiteListedAddress(QString address);
void RemoveWhiteListedAddress(QString address);
void AllowedListingEnabled(bool enabled);
void IsAddressInAllowedList(QHostAddress hostAddress, void* token);
void AddAddressToAllowedList(QString address);
void RemoveAddressFromAllowedList(QString address);
void AddRejectedAddress(QString address, bool surpressWarning = false);
void RemoveRejectedAddress(QString address);
@@ -185,7 +185,7 @@ public Q_SLOTS:
void OnStatusChanged(unsigned int connId);
void UpdateWhiteListFromBootStrap();
void UpdateAllowedListFromBootStrap();
private:
@@ -205,11 +205,11 @@ private:
// the key is the name of the platform, and the value is the number of those kind of platforms.
QHash<QString, int> m_platformsConnected;
//white listing
bool m_whiteListingEnabled = true;
//allowed listing
bool m_allowedListingEnabled = true;
//these lists are just caches, only used for updating
QStringList m_whiteListedAddresses;
QStringList m_allowedListAddresses;
QStringList m_rejectedAddresses;
};
@@ -378,11 +378,11 @@ void ConnectionWorker::ConnectSocket(qintptr socketDescriptor)
disconnect(&m_engineSocket, &QTcpSocket::stateChanged, this, &ConnectionWorker::EngineSocketStateChanged);
m_engineSocket.setSocketDescriptor(socketDescriptor, QAbstractSocket::ConnectedState, QIODevice::ReadWrite);
Q_EMIT IsAddressWhiteListed(m_engineSocket.peerAddress(), reinterpret_cast<void*>(this));
Q_EMIT IsAddressInAllowedList(m_engineSocket.peerAddress(), reinterpret_cast<void*>(this));
}
}
void ConnectionWorker::AddressIsWhiteListed(void* token, bool result)
void ConnectionWorker::AddressIsInAllowedList(void* token, bool result)
{
if (reinterpret_cast<void*>(this) == token)
{
@@ -395,7 +395,7 @@ void ConnectionWorker::AddressIsWhiteListed(void* token, bool result)
else
{
// this address has been rejected, disconnect immediately!!!
AZ_TracePrintf(AssetProcessor::ConsoleChannel, " A connection attempt was ignored because it is not whitelisted. Please consider adding white_list=(IP ADDRESS),localhost to the bootstrap.cfg");
AZ_TracePrintf(AssetProcessor::ConsoleChannel, " A connection attempt was ignored because it is not in the allowed list. Please consider adding allowed_list=(IP ADDRESS),localhost to the bootstrap.cfg");
disconnect(&m_engineSocket, &QTcpSocket::readyRead, this, &ConnectionWorker::EngineSocketHasData);
@@ -58,7 +58,7 @@ Q_SIGNALS:
void ErrorMessage(QString msg);
// the token identifies the unique connection instance, since multiple may have the same address
void IsAddressWhiteListed(QHostAddress hostAddress, void* token);
void IsAddressInAllowedList(QHostAddress hostAddress, void* token);
public Q_SLOTS:
void ConnectSocket(qintptr socketDescriptor);
@@ -70,8 +70,8 @@ Q_SIGNALS:
void RequestTerminate();
bool NegotiateDirect(bool initiate);
// the token will be the same token sent in the whitelisting request.
void AddressIsWhiteListed(void* token, bool result);
// the token will be the same token sent in the allowedlisting request.
void AddressIsInAllowedList(void* token, bool result);
private Q_SLOTS:
void TerminateConnection();
@@ -85,6 +85,7 @@ namespace AssetProcessorMessagesTests
public:
void SetUp() override
{
#if !AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
AssetUtilities::ResetGameName();
m_temporarySourceDir = QDir(m_temporaryDir.path());
@@ -165,10 +166,12 @@ namespace AssetProcessorMessagesTests
});
#endif // !AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
}
void TearDown() override
{
#if !AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
QEventLoop eventLoop;
QObject::connect(m_batchApplicationManager->m_connectionManager, &ConnectionManager::ReadyToQuit, &eventLoop, &QEventLoop::quit);
@@ -179,6 +182,7 @@ namespace AssetProcessorMessagesTests
m_assetSystemComponent->Deactivate();
m_batchApplicationManager->Destroy();
#endif // !AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
}
void RunNetworkRequest(AZStd::function<void()> func) const
@@ -222,7 +226,11 @@ namespace AssetProcessorMessagesTests
AZStd::unique_ptr<AzFramework::AssetSystem::BaseAssetProcessorMessage> m_response;
};
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(AssetProcessorMessages, DISABLED_All)
#else
TEST_F(AssetProcessorMessages, All)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
// Test that we can successfully send network messages and have them arrive for processing
// For messages that have a response, it also verifies the response comes back
@@ -300,7 +308,11 @@ namespace AssetProcessorMessagesTests
});
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(AssetProcessorMessages, DISABLED_GetUnresolvedProductReferences_Succeeds)
#else
TEST_F(AssetProcessorMessages, GetUnresolvedProductReferences_Succeeds)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
using namespace AzToolsFramework::AssetDatabase;
@@ -25,6 +25,8 @@
#include <utility>
#include <AzTest/AzTest.h>
namespace UnitTests
{
//using namespace testing;
@@ -478,12 +480,20 @@ namespace UnitTests
TestGetSourcesByPath("dev/", { }, false);
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(SourceFileRelocatorTest, DISABLED_GetSources_MultipleScanFolders_Fails)
#else
TEST_F(SourceFileRelocatorTest, GetSources_MultipleScanFolders_Fails)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
TestGetSourcesByPath("*", { }, false);
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(SourceFileRelocatorTest, DISABLED_GetSources_PartialPath_FailsWithNoResults)
#else
TEST_F(SourceFileRelocatorTest, GetSources_PartialPath_FailsWithNoResults)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
TestGetSourcesByPath("older/*", { }, false);
}
@@ -530,7 +540,11 @@ namespace UnitTests
TestGetSourcesByPath(filePath.toUtf8().constData(), { "folder/file.foo" }, true, true);
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(SourceFileRelocatorTest, DISABLED_GetSources_HaveMetadataDifferentFileCase_AbsolutePath_Succeeds)
#else
TEST_F(SourceFileRelocatorTest, GetSources_HaveMetadataDifferentFileCase_AbsolutePath_Succeeds)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
QDir tempPath(m_tempDir.path());
@@ -900,7 +914,11 @@ namespace UnitTests
ASSERT_FALSE(AZ::IO::FileIOBase::GetInstance()->Exists(filePath.toUtf8().constData()));
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(SourceFileRelocatorTest, DISABLED_Delete_Real_Readonly_Fails)
#else
TEST_F(SourceFileRelocatorTest, Delete_Real_Readonly_Fails)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
QDir tempPath(m_tempDir.path());
@@ -83,15 +83,6 @@ namespace AssetProcessor
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(3), AssetBuilderSDK::Platform_OSX);
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(4), AssetBuilderSDK::Platform_NONE);
#if defined(TOOLS_SUPPORT_XENIA)
createJobsRequest.m_enabledPlatforms = {
{ "xenia", {}
}
};
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(0), AssetBuilderSDK::Platform_XENIA);
ASSERT_EQ(createJobsRequest.GetEnabledPlatformAt(1), AssetBuilderSDK::Platform_NONE);
#endif
createJobsRequest.m_enabledPlatforms = {
{ "pc", {}
}, { "es3", {}
@@ -145,7 +136,6 @@ namespace AssetProcessor
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_ES3));
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_IOS));
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_OSX));
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_XENIA));
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_PROVO));
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_SALEM));
ASSERT_TRUE(createJobsRequest.IsPlatformValid(AssetBuilderSDK::Platform_JASPER));
@@ -14,6 +14,7 @@
#include "native/AssetManager/PathDependencyManager.h"
#include <AzToolsFramework/ToolsFileUtils/ToolsFileUtils.h>
#include <AzTest/AzTest.h>
#include <limits>
@@ -27,7 +28,13 @@ public:
friend class GTEST_TEST_CLASS_NAME_(MultiplatformPathDependencyTest, AssetProcessed_Impl_MultiplatformDependencies);
friend class GTEST_TEST_CLASS_NAME_(MultiplatformPathDependencyTest, AssetProcessed_Impl_MultiplatformDependencies_DeferredResolution);
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
friend class GTEST_TEST_CLASS_NAME_(MultiplatformPathDependencyTest, DISABLED_AssetProcessed_Impl_MultiplatformDependencies_SourcePath);
#else
friend class GTEST_TEST_CLASS_NAME_(MultiplatformPathDependencyTest, AssetProcessed_Impl_MultiplatformDependencies_SourcePath);
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, DeleteFolder_SignalsDeleteOfContainedFiles);
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, QueryAbsolutePathDependenciesRecursive_BasicTest);
@@ -69,9 +76,20 @@ public:
friend class GTEST_TEST_CLASS_NAME_(AbsolutePathProductDependencyTest, UnresolvedProductPathDependency_AssetProcessedTwice_ValidatePathDependenciesMap);
friend class GTEST_TEST_CLASS_NAME_(AbsolutePathProductDependencyTest, UnresolvedSourceFileTypeProductPathDependency_DependencyHasNoProductOutput_ValidatePathDependenciesMap);
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, DISABLED_ModtimeSkipping_FileUnchanged_WithoutModtimeSkipping);
#else
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, ModtimeSkipping_FileUnchanged_WithoutModtimeSkipping);
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, ModtimeSkipping_FileUnchanged);
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, DISABLED_ModtimeSkipping_EnablePlatform_ShouldProcessFilesForPlatform);
#else
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, ModtimeSkipping_EnablePlatform_ShouldProcessFilesForPlatform);
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, ModtimeSkipping_ModifyFile);
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, ModtimeSkipping_ModifyFile_AndThenRevert_ProcessesAgain);
friend class GTEST_TEST_CLASS_NAME_(ModtimeScanningTest, ModtimeSkipping_ModifyFilesSameHash_BothProcess);
@@ -2413,7 +2431,11 @@ TEST_F(PathDependencyTest, ChangeDependencies_Existing_ResolveCorrectly)
);
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(PathDependencyTest, DISABLED_MixedPathDependencies_Existing_ResolveCorrectly)
#else
TEST_F(PathDependencyTest, MixedPathDependencies_Existing_ResolveCorrectly)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
using namespace AssetProcessor;
using namespace AssetBuilderSDK;
@@ -2712,7 +2734,11 @@ TEST_F(MultiplatformPathDependencyTest, AssetProcessed_Impl_MultiplatformDepende
ASSERT_NE(SearchDependencies(dependencyContainer, asset1.m_products[0]), SearchDependencies(dependencyContainer, asset1.m_products[1]));
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(MultiplatformPathDependencyTest, DISABLED_AssetProcessed_Impl_MultiplatformDependencies_SourcePath)
#else
TEST_F(MultiplatformPathDependencyTest, AssetProcessed_Impl_MultiplatformDependencies_SourcePath)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
// One product will be pc, one will be console (order is non-deterministic)
TestAsset asset1("testAsset1");
@@ -4585,7 +4611,11 @@ void ModtimeScanningTest::SetFileContents(QString filePath, QString contents)
file.close();
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(ModtimeScanningTest, DISABLED_ModtimeSkipping_FileUnchanged_WithoutModtimeSkipping)
#else
TEST_F(ModtimeScanningTest, ModtimeSkipping_FileUnchanged_WithoutModtimeSkipping)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
using namespace AzToolsFramework::AssetSystem;
@@ -4614,7 +4644,11 @@ TEST_F(ModtimeScanningTest, ModtimeSkipping_FileUnchanged)
ExpectNoWork();
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(ModtimeScanningTest, DISABLED_ModtimeSkipping_EnablePlatform_ShouldProcessFilesForPlatform)
#else
TEST_F(ModtimeScanningTest, ModtimeSkipping_EnablePlatform_ShouldProcessFilesForPlatform)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
using namespace AzToolsFramework::AssetSystem;
@@ -5118,7 +5152,11 @@ TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WildcardM
dependList.clear();
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(AssetProcessorManagerTest, DISABLED_RemoveSource_RemoveCacheFolderIfEmpty_Ok)
#else
TEST_F(AssetProcessorManagerTest, RemoveSource_RemoveCacheFolderIfEmpty_Ok)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
using namespace AssetProcessor;
using namespace AssetBuilderSDK;
@@ -13,6 +13,8 @@
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include "native/tests/platformconfiguration/platformconfigurationtests.h"
#include <AzTest/AzTest.h>
const char TestAppRoot[] = ":/testdata";
const char EmptyDummyProjectName[] = "EmptyDummyProject";
const char DummyProjectName[] = "DummyProject";
@@ -111,7 +113,6 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Regular_Platforms)
ASSERT_NE(config.GetPlatformByIdentifier(AzToolsFramework::AssetSystem::GetHostAssetPlatform()), nullptr);
ASSERT_NE(config.GetPlatformByIdentifier("es3"), nullptr);
ASSERT_NE(config.GetPlatformByIdentifier("server"), nullptr);
ASSERT_EQ(config.GetPlatformByIdentifier("xenia"), nullptr);
ASSERT_TRUE(config.GetPlatformByIdentifier("es3")->HasTag("mobile"));
ASSERT_TRUE(config.GetPlatformByIdentifier("es3")->HasTag("renderer"));
@@ -431,7 +432,11 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_RegularExcludes)
ASSERT_FALSE(config.IsFileExcluded("blahblah/Levels/blahblahhold/whatever.test"));
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(PlatformConfigurationUnitTests, DISABLED_TestFailReadConfigFile_Recognizers)
#else
TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Recognizers)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
using namespace AzToolsFramework::AssetSystem;
using namespace AssetProcessor;
@@ -530,7 +535,6 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_Overrides)
ASSERT_NE(config.GetPlatformByIdentifier("es3"), nullptr);
ASSERT_NE(config.GetPlatformByIdentifier("provo"), nullptr);
// this override swaps server with provo in that it turns ON provo, turns off server
ASSERT_EQ(config.GetPlatformByIdentifier("xenia"), nullptr);
ASSERT_EQ(config.GetPlatformByIdentifier("server"), nullptr); // this should be off due to overrides
// there is a rule which only output on server, so that rule should be omitted
@@ -13,9 +13,9 @@
#include <QHash>
#include "native/tests/AssetProcessorTest.h"
#include <AzCore/std/parallel/thread.h>
#include <AzTest/AzTest.h>
using namespace AssetUtilities;
@@ -119,7 +119,11 @@ TEST_F(AssetUtilitiesTest, UpdateToCorrectCase_MissingFile_ReturnsFalse)
EXPECT_FALSE(AssetUtilities::UpdateToCorrectCase(canonicalTempDirPath, fileName));
}
#if AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
TEST_F(AssetUtilitiesTest, DISABLED_UpdateToCorrectCase_ExistingFile_ReturnsTrue_CorrectsCase)
#else
TEST_F(AssetUtilitiesTest, UpdateToCorrectCase_ExistingFile_ReturnsTrue_CorrectsCase)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
{
QTemporaryDir dir;
QDir tempPath(dir.path());
@@ -187,31 +187,31 @@ void MainWindow::Activate()
ui->connectionTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->connectionTreeView, &QTreeView::customContextMenuRequested, this, &MainWindow::OnConnectionContextMenu);
//white list connections
//allowed list connections
connect(m_guiApplicationManager->GetConnectionManager(), &ConnectionManager::FirstTimeAddedToRejctedList, this, &MainWindow::FirstTimeAddedToRejctedList);
connect(m_guiApplicationManager->GetConnectionManager(), &ConnectionManager::SyncWhiteListAndRejectedList, this, &MainWindow::SyncWhiteListAndRejectedList);
connect(ui->whiteListWhiteListedConnectionsListView, &QListView::clicked, this, &MainWindow::OnWhiteListedConnectionsListViewClicked);
ui->whiteListWhiteListedConnectionsListView->setModel(&m_whitelistedAddresses);
connect(ui->whiteListRejectedConnectionsListView, &QListView::clicked, this, &MainWindow::OnRejectedConnectionsListViewClicked);
ui->whiteListRejectedConnectionsListView->setModel(&m_rejectedAddresses);
connect(m_guiApplicationManager->GetConnectionManager(), &ConnectionManager::SyncAllowedListAndRejectedList, this, &MainWindow::SyncAllowedListAndRejectedList);
connect(ui->allowListAllowedListConnectionsListView, &QListView::clicked, this, &MainWindow::OnAllowedListConnectionsListViewClicked);
ui->allowListAllowedListConnectionsListView->setModel(&m_allowedListAddresses);
connect(ui->allowedListRejectedConnectionsListView, &QListView::clicked, this, &MainWindow::OnRejectedConnectionsListViewClicked);
ui->allowedListRejectedConnectionsListView->setModel(&m_rejectedAddresses);
connect(ui->whiteListEnableCheckBox, &QCheckBox::toggled, this, &MainWindow::OnWhiteListCheckBoxToggled);
connect(ui->allowedListEnableCheckBox, &QCheckBox::toggled, this, &MainWindow::OnAllowedListCheckBoxToggled);
connect(ui->whiteListAddHostNameToolButton, &QToolButton::clicked, this, &MainWindow::OnAddHostNameWhiteListButtonClicked);
connect(ui->whiteListAddIPToolButton, &QPushButton::clicked, this, &MainWindow::OnAddIPWhiteListButtonClicked);
connect(ui->allowedListAddHostNameToolButton, &QToolButton::clicked, this, &MainWindow::OnAddHostNameAllowedListButtonClicked);
connect(ui->allowedListAddIPToolButton, &QPushButton::clicked, this, &MainWindow::OnAddIPAllowedListButtonClicked);
connect(ui->whiteListToWhiteListToolButton, &QPushButton::clicked, this, &MainWindow::OnToWhiteListButtonClicked);
connect(ui->whiteListToRejectedListToolButton, &QToolButton::clicked, this, &MainWindow::OnToRejectedListButtonClicked);
connect(ui->allowedListToAllowedListToolButton, &QPushButton::clicked, this, &MainWindow::OnToAllowedListButtonClicked);
connect(ui->allowedListToRejectedListToolButton, &QToolButton::clicked, this, &MainWindow::OnToRejectedListButtonClicked);
//set the input validator for ip addresses on the add address line edit
QRegExp validHostName("^((?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|\\b-){0,61}[0-9A-Za-z])?(?:\\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|\\b-){0,61}[0-9A-Za-z])?)*\\.?)$");
QRegExp validIP("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\/([0-9]|[1-2][0-9]|3[0-2]))?$|^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$");
QRegExpValidator* hostNameValidator = new QRegExpValidator(validHostName, this);
ui->whiteListAddHostNameLineEdit->setValidator(hostNameValidator);
ui->allowedListAddHostNameLineEdit->setValidator(hostNameValidator);
QRegExpValidator* ipValidator = new QRegExpValidator(validIP, this);
ui->whiteListAddIPLineEdit->setValidator(ipValidator);
ui->allowedListAddIPLineEdit->setValidator(ipValidator);
//Job view
m_jobSortFilterProxy->setSourceModel(m_jobsModel);
@@ -555,65 +555,65 @@ void MainWindow::OnAddConnection(bool /*checked*/)
m_guiApplicationManager->GetConnectionManager()->addUserConnection();
}
void MainWindow::OnWhiteListedConnectionsListViewClicked()
void MainWindow::OnAllowedListConnectionsListViewClicked()
{
ui->whiteListRejectedConnectionsListView->clearSelection();
ui->allowedListRejectedConnectionsListView->clearSelection();
}
void MainWindow::OnRejectedConnectionsListViewClicked()
{
ui->whiteListWhiteListedConnectionsListView->clearSelection();
ui->allowListAllowedListConnectionsListView->clearSelection();
}
void MainWindow::OnWhiteListCheckBoxToggled()
void MainWindow::OnAllowedListCheckBoxToggled()
{
if (!ui->whiteListEnableCheckBox->isChecked())
if (!ui->allowedListEnableCheckBox->isChecked())
{
//warn this is not safe
if(QMessageBox::Ok == QMessageBox::warning(this, tr("!!!WARNING!!!"), tr("Turning off white listing poses a significant security risk as it would allow any device to connect to your asset processor and that device will have READ/WRITE access to the Asset Processors file system. Only do this if you sure you know what you are doing and accept the risks."),
if(QMessageBox::Ok == QMessageBox::warning(this, tr("!!!WARNING!!!"), tr("Turning off allowed listing poses a significant security risk as it would allow any device to connect to your asset processor and that device will have READ/WRITE access to the Asset Processors file system. Only do this if you sure you know what you are doing and accept the risks."),
QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel))
{
ui->whiteListRejectedConnectionsListView->clearSelection();
ui->whiteListWhiteListedConnectionsListView->clearSelection();
ui->whiteListAddHostNameLineEdit->setEnabled(false);
ui->whiteListAddHostNameToolButton->setEnabled(false);
ui->whiteListAddIPLineEdit->setEnabled(false);
ui->whiteListAddIPToolButton->setEnabled(false);
ui->whiteListWhiteListedConnectionsListView->setEnabled(false);
ui->whiteListRejectedConnectionsListView->setEnabled(false);
ui->whiteListToWhiteListToolButton->setEnabled(false);
ui->whiteListToRejectedListToolButton->setEnabled(false);
ui->allowedListRejectedConnectionsListView->clearSelection();
ui->allowListAllowedListConnectionsListView->clearSelection();
ui->allowedListAddHostNameLineEdit->setEnabled(false);
ui->allowedListAddHostNameToolButton->setEnabled(false);
ui->allowedListAddIPLineEdit->setEnabled(false);
ui->allowedListAddIPToolButton->setEnabled(false);
ui->allowListAllowedListConnectionsListView->setEnabled(false);
ui->allowedListRejectedConnectionsListView->setEnabled(false);
ui->allowedListToAllowedListToolButton->setEnabled(false);
ui->allowedListToRejectedListToolButton->setEnabled(false);
}
else
{
ui->whiteListEnableCheckBox->setChecked(true);
ui->allowedListEnableCheckBox->setChecked(true);
}
}
else
{
ui->whiteListAddHostNameLineEdit->setEnabled(true);
ui->whiteListAddHostNameToolButton->setEnabled(true);
ui->whiteListAddIPLineEdit->setEnabled(true);
ui->whiteListAddIPToolButton->setEnabled(true);
ui->whiteListWhiteListedConnectionsListView->setEnabled(true);
ui->whiteListRejectedConnectionsListView->setEnabled(true);
ui->whiteListToWhiteListToolButton->setEnabled(true);
ui->whiteListToRejectedListToolButton->setEnabled(true);
ui->allowedListAddHostNameLineEdit->setEnabled(true);
ui->allowedListAddHostNameToolButton->setEnabled(true);
ui->allowedListAddIPLineEdit->setEnabled(true);
ui->allowedListAddIPToolButton->setEnabled(true);
ui->allowListAllowedListConnectionsListView->setEnabled(true);
ui->allowedListRejectedConnectionsListView->setEnabled(true);
ui->allowedListToAllowedListToolButton->setEnabled(true);
ui->allowedListToRejectedListToolButton->setEnabled(true);
}
m_guiApplicationManager->GetConnectionManager()->WhiteListingEnabled(ui->whiteListEnableCheckBox->isChecked());
m_guiApplicationManager->GetConnectionManager()->AllowedListingEnabled(ui->allowedListEnableCheckBox->isChecked());
}
void MainWindow::OnAddHostNameWhiteListButtonClicked()
void MainWindow::OnAddHostNameAllowedListButtonClicked()
{
QString text = ui->whiteListAddHostNameLineEdit->text();
const QRegExpValidator *hostnameValidator = static_cast<const QRegExpValidator *>(ui->whiteListAddHostNameLineEdit->validator());
QString text = ui->allowedListAddHostNameLineEdit->text();
const QRegExpValidator *hostnameValidator = static_cast<const QRegExpValidator *>(ui->allowedListAddHostNameLineEdit->validator());
int pos;
QValidator::State state = hostnameValidator->validate(text, pos);
if (state == QValidator::Acceptable)
{
auto lineEdit = ui->whiteListAddHostNameLineEdit;
m_guiApplicationManager->GetConnectionManager()->AddWhiteListedAddress(text);
auto lineEdit = ui->allowedListAddHostNameLineEdit;
m_guiApplicationManager->GetConnectionManager()->AddAddressToAllowedList(text);
lineEdit->clear();
// Clear error state set in LineEdit.
lineEdit->setProperty(AzQtComponents::HasError, false);
@@ -625,16 +625,16 @@ void MainWindow::OnAddHostNameWhiteListButtonClicked()
}
}
void MainWindow::OnAddIPWhiteListButtonClicked()
void MainWindow::OnAddIPAllowedListButtonClicked()
{
QString text = ui->whiteListAddIPLineEdit->text();
const QRegExpValidator *ipValidator = static_cast<const QRegExpValidator *>(ui->whiteListAddIPLineEdit->validator());
QString text = ui->allowedListAddIPLineEdit->text();
const QRegExpValidator *ipValidator = static_cast<const QRegExpValidator *>(ui->allowedListAddIPLineEdit->validator());
int pos;
QValidator::State state = ipValidator->validate(text, pos);
if (state== QValidator::Acceptable)
{
auto lineEdit = ui->whiteListAddIPLineEdit;
m_guiApplicationManager->GetConnectionManager()->AddWhiteListedAddress(text);
auto lineEdit = ui->allowedListAddIPLineEdit;
m_guiApplicationManager->GetConnectionManager()->AddAddressToAllowedList(text);
lineEdit->clear();
// Clear error state set in LineEdit.
lineEdit->setProperty(AzQtComponents::HasError, false);
@@ -648,23 +648,23 @@ void MainWindow::OnAddIPWhiteListButtonClicked()
void MainWindow::OnToRejectedListButtonClicked()
{
QModelIndexList indices = ui->whiteListWhiteListedConnectionsListView->selectionModel()->selectedIndexes();
QModelIndexList indices = ui->allowListAllowedListConnectionsListView->selectionModel()->selectedIndexes();
if(!indices.isEmpty() && indices.first().isValid())
{
QString itemText = indices.first().data(Qt::DisplayRole).toString();
m_guiApplicationManager->GetConnectionManager()->RemoveWhiteListedAddress(itemText);
m_guiApplicationManager->GetConnectionManager()->RemoveAddressFromAllowedList(itemText);
m_guiApplicationManager->GetConnectionManager()->AddRejectedAddress(itemText, true);
}
}
void MainWindow::OnToWhiteListButtonClicked()
void MainWindow::OnToAllowedListButtonClicked()
{
QModelIndexList indices = ui->whiteListRejectedConnectionsListView->selectionModel()->selectedIndexes();
QModelIndexList indices = ui->allowedListRejectedConnectionsListView->selectionModel()->selectedIndexes();
if (!indices.isEmpty() && indices.first().isValid())
{
QString itemText = indices.front().data(Qt::DisplayRole).toString();
m_guiApplicationManager->GetConnectionManager()->RemoveRejectedAddress(itemText);
m_guiApplicationManager->GetConnectionManager()->AddWhiteListedAddress(itemText);
m_guiApplicationManager->GetConnectionManager()->AddAddressToAllowedList(itemText);
}
}
@@ -715,9 +715,9 @@ void MainWindow::ShowWindow()
}
void MainWindow::SyncWhiteListAndRejectedList(QStringList whiteList, QStringList rejectedList)
void MainWindow::SyncAllowedListAndRejectedList(QStringList allowedList, QStringList rejectedList)
{
m_whitelistedAddresses.setStringList(whiteList);
m_allowedListAddresses.setStringList(allowedList);
m_rejectedAddresses.setStringList(rejectedList);
}
@@ -725,7 +725,7 @@ void MainWindow::FirstTimeAddedToRejctedList(QString ipAddress)
{
QMessageBox* msgBox = new QMessageBox(this);
msgBox->setText(tr("!!!Rejected Connection!!!"));
msgBox->setInformativeText(ipAddress + tr(" tried to connect and was rejected because it was not on the white list. If you want this connection to be allowed go to connections tab and add it to white list."));
msgBox->setInformativeText(ipAddress + tr(" tried to connect and was rejected because it was not on the allowed list. If you want this connection to be allowed go to connections tab and add it to allowed list."));
msgBox->setStandardButtons(QMessageBox::Ok);
msgBox->setDefaultButton(QMessageBox::Ok);
msgBox->setWindowModality(Qt::NonModal);
@@ -107,7 +107,7 @@ public:
public Q_SLOTS:
void ShowWindow();
void SyncWhiteListAndRejectedList(QStringList whiteList, QStringList rejectedList);
void SyncAllowedListAndRejectedList(QStringList allowedList, QStringList rejectedList);
void FirstTimeAddedToRejctedList(QString ipAddress);
void SaveLogPanelState();
void OnAssetProcessorStatusChanged(const AssetProcessor::AssetProcessorStatusEntry entry);
@@ -163,17 +163,17 @@ private:
void OnConnectionSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
QStringListModel m_rejectedAddresses;
QStringListModel m_whitelistedAddresses;
QStringListModel m_allowedListAddresses;
void OnWhiteListedConnectionsListViewClicked();
void OnAllowedListConnectionsListViewClicked();
void OnRejectedConnectionsListViewClicked();
void OnWhiteListCheckBoxToggled();
void OnAllowedListCheckBoxToggled();
void OnAddHostNameWhiteListButtonClicked();
void OnAddIPWhiteListButtonClicked();
void OnAddHostNameAllowedListButtonClicked();
void OnAddIPAllowedListButtonClicked();
void OnToWhiteListButtonClicked();
void OnToAllowedListButtonClicked();
void OnToRejectedListButtonClicked();
void UpdateJobLogView(QModelIndex selectedIndex);
@@ -917,11 +917,11 @@
<widget class="AzQtComponents::TableView" name="connectionTreeView"/>
</item>
<item>
<widget class="QFrame" name="whiteListOuterFrame">
<widget class="QFrame" name="allowedListOuterFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<layout class="QVBoxLayout" name="whiteListVerticalLayout">
<layout class="QVBoxLayout" name="allowedListVerticalLayout">
<property name="spacing">
<number>0</number>
</property>
@@ -938,8 +938,8 @@
<number>0</number>
</property>
<item>
<widget class="QWidget" name="whiteListTopBarWidget" native="true">
<layout class="QHBoxLayout" name="whiteListHorizontalBar">
<widget class="QWidget" name="allowedListTopBarWidget" native="true">
<layout class="QHBoxLayout" name="allowedListHorizontalBar">
<property name="spacing">
<number>6</number>
</property>
@@ -956,12 +956,12 @@
<number>4</number>
</property>
<item>
<widget class="QCheckBox" name="whiteListEnableCheckBox">
<widget class="QCheckBox" name="allowedListEnableCheckBox">
<property name="toolTip">
<string>Enable or Disable white listing. White listing is a security feature which limits what can connect to the asset processor.</string>
<string>Enable or Disable allowed listing. Allowed listing is a security feature which limits what can connect to the asset processor.</string>
</property>
<property name="text">
<string>Enable white listing</string>
<string>Enable allowed listing</string>
</property>
<property name="checked">
<bool>true</bool>
@@ -969,7 +969,7 @@
</widget>
</item>
<item>
<spacer name="whiteListBarSpacer">
<spacer name="allowedListBarSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -982,7 +982,7 @@
</spacer>
</item>
<item>
<widget class="Line" name="whiteListSeparatorLine">
<widget class="Line" name="allowedListSeparatorLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -992,8 +992,8 @@
</widget>
</item>
<item>
<widget class="QWidget" name="whiteListBottomBarWidget" native="true">
<layout class="QHBoxLayout" name="whiteListHorizontalBar2">
<widget class="QWidget" name="allowedListBottomBarWidget" native="true">
<layout class="QHBoxLayout" name="allowedListHorizontalBar2">
<property name="leftMargin">
<number>4</number>
</property>
@@ -1007,9 +1007,9 @@
<number>4</number>
</property>
<item>
<widget class="QLabel" name="whiteListAddHostNameLabel">
<widget class="QLabel" name="allowedListAddHostNameLabel">
<property name="toolTip">
<string>White list a hostname. EX. MyComputer321</string>
<string>Allowed list a hostname. EX. MyComputer321</string>
</property>
<property name="text">
<string>Add Host Name</string>
@@ -1017,12 +1017,12 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="whiteListAddHostNameLineEdit"/>
<widget class="QLineEdit" name="allowedListAddHostNameLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="whiteListAddHostNameToolButton">
<widget class="QToolButton" name="allowedListAddHostNameToolButton">
<property name="toolTip">
<string>Add the hostname to the white list.</string>
<string>Add the hostname to the allowed list.</string>
</property>
<property name="text">
<string/>
@@ -1037,7 +1037,7 @@
</widget>
</item>
<item>
<spacer name="whiteListHorizontalBar2Spacer">
<spacer name="allowedListHorizontalBar2Spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -1050,9 +1050,9 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="whiteListAddIPLabel">
<widget class="QLabel" name="allowedListAddIPLabel">
<property name="toolTip">
<string>White list an ipv4 or ipv6 address with or without a CIDR range. EX. 192.168.0.20 or 192.168.0.0/24 or 2001:db8:85a3:8d3:1319:8a2e:370:7348 or 2001:db8:85a3:8d3:1319:8a2e:370:7348/32</string>
<string>Allowed list an ipv4 or ipv6 address with or without a CIDR range. EX. 192.168.0.20 or 192.168.0.0/24 or 2001:db8:85a3:8d3:1319:8a2e:370:7348 or 2001:db8:85a3:8d3:1319:8a2e:370:7348/32</string>
</property>
<property name="text">
<string>Add IP Address</string>
@@ -1060,12 +1060,12 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="whiteListAddIPLineEdit"/>
<widget class="QLineEdit" name="allowedListAddIPLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="whiteListAddIPToolButton">
<widget class="QToolButton" name="allowedListAddIPToolButton">
<property name="toolTip">
<string>Add the ip address to the white list.</string>
<string>Add the ip address to the allowed list.</string>
</property>
<property name="text">
<string/>
@@ -1083,9 +1083,9 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="whiteListHorizontalBar3">
<layout class="QHBoxLayout" name="allowedListHorizontalBar3">
<item>
<widget class="Line" name="whiteListLine">
<widget class="Line" name="allowedListLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -1094,22 +1094,22 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="whiteListHorizontalLabelsLayout">
<layout class="QHBoxLayout" name="allowedListHorizontalLabelsLayout">
<property name="leftMargin">
<number>4</number>
</property>
<item>
<widget class="QLabel" name="whiteListWhiteListedConnnectionListLabel">
<widget class="QLabel" name="allowedListAllowedListedConnnectionListLabel">
<property name="toolTip">
<string>White listed connection are addresses, ranges and name that will be allowed to connect to the asset processor.</string>
<string>Allowed listed connection are addresses, ranges and name that will be allowed to connect to the asset processor.</string>
</property>
<property name="text">
<string>White Listed Connections</string>
<string>Allowed Listed Connections</string>
</property>
</widget>
</item>
<item>
<spacer name="whiteListHorizontalLabelSpacer1">
<spacer name="allowedListHorizontalLabelSpacer1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -1122,7 +1122,7 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="whiteListRejectedConnectionListLabel">
<widget class="QLabel" name="allowedListRejectedConnectionListLabel">
<property name="toolTip">
<string>Rejected connections are addresses that failed to connect to the asset processor.</string>
</property>
@@ -1132,7 +1132,7 @@
</widget>
</item>
<item>
<spacer name="whiteListHorizontalLabelSpacer2">
<spacer name="allowedListHorizontalLabelSpacer2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -1147,7 +1147,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="whiteListHorizontalViewsLayout">
<layout class="QHBoxLayout" name="allowedListHorizontalViewsLayout">
<property name="spacing">
<number>9</number>
</property>
@@ -1164,16 +1164,16 @@
<number>4</number>
</property>
<item>
<widget class="QListView" name="whiteListWhiteListedConnectionsListView">
<widget class="QListView" name="allowListAllowedListConnectionsListView">
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="whiteListButtonVerticalLayout">
<layout class="QVBoxLayout" name="allowedListButtonVerticalLayout">
<item>
<spacer name="whiteListVerticalSpacer1">
<spacer name="allowedListVerticalSpacer1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -1186,9 +1186,9 @@
</spacer>
</item>
<item>
<widget class="QToolButton" name="whiteListToWhiteListToolButton">
<widget class="QToolButton" name="allowedListToAllowedListToolButton">
<property name="toolTip">
<string>Move a entry from rejected to the white list.</string>
<string>Move a entry from rejected to the allowed list.</string>
</property>
<property name="text">
<string/>
@@ -1203,7 +1203,7 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="whiteListToRejectedListToolButton">
<widget class="QToolButton" name="allowedListToRejectedListToolButton">
<property name="toolTip">
<string>Remove an entry from the whtie list.</string>
</property>
@@ -1220,7 +1220,7 @@
</widget>
</item>
<item>
<spacer name="whiteListVerticalSpacer2">
<spacer name="allowedListVerticalSpacer2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -1235,7 +1235,7 @@
</layout>
</item>
<item>
<widget class="QListView" name="whiteListRejectedConnectionsListView">
<widget class="QListView" name="allowedListRejectedConnectionsListView">
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
@@ -21,6 +21,7 @@
#include "native/FileWatcher/FileWatcher.h"
#include "native/unittests/MockConnectionHandler.h"
#include <AzTest/AzTest.h>
#include <QCoreApplication>
@@ -39,11 +40,14 @@ namespace AssetProcessor
: AssetProcessorManager(config, parent)
{}
friend class AssetProcessorManagerUnitTests;
friend class AssetProcessorManagerUnitTests_ScanFolders;
#if !AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
friend class AssetProcessorManagerUnitTests;
friend class AssetProcessorManagerUnitTests_JobKeys;
friend class AssetProcessorManagerUnitTests_JobDependencies_Fingerprint;
friend class AssetProcessorManagerUnitTests_CheckOutputFolders;
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
public:
using GetRelativeProductPathFromFullSourceOrProductPathRequest = AzFramework::AssetSystem::GetRelativeProductPathFromFullSourceOrProductPathRequest;
@@ -54,11 +58,15 @@ namespace AssetProcessor
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests)
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests_ScanFolders)
#if !AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests)
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests_JobKeys)
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests_JobDependencies_Fingerprint)
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests_CheckOutputFolders)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
namespace
{
@@ -45,7 +45,7 @@ Q_SIGNALS:
virtual void StartTest() override;
};
class AssetProcessorManagerUnitTests_CheckOutputFolders
class AssetProcessorManagerUnitTests_CheckOutputFolders
: public UnitTestRun
{
Q_OBJECT
@@ -12,6 +12,7 @@
#include "FileWatcherUnitTests.h"
#include "native/FileWatcher/FileWatcher.h"
#include "native/AssetManager/assetProcessorManager.h"
#include <AzTest/AzTest.h>
#include <QCoreApplication>
using namespace AssetProcessor;
@@ -305,4 +306,6 @@ void FileWatcherUnitTestRunner::StartTest()
Q_EMIT UnitTestPassed();
}
#if !AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
REGISTER_UNIT_TEST(FileWatcherUnitTestRunner)
#endif // !AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
@@ -10,6 +10,7 @@
*
*/
#include "RCcontrollerUnitTests.h"
#include <AzTest/AzTest.h>
#include <QCoreApplication>
#if defined(AZ_PLATFORM_LINUX)
@@ -770,7 +771,7 @@ void RCcontrollerUnitTests::RunRCControllerTests()
Q_EMIT UnitTestPassed();
}
#if !AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
REGISTER_UNIT_TEST(RCcontrollerUnitTests)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
@@ -19,6 +19,7 @@
#include "native/utilities/ByteArrayStream.h"
#include <AzCore/Component/Entity.h>
#include <AzCore/Jobs/Job.h>
#include <AzTest/AzTest.h>
#include <QThread>
@@ -65,7 +66,9 @@ namespace AssetProcessor
};
}
#if !AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
REGISTER_UNIT_TEST(UtilitiesUnitTests)
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
void UtilitiesUnitTests::StartTest()
{
@@ -674,7 +674,7 @@ void GUIApplicationManager::FileChanged(QString path)
if (m_connectionManager)
{
m_connectionManager->UpdateWhiteListFromBootStrap();
m_connectionManager->UpdateAllowedListFromBootStrap();
}
// Re-merge the Bootstrap.cfg into the SettingsRegistry
@@ -600,7 +600,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
return {};
}
QString ReadWhitelistFromSettingsRegistry(QString initialFolder /*= QString()*/)
QString ReadAllowedlistFromSettingsRegistry(QString initialFolder /*= QString()*/)
{
if (initialFolder.isEmpty())
{
@@ -613,14 +613,14 @@ to ensure that the address is correct. Asset Processor won't be running in serve
initialFolder = assetRoot.absolutePath();
}
constexpr size_t BufferSize = AZ_ARRAY_SIZE(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + AZStd::char_traits<char>::length("/white_list");
AZStd::fixed_string<BufferSize> whiteListKey{ AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey };
whiteListKey += "/white_list";
constexpr size_t BufferSize = AZ_ARRAY_SIZE(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + AZStd::char_traits<char>::length("/allowed_list");
AZStd::fixed_string<BufferSize> allowedListKey{ AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey };
allowedListKey += "/allowed_list";
AZ::SettingsRegistryInterface::FixedValueString whiteListIp;
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry && settingsRegistry->Get(whiteListIp, whiteListKey))
AZ::SettingsRegistryInterface::FixedValueString allowedListIp;
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry && settingsRegistry->Get(allowedListIp, allowedListKey))
{
return QString::fromUtf8(whiteListIp.c_str(), aznumeric_cast<int>(whiteListIp.size()));
return QString::fromUtf8(allowedListIp.c_str(), aznumeric_cast<int>(allowedListIp.size()));
}
return {};
@@ -651,7 +651,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
return {};
}
bool WriteWhitelistToBootstrap(QStringList newWhiteList)
bool WriteAllowedlistToBootstrap(QStringList newAllowedList)
{
QDir assetRoot;
ComputeAssetRoot(assetRoot);
@@ -669,21 +669,21 @@ to ensure that the address is correct. Asset Processor won't be running in serve
return false;
}
// regexp that matches either the beginning of the file, some whitespace, and white_list, or,
// matches a newline, then whitespace, then white_list it will not match comments.
QRegExp whiteListPattern("(^|\\n)\\s*white_list\\s*=\\s*(.+)", Qt::CaseInsensitive, QRegExp::RegExp);
// regexp that matches either the beginning of the file, some whitespace, and allowed_list, or,
// matches a newline, then whitespace, then allowed_list it will not match comments.
QRegExp allowedListPattern("(^|\\n)\\s*allowed_list\\s*=\\s*(.+)", Qt::CaseInsensitive, QRegExp::RegExp);
//read the file line by line and try to find the white_list line
QString readWhiteList;
QString whiteListline;
//read the file line by line and try to find the allowed_list line
QString readAllowedList;
QString allowedListline;
while (!bootstrapFile.atEnd())
{
QString contents(bootstrapFile.readLine());
int matchIdx = whiteListPattern.indexIn(contents);
int matchIdx = allowedListPattern.indexIn(contents);
if (matchIdx != -1)
{
whiteListline = contents;
readWhiteList = whiteListPattern.cap(2);
allowedListline = contents;
readAllowedList = allowedListPattern.cap(2);
break;
}
}
@@ -694,15 +694,15 @@ to ensure that the address is correct. Asset Processor won't be running in serve
fileContents = bootstrapFile.readAll();
bootstrapFile.close();
//format the new white list
QString formattedNewWhiteList = newWhiteList.join(", ");
//format the new allowed list
QString formattedNewAllowedList = newAllowedList.join(", ");
//if we didn't find a white_list entry then append one
if (whiteListline.isEmpty())
//if we didn't find a allowed_list entry then append one
if (allowedListline.isEmpty())
{
fileContents.append("\nwhite_list = " + formattedNewWhiteList + "\n");
fileContents.append("\nallowed_list = " + formattedNewAllowedList + "\n");
}
else if (QString::compare(formattedNewWhiteList, readWhiteList, Qt::CaseInsensitive) == 0)
else if (QString::compare(formattedNewAllowedList, readAllowedList, Qt::CaseInsensitive) == 0)
{
// no need to update, they match
return true;
@@ -710,7 +710,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
else
{
//Replace the found line with a new one
fileContents.replace(whiteListline, "white_list = " + formattedNewWhiteList + "\n");
fileContents.replace(allowedListline, "allowed_list = " + formattedNewAllowedList + "\n");
}
// Make the bootstrap file writable
@@ -104,14 +104,14 @@ namespace AssetUtilities
//! force=true is supplied
QString ComputeGameName(QString gameNameOverride = QString(), bool force = false);
//! Reads the white list directly from the bootstrap file
QString ReadWhitelistFromSettingsRegistry(QString initialFolder = QString());
//! Reads the allowed list directly from the bootstrap file
QString ReadAllowedlistFromSettingsRegistry(QString initialFolder = QString());
//! Reads the white list directly from the bootstrap file
//! Reads the allowed list directly from the bootstrap file
QString ReadRemoteIpFromSettingsRegistry(QString initialFolder = QString());
//! Writes the white list directly to the bootstrap file
bool WriteWhitelistToBootstrap(QStringList whiteList);
//! Writes the allowed list directly to the bootstrap file
bool WriteAllowedlistToBootstrap(QStringList allowedList);
//! Writes the remote ip directly to the bootstrap file
bool WriteRemoteIpToBootstrap(QString remoteIp);