Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"appx",
"exe",
"zip",
"tar",
"inno",
"nullsoft",
"wix",
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace AppInstaller::CLI::Resource
WINGET_DEFINE_RESOURCE_STRINGID(ArchitectureArgumentDescription);
WINGET_DEFINE_RESOURCE_STRINGID(ArchiveFailedMalwareScan);
WINGET_DEFINE_RESOURCE_STRINGID(ArchiveFailedMalwareScanOverridden);
WINGET_DEFINE_RESOURCE_STRINGID(ArchiveScanNotSupportedForTar);
WINGET_DEFINE_RESOURCE_STRINGID(ArgumentForSinglePackageProvidedWithMultipleQueries);
WINGET_DEFINE_RESOURCE_STRINGID(AuthenticationAccountArgumentDescription);
WINGET_DEFINE_RESOURCE_STRINGID(AuthenticationModeArgumentDescription);
Expand Down
12 changes: 11 additions & 1 deletion src/AppInstallerCLICore/Workflows/ArchiveFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ namespace AppInstaller::CLI::Workflow
{
if (context.Args.Contains(Execution::Args::Type::Manifest))
{
if (context.Get<Execution::Data::Installer>().value().BaseInstallerType == InstallerTypeEnum::Tar)
{
AICLI_LOG(CLI, Warning, << "Archive malware scan is not supported for tar archives");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might need to figure out the answer to this gap before we could accept it. I doubt tar is immune to the same kinds malicious use as zip.

context.Reporter.Warn() << Resource::String::ArchiveScanNotSupportedForTar << std::endl;
return;
}

bool scanResult = Archive::ScanZipFile(context.Get<Execution::Data::InstallerPath>());

if (scanResult)
Expand Down Expand Up @@ -54,7 +61,10 @@ namespace AppInstaller::CLI::Workflow
AICLI_LOG(CLI, Info, << "Extracting archive to: " << destinationFolder);
context.Reporter.Info() << Resource::String::ExtractingArchive << std::endl;

if (Settings::User().Get<Settings::Setting::ArchiveExtractionMethod>() == Archive::ExtractionMethod::Tar)
const bool useTar = context.Get<Execution::Data::Installer>().value().BaseInstallerType == InstallerTypeEnum::Tar
|| Settings::User().Get<Settings::Setting::ArchiveExtractionMethod>() == Archive::ExtractionMethod::Tar;

if (useTar)
{
context << ShellExecuteExtractArchive(installerPath, destinationFolder);
}
Expand Down
13 changes: 13 additions & 0 deletions src/AppInstallerCLICore/Workflows/DownloadFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ namespace AppInstaller::CLI::Workflow
return L".msix"sv;
case InstallerTypeEnum::Zip:
return L".zip"sv;
case InstallerTypeEnum::Tar:
{
const auto& fileName = GetFileNameFromURI(installer->Url);
if (fileName.has_extension())
{
return fileName.extension().c_str();
}
else
{
return L".tar.gz"sv;
}
}
case InstallerTypeEnum::Font:
{
const auto& fileName = GetFileNameFromURI(installer->Url);
Expand Down Expand Up @@ -302,6 +314,7 @@ namespace AppInstaller::CLI::Workflow
case InstallerTypeEnum::Wix:
case InstallerTypeEnum::Font:
case InstallerTypeEnum::Zip:
case InstallerTypeEnum::Tar:
context << DownloadInstallerFile;
break;
case InstallerTypeEnum::Msix:
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/Workflows/InstallFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ namespace AppInstaller::CLI::Workflow
context << details::PortableInstall;
break;
case InstallerTypeEnum::Zip:
case InstallerTypeEnum::Tar:
context << details::ArchiveInstall;
break;
case InstallerTypeEnum::Font:
Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Workflows/RepairFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ namespace AppInstaller::CLI::Workflow
ShowPromptsForSinglePackage(/* ensureAcceptance */ true) <<
DownloadInstaller;

if (installerType == InstallerTypeEnum::Zip)
if (installerType == InstallerTypeEnum::Zip || installerType == InstallerTypeEnum::Tar)
{
context <<
ScanArchiveFromLocalManifest <<
Expand Down
3 changes: 3 additions & 0 deletions src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,9 @@ Please specify one of them using the --source option to proceed.</value>
<data name="ExtractingArchive" xml:space="preserve">
<value>Extracting archive...</value>
</data>
<data name="ArchiveScanNotSupportedForTar" xml:space="preserve">
<value>Malware scanning is not supported for tar archives; proceeding without scan</value>
</data>
<data name="ArchiveFailedMalwareScan" xml:space="preserve">
<value>Archive scan detected malware. To override this check use --ignore-local-archive-malware-scan</value>
<comment>{Locked="--ignore-local-archive-malware-scan"}</comment>
Expand Down
8 changes: 7 additions & 1 deletion src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ namespace AppInstaller::Manifest
{
result = InstallerTypeEnum::Zip;
}
else if (IsTarInstallerTypeAlias(inStrLower))
{
result = InstallerTypeEnum::Tar;
}
else if (inStrLower == "appx" || inStrLower == "msix")
{
result = InstallerTypeEnum::Msix;
Expand Down Expand Up @@ -581,6 +585,8 @@ namespace AppInstaller::Manifest
return "wix"sv;
case InstallerTypeEnum::Zip:
return "zip"sv;
case InstallerTypeEnum::Tar:
return "tar"sv;
case InstallerTypeEnum::Burn:
return "burn"sv;
case InstallerTypeEnum::MSStore:
Expand Down Expand Up @@ -973,7 +979,7 @@ namespace AppInstaller::Manifest

bool IsArchiveType(InstallerTypeEnum installerType)
{
return (installerType == InstallerTypeEnum::Zip);
return (installerType == InstallerTypeEnum::Zip || installerType == InstallerTypeEnum::Tar);
}

bool IsPortableType(InstallerTypeEnum installerType)
Expand Down
12 changes: 12 additions & 0 deletions src/AppInstallerCommonCore/Public/winget/ManifestCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma once
#include <AppInstallerStrings.h>
#include <AppInstallerVersions.h>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
Expand Down Expand Up @@ -109,6 +110,7 @@
Msi,
Nullsoft,
Zip,
Tar,
Msix,
Exe,
Burn,
Expand All @@ -117,6 +119,16 @@
Font,
};

inline bool IsTarInstallerTypeAlias(std::string_view s)
{
using namespace std::string_view_literals;
static constexpr std::string_view aliases[] = {
"tar"sv, "tgz"sv, "tbz2"sv, "tbz"sv, "txz"sv, "tzst"sv,

Check failure on line 126 in src/AppInstallerCommonCore/Public/winget/ManifestCommon.h

View workflow job for this annotation

GitHub Actions / Check Spelling

`tbz` is not a recognized word (unrecognized-spelling)

Check failure on line 126 in src/AppInstallerCommonCore/Public/winget/ManifestCommon.h

View workflow job for this annotation

GitHub Actions / Check Spelling

`tzst` is not a recognized word (unrecognized-spelling)

Check failure on line 126 in src/AppInstallerCommonCore/Public/winget/ManifestCommon.h

View workflow job for this annotation

GitHub Actions / Check Spelling

`txz` is not a recognized word (unrecognized-spelling)

Check failure on line 126 in src/AppInstallerCommonCore/Public/winget/ManifestCommon.h

View workflow job for this annotation

GitHub Actions / Check Spelling

`tbz` is not a recognized word (unrecognized-spelling)

Check failure on line 126 in src/AppInstallerCommonCore/Public/winget/ManifestCommon.h

View workflow job for this annotation

GitHub Actions / Check Spelling

`tgz` is not a recognized word (unrecognized-spelling)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of a huge number of aliases here; I would rather just have the one name for it. Tar might not even be the best name depending on how tar.exe determines the format. As it is, this type is more like "compatible with tar.exe -xf based on the file name". I think it would actually be good long term if we can set the format of tar to match what we expect, but I couldn't find that option.

So I guess what I'm saying is, I just want Tar but I also want to prevent people from lying and saying Tar when it is actually some Foo that tar.exe supports. If we shipped with this and then eventually had some version of purelib that could scan tars, those "foos" would suddenly be broken unless the scanner just supports everything that tar.exe supports.

"tar.gz"sv, "tar.bz2"sv, "tar.xz"sv, "tar.zst"sv, "tar.lz4"sv,

Check failure on line 127 in src/AppInstallerCommonCore/Public/winget/ManifestCommon.h

View workflow job for this annotation

GitHub Actions / Check Spelling

`zst` is not a recognized word (unrecognized-spelling)
};
return std::find(std::begin(aliases), std::end(aliases), s) != std::end(aliases);
}

enum class UpdateBehaviorEnum
{
Unknown,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,10 @@ namespace AppInstaller::Repository::Rest::Schema::V1_0::Json
{
return InstallerTypeEnum::Zip;
}
else if (IsTarInstallerTypeAlias(inStrLower))
{
return InstallerTypeEnum::Tar;
}
else if (inStrLower == "appx" || inStrLower == "msix")
{
return InstallerTypeEnum::Msix;
Expand Down
4 changes: 4 additions & 0 deletions src/Microsoft.Management.Deployment/Converters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ namespace winrt::Microsoft::Management::Deployment::implementation
return Microsoft::Management::Deployment::PackageInstallerType::Wix;
case ::AppInstaller::Manifest::InstallerTypeEnum::Zip:
return Microsoft::Management::Deployment::PackageInstallerType::Zip;
case ::AppInstaller::Manifest::InstallerTypeEnum::Tar:
return Microsoft::Management::Deployment::PackageInstallerType::Tar;
case ::AppInstaller::Manifest::InstallerTypeEnum::Unknown:
return Microsoft::Management::Deployment::PackageInstallerType::Unknown;
}
Expand Down Expand Up @@ -316,6 +318,8 @@ namespace winrt::Microsoft::Management::Deployment::implementation
return ::AppInstaller::Manifest::InstallerTypeEnum::Wix;
case Microsoft::Management::Deployment::PackageInstallerType::Zip:
return ::AppInstaller::Manifest::InstallerTypeEnum::Zip;
case Microsoft::Management::Deployment::PackageInstallerType::Tar:
return ::AppInstaller::Manifest::InstallerTypeEnum::Tar;
case Microsoft::Management::Deployment::PackageInstallerType::Unknown:
return ::AppInstaller::Manifest::InstallerTypeEnum::Unknown;
}
Expand Down
5 changes: 5 additions & 0 deletions src/Microsoft.Management.Deployment/PackageManager.idl
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@
/// Font type.
Font,
},
[contract(Microsoft.Management.Deployment.WindowsPackageManagerContract, 14)]
{
/// Tar type (includes .tar.gz, .tgz, .tar.bz2, .tar.xz, and bare .tar).

Check failure on line 483 in src/Microsoft.Management.Deployment/PackageManager.idl

View workflow job for this annotation

GitHub Actions / Check Spelling

`tgz` is not a recognized word (unrecognized-spelling)
Tar,
},
};

/// The package installer scope.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
/// </summary>
Zip,

/// <summary>
/// Tar (includes .tar.gz, .tgz, .tar.bz2, .tar.xz, and bare .tar).

Check failure on line 45 in src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/PSObjects/PSPackageInstallerType.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`tgz` is not a recognized word (unrecognized-spelling)
/// </summary>
Tar,

/// <summary>
/// Msix.
/// </summary>
Expand Down
Loading