diff --git a/src/AppInstallerCLITests/TestData/Manifest-Bad-VersionInvalid.yaml b/src/AppInstallerCLITests/TestData/Manifest-Bad-VersionInvalid.yaml index 4fbbbed293..bccffc2b8e 100644 --- a/src/AppInstallerCLITests/TestData/Manifest-Bad-VersionInvalid.yaml +++ b/src/AppInstallerCLITests/TestData/Manifest-Bad-VersionInvalid.yaml @@ -1,7 +1,7 @@ # Bad manifest. Invalid version Id: microsoft.msixsdk Name: MSIX SDK -Version: Not.A.Version +Version: 1.0.9-/ Publisher: Microsoft InstallerType: Zip Installers: diff --git a/src/AppInstallerCLITests/TestData/Manifest-Good-Minimum.yaml b/src/AppInstallerCLITests/TestData/Manifest-Good-Minimum.yaml index 1d95c8cff7..4d6f3cd8be 100644 --- a/src/AppInstallerCLITests/TestData/Manifest-Good-Minimum.yaml +++ b/src/AppInstallerCLITests/TestData/Manifest-Good-Minimum.yaml @@ -1,7 +1,7 @@ # Minimum required Id: microsoft.msixsdk Name: MSIX SDK -Version: 1.7.32 +Version: 1.07.32-beta Publisher: Microsoft InstallerType: Zip Installers: diff --git a/src/AppInstallerRepositoryCore/Manifest/Manifest.cpp b/src/AppInstallerRepositoryCore/Manifest/Manifest.cpp index 50597c985b..166e029741 100644 --- a/src/AppInstallerRepositoryCore/Manifest/Manifest.cpp +++ b/src/AppInstallerRepositoryCore/Manifest/Manifest.cpp @@ -80,7 +80,7 @@ namespace AppInstaller::Manifest { "Id", [this](const YAML::Node& value) { Id = value.as(); Utility::Trim(Id); }, true, "^[\\S]+\\.[\\S]+$" }, { "Name", [this](const YAML::Node& value) { Name = value.as(); Utility::Trim(Name); }, true }, { "Version", [this](const YAML::Node& value) { Version = value.as(); Utility::Trim(Version); }, true, - "^(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])(\\.(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])){0,3}$" }, + /* File name chars not allowed */ "^[^\\\\/:\\*\\?\"<>\\|\\x01-\\x1f]+$" }, { "Publisher", [this](const YAML::Node& value) { Publisher = value.as(); }, true }, { "AppMoniker", [this](const YAML::Node& value) { AppMoniker = value.as(); Utility::Trim(AppMoniker); } }, { "Channel", [this](const YAML::Node& value) { Channel = value.as(); Utility::Trim(Channel); } }, @@ -151,6 +151,16 @@ namespace AppInstaller::Manifest resultErrors.emplace_back(ManifestError::FieldNotSupported, "Channel", Channel); } + try + { + // Version value should be successfully parsed + Utility::Version test{ Version }; + } + catch (const std::exception&) + { + resultErrors.emplace_back(ManifestError::InvalidFieldValue, "Version", Version); + } + // Check duplicate installer entry. {installerType, arch, language and scope} combination is the key. // Todo: use the comparator from ManifestComparator when that one is fully implemented. auto installerCmp = [](const ManifestInstaller& in1, const ManifestInstaller& in2)