commit 1a6a60fddd95480d4f1d9bb1c9abbab84f3cc4b4 parent 2fd4089c14176e5b09f792da4ea14bdb53283e43 Author: yao-msft <50888816+yao-msft@users.noreply.github.com> Date: Wed, 14 Apr 2021 17:09:57 -0700 Enable code analysis, sdl checks, binskim and fix related errors (#856) Code analysis is only enabled on debug builds due to disk space limitation in Azure DevOps. Diffstat:
59 files changed, 635 insertions(+), 83 deletions(-)
diff --git a/.github/actions/spelling/allow.txt b/.github/actions/spelling/allow.txt @@ -329,6 +329,7 @@ robuffer rowcount rowid rubengustorage +ruleset runsettings runtimes safecast diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt @@ -41,4 +41,4 @@ http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer REQUIRE\(RestHelper::GetRestAPIBaseUri\(".*"\) == L".*" # URL escaped characters -\%[0-9A-F]{2}- \ No newline at end of file +\%[0-9A-F]{2} diff --git a/azure-pipelines.nuget.yml b/azure-pipelines.nuget.yml @@ -15,6 +15,7 @@ variables: jobs: - job: "Build" + timeoutInMinutes: 120 variables: BuildVer: $[counter(${{ parameters.version }}, 1)] version: ${{ parameters.version }}.$(BuildVer) diff --git a/azure-pipelines.yml b/azure-pipelines.yml @@ -39,6 +39,7 @@ jobs: workingDirectory: 'src' - job: 'Build' + timeoutInMinutes: 120 dependsOn: 'GetReleaseTag' condition: always() variables: @@ -280,7 +281,7 @@ jobs: -ExeTestInstallerPath $(system.defaultWorkingDirectory)\src\x86\Release\AppInstallerTestExeInstaller\AppInstallerTestExeInstaller.exe -PackageCertificatePath $(AppInstallerTest.secureFilePath)' condition: succeededOrFailed() - + - task: PublishBuildArtifacts@1 displayName: Publish E2E Tests Packaged x86 Log inputs: @@ -295,7 +296,7 @@ jobs: PathtoPublish: 'src\x64\Release\AppInstallerCLI\AppInstallerCLI.exe' ArtifactName: 'AppInstallerCLI.exe' publishLocation: 'Container' - + - task: PublishBuildArtifacts@1 displayName: Publish Util Binary inputs: @@ -309,10 +310,19 @@ jobs: PathtoPublish: 'src\x64\Release\WinGetUtil\WinGetUtil.pdb' ArtifactName: 'WinGetUtil.pdb' publishLocation: 'Container' - + - task: ComponentGovernanceComponentDetection@0 displayName: Component Governance inputs: scanType: 'Register' verbosity: 'Verbose' - alertWarningLevel: 'High'- \ No newline at end of file + alertWarningLevel: 'High' + + # Run BimSkim for all the binaries + - task: BinSkim@3 + displayName: 'Run BinSkim ' + inputs: + arguments: 'analyze "$(system.defaultWorkingDirectory)\src\AppInstaller*CLI.exe" "$(system.defaultWorkingDirectory)\src\WinGet*Util.dll" --config default --recurse' + + - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2 + displayName: 'Publish Security Analysis Logs' diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln @@ -15,6 +15,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Project", "Project", "{8D53D749-D51C-46F8-A162-9371AAA6C2E7}" ProjectSection(SolutionItems) = preProject ..\azure-pipelines.loc.yml = ..\azure-pipelines.loc.yml + ..\azure-pipelines.nuget.yml = ..\azure-pipelines.nuget.yml ..\azure-pipelines.yml = ..\azure-pipelines.yml ..\cgmanifest.json = ..\cgmanifest.json ..\README.md = ..\README.md @@ -98,6 +99,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "policy", "policy", "{1A4795 ..\doc\admx\DesktopAppInstaller.admx = ..\doc\admx\DesktopAppInstaller.admx EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1A5D7A7D-5CB2-47D5-B40D-4E61CAEDC798}" + ProjectSection(SolutionItems) = preProject + CodeAnalysis.ruleset = CodeAnalysis.ruleset + EndProjectSection +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution ManifestSchema\ManifestSchema.vcxitems*{1622da16-914f-4f57-a259-d5169003cc8c}*SharedItemsImports = 4 @@ -376,7 +382,6 @@ Global {C1624B2F-2BF6-4E28-92FA-1BF85C6B62A8}.Release|ARM64.ActiveCfg = Release {C1624B2F-2BF6-4E28-92FA-1BF85C6B62A8}.Release|x64.ActiveCfg = Release {C1624B2F-2BF6-4E28-92FA-1BF85C6B62A8}.Release|x86.ActiveCfg = Release - {C1624B2F-2BF6-4E28-92FA-1BF85C6B62A8}.Release|x86.Build.0 = Release {3B8466CF-4FDD-4329-9C80-91321C4AAC99}.Debug|ARM.ActiveCfg = Debug|x86 {3B8466CF-4FDD-4329-9C80-91321C4AAC99}.Debug|ARM64.ActiveCfg = Debug|x86 {3B8466CF-4FDD-4329-9C80-91321C4AAC99}.Debug|x64.ActiveCfg = Debug|x64 diff --git a/src/AppInstallerCLI/AppInstallerCLI.vcxproj b/src/AppInstallerCLI/AppInstallerCLI.vcxproj @@ -65,6 +65,18 @@ <WholeProgramOptimization>true</WholeProgramOptimization> <LinkIncremental>false</LinkIncremental> </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> @@ -83,34 +95,58 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> @@ -138,6 +174,12 @@ <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">stdcpp17</LanguageStandard> <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">stdcpp17</LanguageStandard> <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">stdcpp17</LanguageStandard> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</EnablePREfast> </ClCompile> <Link> <SubSystem>Console</SubSystem> @@ -161,6 +203,8 @@ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</TreatWarningAsError> <ControlFlowGuard Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ControlFlowGuard> <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">stdcpp17</LanguageStandard> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EnablePREfast> </ClCompile> <Manifest> <AdditionalManifestFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)..\manifest\shared.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles> @@ -188,6 +232,14 @@ <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">stdcpp17</LanguageStandard> <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">stdcpp17</LanguageStandard> <LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|x64'">stdcpp17</LanguageStandard> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</EnablePREfast> </ClCompile> <Link> <SubSystem>Console</SubSystem> diff --git a/src/AppInstallerCLICore/AppInstallerCLICore.vcxproj b/src/AppInstallerCLICore/AppInstallerCLICore.vcxproj @@ -65,6 +65,18 @@ <WholeProgramOptimization>true</WholeProgramOptimization> <LinkIncremental>false</LinkIncremental> </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> @@ -82,34 +94,58 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> @@ -131,6 +167,12 @@ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</TreatWarningAsError> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</EnablePREfast> </ClCompile> <Link> <GenerateWindowsMetadata>false</GenerateWindowsMetadata> @@ -144,6 +186,8 @@ <PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions);CLICOREDLLBUILD</PreprocessorDefinitions> <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir);$(ProjectDir)..\AppInstallerRepositoryCore;$(ProjectDir)..\AppInstallerRepositoryCore\Public;$(ProjectDir)..\AppInstallerCommonCore\Public;$(ProjectDir)..\JsonCppLib\json;$(ProjectDir)..\JsonCppLib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</TreatWarningAsError> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EnablePREfast> </ClCompile> <Link> <SubSystem Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Windows</SubSystem> @@ -163,6 +207,14 @@ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</TreatWarningAsError> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</EnablePREfast> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> diff --git a/src/AppInstallerCLICore/COMContext.h b/src/AppInstallerCLICore/COMContext.h @@ -1,8 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include "pch.h" -#include "..\AppInstallerCommonCore\Public\AppInstallerProgress.h" +#include "AppInstallerProgress.h" #include "ExecutionContext.h" #include "Workflows/WorkflowBase.h" diff --git a/src/AppInstallerCLICore/ExecutionContext.h b/src/AppInstallerCLICore/ExecutionContext.h @@ -14,8 +14,7 @@ // Also returns from the current function. #define AICLI_TERMINATE_CONTEXT_ARGS(_context_,_hr_,_ret_) \ do { \ - HRESULT AICLI_TERMINATE_CONTEXT_ARGS_hr = _hr_; \ - _context_.Terminate(AICLI_TERMINATE_CONTEXT_ARGS_hr, __FILE__, __LINE__); \ + _context_.Terminate(_hr_, __FILE__, __LINE__); \ return _ret_; \ } while(0,0) diff --git a/src/AppInstallerCLICore/VTSupport.h b/src/AppInstallerCLICore/VTSupport.h @@ -57,8 +57,8 @@ namespace AppInstaller::CLI::VirtualTerminal ConstructedSequence(const ConstructedSequence& other) : m_str(other.m_str) { Set(m_str); } ConstructedSequence& operator=(const ConstructedSequence& other) { m_str = other.m_str; Set(m_str); } - ConstructedSequence(ConstructedSequence&& other) : m_str(std::move(other.m_str)) { Set(m_str); } - ConstructedSequence& operator=(ConstructedSequence&& other) { m_str = std::move(other.m_str); Set(m_str); } + ConstructedSequence(ConstructedSequence&& other) noexcept : m_str(std::move(other.m_str)) { Set(m_str); } + ConstructedSequence& operator=(ConstructedSequence&& other) noexcept { m_str = std::move(other.m_str); Set(m_str); } void Append(const Sequence& sequence); diff --git a/src/AppInstallerCLICore/Workflows/InstallFlow.cpp b/src/AppInstallerCLICore/Workflows/InstallFlow.cpp @@ -172,7 +172,7 @@ namespace AppInstaller::CLI::Workflow } catch (const winrt::hresult_error& e) { - if (e.code() == HRESULT_FROM_WIN32(ERROR_NO_RANGES_PROCESSED) || + if (static_cast<HRESULT>(e.code()) == HRESULT_FROM_WIN32(ERROR_NO_RANGES_PROCESSED) || HRESULT_FACILITY(e.code()) == FACILITY_HTTP) { // Failed to get signature hash through HttpStream, use download @@ -636,8 +636,8 @@ namespace AppInstaller::CLI::Workflow changes.size(), findByManifest.Matches.size(), packagesInBoth.size(), - toLog ? static_cast<std::string_view>(toLog->GetProperty(PackageVersionProperty::Name)) : "", - toLog ? static_cast<std::string_view>(toLog->GetProperty(PackageVersionProperty::Version)) : "", + toLog ? static_cast<std::string>(toLog->GetProperty(PackageVersionProperty::Name)) : "", + toLog ? static_cast<std::string>(toLog->GetProperty(PackageVersionProperty::Version)) : "", toLog ? static_cast<std::string_view>(toLogMetadata[PackageVersionMetadata::Publisher]) : "", toLog ? static_cast<std::string_view>(toLogMetadata[PackageVersionMetadata::Locale]) : "" ); diff --git a/src/AppInstallerCLICore/Workflows/MSStoreInstallerHandler.cpp b/src/AppInstallerCLICore/Workflows/MSStoreInstallerHandler.cpp @@ -28,7 +28,7 @@ namespace AppInstaller::CLI::Workflow { // We are aggregating all AppInstallItem progresses into one. // Averaging every progress for now until we have a better way to find overall progress. - uint64_t overallProgressMax = 100 * installItems.Size(); + uint64_t overallProgressMax = 100 * static_cast<uint64_t>(installItems.Size()); uint64_t currentProgress = 0; while (currentProgress < overallProgressMax) diff --git a/src/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.cpp b/src/AppInstallerCLICore/Workflows/ShellExecuteInstallerHandler.cpp @@ -42,7 +42,7 @@ namespace AppInstaller::CLI::Workflow } if (waitResult != WAIT_TIMEOUT) { - THROW_LAST_ERROR_MSG("Unexpected WaitForSingleObjectResult: %d", waitResult); + THROW_LAST_ERROR_MSG("Unexpected WaitForSingleObjectResult: %lu", waitResult); } } diff --git a/src/AppInstallerCLICore/pch.h b/src/AppInstallerCLICore/pch.h @@ -8,7 +8,7 @@ #include <WinInet.h> #pragma warning( push ) -#pragma warning ( disable : 4458 4100 4702 ) +#pragma warning ( disable : 4458 4100 6031 4702 ) #include <valijson/schema.hpp> #include <valijson/schema_parser.hpp> #include <valijson/validator.hpp> @@ -37,8 +37,12 @@ #include <winrt/Windows.ApplicationModel.Resources.Core.h> #include <winrt/Windows.ApplicationModel.Store.Preview.InstallControl.h> +#pragma warning( push ) +#pragma warning ( disable : 6001 6285 6340 6388 ) +#include <wil/result.h> #include <wil/result_macros.h> #include <wil/safecast.h> +#pragma warning( pop ) #include <wrl/client.h> #include <AppxPackaging.h> diff --git a/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj b/src/AppInstallerCommonCore/AppInstallerCommonCore.vcxproj @@ -87,6 +87,18 @@ <WholeProgramOptimization>false</WholeProgramOptimization> <LinkIncremental>false</LinkIncremental> </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> @@ -104,22 +116,37 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Fuzzing|Win32'"> <LinkIncremental>false</LinkIncremental> @@ -128,6 +155,9 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Fuzzing|x64'"> <LinkIncremental>false</LinkIncremental> @@ -136,6 +166,9 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Fuzzing|ARM'"> <LinkIncremental>false</LinkIncremental> @@ -144,6 +177,9 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Fuzzing|ARM64'"> <LinkIncremental>false</LinkIncremental> @@ -169,6 +205,12 @@ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</TreatWarningAsError> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</EnablePREfast> </ClCompile> <Link> <GenerateWindowsMetadata>false</GenerateWindowsMetadata> @@ -182,6 +224,8 @@ <PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions);CLICOREDLLBUILD</PreprocessorDefinitions> <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir);$(ProjectDir)Public;$(ProjectDir)Telemetry;$(ProjectDir)..\binver;$(ProjectDir)..\YamlCppLib\libyaml\include;$(ProjectDir)..\JsonCppLib\json;$(ProjectDir)..\JsonCppLib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</TreatWarningAsError> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EnablePREfast> </ClCompile> <Link> <SubSystem Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Windows</SubSystem> @@ -201,6 +245,14 @@ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</TreatWarningAsError> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</EnablePREfast> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> diff --git a/src/AppInstallerCommonCore/Deployment.cpp b/src/AppInstallerCommonCore/Deployment.cpp @@ -46,8 +46,8 @@ namespace AppInstaller::Deployment { AICLI_LOG(Core, Error, << "Deployment failed #" << id << ": " << Utility::ConvertToUTF8(deployResult.ErrorText())); - // Note that while the format string is char*, it gets converted to wchar before being used and thus %s needs a wchar. - THROW_HR_MSG(deployResult.ExtendedErrorCode(), "Install failed: %s", deployResult.ErrorText().c_str()); + // Note that while the format string is char*, it gets converted to wchar before being used. + THROW_HR_MSG(deployResult.ExtendedErrorCode(), "Install failed: %ws", deployResult.ErrorText().c_str()); } else { diff --git a/src/AppInstallerCommonCore/HttpStream/HttpClientWrapper.h b/src/AppInstallerCommonCore/HttpStream/HttpClientWrapper.h @@ -2,7 +2,7 @@ // Licensed under the MIT License. #pragma once -#include "pch.h" + namespace AppInstaller::Utility::HttpStream { @@ -38,7 +38,7 @@ namespace AppInstaller::Utility::HttpStream winrt::Windows::Foundation::Uri m_requestUri = nullptr; winrt::Windows::Foundation::Uri m_redirectUri = nullptr; std::wstring m_contentType; - unsigned long long m_sizeInBytes; + unsigned long long m_sizeInBytes = 0; std::wstring m_etagHeader; std::wstring m_lastModifiedHeader; diff --git a/src/AppInstallerCommonCore/HttpStream/HttpLocalCache.h b/src/AppInstallerCommonCore/HttpStream/HttpLocalCache.h @@ -2,7 +2,7 @@ // Licensed under the MIT License. #pragma once -#include "pch.h" + #include "HttpClientWrapper.h" namespace AppInstaller::Utility::HttpStream @@ -10,7 +10,7 @@ namespace AppInstaller::Utility::HttpStream // Represents an entry in the cache. struct CachedPage { - int lastAccessCounter; + int lastAccessCounter = 0; winrt::Windows::Storage::Streams::IBuffer buffer; }; diff --git a/src/AppInstallerCommonCore/HttpStream/HttpRandomAccessStream.h b/src/AppInstallerCommonCore/HttpStream/HttpRandomAccessStream.h @@ -2,7 +2,6 @@ // Licensed under the MIT License. #pragma once -#include "pch.h" #include "HttpClientWrapper.h" #include "HttpLocalCache.h" @@ -37,7 +36,7 @@ namespace AppInstaller::Utility::HttpStream private: std::shared_ptr<HttpClientWrapper> m_httpHelper; std::unique_ptr<HttpLocalCache> m_httpLocalCache; - unsigned long long m_size; - unsigned long long m_requestedPosition; + unsigned long long m_size = 0; + unsigned long long m_requestedPosition = 0; }; } \ No newline at end of file diff --git a/src/AppInstallerCommonCore/Manifest/YamlParser.cpp b/src/AppInstallerCommonCore/Manifest/YamlParser.cpp @@ -18,7 +18,7 @@ namespace AppInstaller::Manifest::YamlParser if (!entry.Root.IsMap()) { - THROW_EXCEPTION_MSG(ManifestException(APPINSTALLER_CLI_ERROR_INVALID_MANIFEST), "The manifest does not contain a valid root. File: %S", entry.FileName.c_str()); + THROW_EXCEPTION_MSG(ManifestException(APPINSTALLER_CLI_ERROR_INVALID_MANIFEST), "The manifest does not contain a valid root. File: %hs", entry.FileName.c_str()); } if (!entry.Root["PackageIdentifier"]) @@ -99,7 +99,7 @@ namespace AppInstaller::Manifest::YamlParser auto& firstYamlManifest = input[0]; if (!firstYamlManifest.Root.IsMap()) { - THROW_EXCEPTION_MSG(ManifestException(APPINSTALLER_CLI_ERROR_INVALID_MANIFEST), "The manifest does not contain a valid root. File: %S", firstYamlManifest.FileName.c_str()); + THROW_EXCEPTION_MSG(ManifestException(APPINSTALLER_CLI_ERROR_INVALID_MANIFEST), "The manifest does not contain a valid root. File: %hs", firstYamlManifest.FileName.c_str()); } if (firstYamlManifest.Root["ManifestVersion"sv]) @@ -115,7 +115,7 @@ namespace AppInstaller::Manifest::YamlParser // Check max supported version if (manifestVersion.Major() > s_MaxSupportedMajorVersion) { - THROW_EXCEPTION_MSG(ManifestException(APPINSTALLER_CLI_ERROR_UNSUPPORTED_MANIFESTVERSION), "Unsupported ManifestVersion: %S", manifestVersion.ToString().c_str()); + THROW_EXCEPTION_MSG(ManifestException(APPINSTALLER_CLI_ERROR_UNSUPPORTED_MANIFESTVERSION), "Unsupported ManifestVersion: %hs", manifestVersion.ToString().c_str()); } // Preview manifest validations diff --git a/src/AppInstallerCommonCore/MsixInfo.cpp b/src/AppInstallerCommonCore/MsixInfo.cpp @@ -226,7 +226,7 @@ namespace AppInstaller::Msix // fullNameCount == 1 at this point PWSTR fullNamePtr; - std::wstring buffer(bufferLength + 1, '\0'); + std::wstring buffer(static_cast<size_t>(bufferLength) + 1, L'\0'); THROW_IF_WIN32_ERROR(FindPackagesByPackageFamily(pfn.c_str(), PACKAGE_FILTER_HEAD, &fullNameCount, &fullNamePtr, &bufferLength, &buffer[0], &properties)); if (fullNameCount != 1 || bufferLength == 0) diff --git a/src/AppInstallerCommonCore/NameNormalization.cpp b/src/AppInstallerCommonCore/NameNormalization.cpp @@ -13,7 +13,7 @@ namespace AppInstaller::Utility struct InterimNameNormalizationResult { std::wstring Name; - Architecture Architecture; + Architecture Architecture = Architecture::Unknown; std::wstring Locale; }; diff --git a/src/AppInstallerCommonCore/Public/AppInstallerLanguageUtilities.h b/src/AppInstallerCommonCore/Public/AppInstallerLanguageUtilities.h @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include <wil/result.h> - #include <initializer_list> #include <map> #include <string> @@ -132,7 +130,7 @@ namespace AppInstaller typename Variant::variant_t& GetVariant(Enum e) { auto itr = m_data.find(e); - THROW_HR_IF_MSG(E_NOT_SET, itr == m_data.end(), "GetVariant(%d)", e); + THROW_HR_IF_MSG(E_NOT_SET, itr == m_data.end(), "GetVariant(%d)", static_cast<int>(e)); return itr->second; } diff --git a/src/AppInstallerCommonCore/Public/winget/ManifestYamlParser.h b/src/AppInstallerCommonCore/Public/winget/ManifestYamlParser.h @@ -17,7 +17,7 @@ namespace AppInstaller::Manifest::YamlParser // File name of the manifest file if applicable for error reporting std::string FileName; - ManifestTypeEnum ManifestType; + ManifestTypeEnum ManifestType = ManifestTypeEnum::Preview; }; // fullValidation: Bool to set if manifest creation should perform extra validation that client does not need. diff --git a/src/AppInstallerCommonCore/Public/winget/Regex.h b/src/AppInstallerCommonCore/Public/winget/Regex.h @@ -26,8 +26,8 @@ namespace AppInstaller::Regex Expression(const Expression&); Expression& operator=(const Expression&); - Expression(Expression&&); - Expression& operator=(Expression&&); + Expression(Expression&&) noexcept; + Expression& operator=(Expression&&) noexcept; ~Expression(); diff --git a/src/AppInstallerCommonCore/Public/winget/Yaml.h b/src/AppInstallerCommonCore/Public/winget/Yaml.h @@ -182,8 +182,8 @@ namespace AppInstaller::YAML Emitter(const Emitter&) = delete; Emitter& operator=(const Emitter&) = delete; - Emitter(Emitter&&); - Emitter& operator=(Emitter&&); + Emitter(Emitter&&) noexcept; + Emitter& operator=(Emitter&&) noexcept; ~Emitter(); diff --git a/src/AppInstallerCommonCore/Regex.cpp b/src/AppInstallerCommonCore/Regex.cpp @@ -116,7 +116,7 @@ namespace AppInstaller::Regex // First, send off the unmatched part before the match if (pos > startPos) { - if (!f(false, input.substr(startPos, pos - startPos))) + if (!f(false, input.substr(startPos, static_cast<size_t>(pos) - startPos))) { return; } @@ -127,7 +127,7 @@ namespace AppInstaller::Regex WINGET_THROW_REGEX_ERROR_IF_FAILED(uec, uregex_end); THROW_HR_IF(E_UNEXPECTED, end == -1); - if (!f(true, input.substr(pos, end - pos))) + if (!f(true, input.substr(pos, static_cast<size_t>(end) - pos))) { return; } @@ -181,8 +181,8 @@ namespace AppInstaller::Regex return *this = Expression{ other }; } - Expression::Expression(Expression&&) = default; - Expression& Expression::operator=(Expression&&) = default; + Expression::Expression(Expression&&) noexcept = default; + Expression& Expression::operator=(Expression&&) noexcept = default; Expression::~Expression() = default; diff --git a/src/AppInstallerCommonCore/SHA256.cpp b/src/AppInstallerCommonCore/SHA256.cpp @@ -98,7 +98,7 @@ namespace AppInstaller::Utility { char resultBuffer[65]; - for (int i = 0; i < 32; i++) + for (size_t i = 0; i < 32; i++) { sprintf_s(resultBuffer + i * 2, 3, "%02x", hashBuffer[i]); } @@ -120,7 +120,7 @@ namespace AppInstaller::Utility { resultBuffer.resize(32); - for (int i = 0; i < 32; i++) + for (size_t i = 0; i < 32; i++) { sscanf_s(hashCStr + 2 * i, "%02hhx", &resultBuffer[i]); } diff --git a/src/AppInstallerCommonCore/Yaml.cpp b/src/AppInstallerCommonCore/Yaml.cpp @@ -314,8 +314,8 @@ namespace AppInstaller::YAML SetAllowedInputs<InputType::BeginMap, InputType::BeginSeq>(); } - Emitter::Emitter(Emitter&&) = default; - Emitter& Emitter::operator=(Emitter&&) = default; + Emitter::Emitter(Emitter&&) noexcept = default; + Emitter& Emitter::operator=(Emitter&&) noexcept = default; Emitter::~Emitter() = default; diff --git a/src/AppInstallerCommonCore/YamlWrapper.h b/src/AppInstallerCommonCore/YamlWrapper.h @@ -123,7 +123,7 @@ namespace AppInstaller::YAML::Wrapper Event() = default; DestructionToken m_token; - yaml_event_t m_event; + yaml_event_t m_event = {}; }; // A libyaml yaml_emitter_t. diff --git a/src/AppInstallerCommonCore/pch.h b/src/AppInstallerCommonCore/pch.h @@ -20,7 +20,7 @@ #include <json.h> #pragma warning( push ) -#pragma warning ( disable : 4458 4100 4702 ) +#pragma warning ( disable : 4458 4100 4702 6031 ) #include <valijson/schema.hpp> #include <valijson/schema_parser.hpp> #include <valijson/validator.hpp> @@ -48,10 +48,14 @@ #include <type_traits> #include <vector> +#pragma warning( push ) +#pragma warning ( disable : 6001 6285 6287 6340 6388 ) #include <wil/resource.h> +#include <wil/result.h> #include <wil/result_macros.h> #include <wil/safecast.h> #include <wil/token_helpers.h> +#pragma warning( pop ) #ifndef WINGET_DISABLE_FOR_FUZZING #include <wil/cppwinrt.h> @@ -67,6 +71,7 @@ #include <winrt/Windows.Web.Http.h> #include <winrt/Windows.Web.Http.Headers.h> #include <winrt/Windows.Web.Http.Filters.h> + #endif #include <wrl/client.h> diff --git a/src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj b/src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj @@ -65,6 +65,18 @@ <WholeProgramOptimization>true</WholeProgramOptimization> <LinkIncremental>false</LinkIncremental> </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> @@ -79,34 +91,58 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> @@ -128,6 +164,12 @@ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</TreatWarningAsError> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</EnablePREfast> </ClCompile> <Link> <GenerateWindowsMetadata>false</GenerateWindowsMetadata> @@ -141,6 +183,8 @@ <PreprocessorDefinitions>_NO_ASYNCRTIMP;WIN32;%(PreprocessorDefinitions);CLICOREDLLBUILD</PreprocessorDefinitions> <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir);$(ProjectDir)\Public;$(ProjectDir)..\AppInstallerCommonCore\Public;$(ProjectDir)..\JsonCppLib\json;$(ProjectDir)..\cpprestsdk\cpprestsdk\Release\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</TreatWarningAsError> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EnablePREfast> </ClCompile> <Link> <SubSystem Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Windows</SubSystem> @@ -160,6 +204,14 @@ <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</TreatWarningAsError> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</TreatWarningAsError> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</EnablePREfast> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> diff --git a/src/AppInstallerRepositoryCore/CompositeSource.cpp b/src/AppInstallerRepositoryCore/CompositeSource.cpp @@ -269,7 +269,7 @@ namespace AppInstaller::Repository // Data relevant to correlation for an installed package. struct InstalledPackageData : public PackageData { - size_t MatchIndex; + size_t MatchIndex = 0; }; // For a given package version, prepares the results for it. diff --git a/src/AppInstallerRepositoryCore/Rest/HttpClientHelper.cpp b/src/AppInstallerRepositoryCore/Rest/HttpClientHelper.cpp @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #include "pch.h" -#include "cpprest/http_client.h" -#include "cpprest/json.h" #include "HttpClientHelper.h" namespace AppInstaller::Repository::Rest diff --git a/src/AppInstallerRepositoryCore/Rest/HttpClientHelper.h b/src/AppInstallerRepositoryCore/Rest/HttpClientHelper.h @@ -1,9 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include "pch.h" -#include "cpprest/http_client.h" -#include "cpprest/json.h" +#include <cpprest/http_client.h> +#include <cpprest/json.h> + +#include <optional> +#include <vector> namespace AppInstaller::Repository::Rest { diff --git a/src/AppInstallerRepositoryCore/Rest/RestClient.h b/src/AppInstallerRepositoryCore/Rest/RestClient.h @@ -2,8 +2,8 @@ // Licensed under the MIT License. #pragma once #include <set> +#include <cpprest/json.h> #include "Rest/Schema/IRestClient.h" -#include "cpprest/json.h" namespace AppInstaller::Repository::Rest { diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Interface.cpp b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Interface.cpp @@ -4,8 +4,6 @@ #include "Rest/Schema/1_0/Interface.h" #include "Rest/Schema/IRestClient.h" #include "Rest/HttpClientHelper.h" -#include "cpprest/http_client.h" -#include "cpprest/json.h" #include "Rest/Schema/JsonHelper.h" #include "winget/ManifestValidation.h" #include "Rest/Schema/RestHelper.h" diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Interface.h b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Interface.h @@ -2,7 +2,7 @@ // Licensed under the MIT License. #pragma once #include "Rest/Schema/IRestClient.h" -#include "cpprest/json.h" +#include <cpprest/json.h> #include <vector> namespace AppInstaller::Repository::Rest::Schema::V1_0 diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/CommonJsonConstants.h b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/CommonJsonConstants.h @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include "pch.h" +#include <string_view> namespace AppInstaller::Repository::Rest::Schema::V1_0::Json { diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/InformationResponseDeserializer.cpp b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/InformationResponseDeserializer.cpp @@ -2,7 +2,6 @@ // Licensed under the MIT License. #include "pch.h" #include "Rest/Schema/IRestClient.h" -#include <cpprest/json.h> #include "Rest/Schema/JsonHelper.h" #include "InformationResponseDeserializer.h" #include "CommonJsonConstants.h" diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/InformationResponseDeserializer.h b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/InformationResponseDeserializer.h @@ -1,8 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include "pch.h" -#include "cpprest/json.h" +#include <cpprest/json.h> #include "Rest/Schema/IRestClient.h" namespace AppInstaller::Repository::Rest::Schema::V1_0::Json diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/ManifestDeserializer.cpp b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/ManifestDeserializer.cpp @@ -4,8 +4,6 @@ #include "Rest/Schema/1_0/Interface.h" #include "Rest/Schema/IRestClient.h" #include "Rest/HttpClientHelper.h" -#include "cpprest/http_client.h" -#include "cpprest/json.h" #include "ManifestDeserializer.h" #include "Rest/Schema/JsonHelper.h" #include "Rest/Schema/1_0/Json/CommonJsonConstants.h" diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/ManifestDeserializer.h b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/ManifestDeserializer.h @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include "pch.h" -#include "cpprest/json.h" +#include <winget/Manifest.h> +#include <cpprest/json.h> namespace AppInstaller::Repository::Rest::Schema::V1_0::Json { diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/SearchRequestSerializer.cpp b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/SearchRequestSerializer.cpp @@ -3,7 +3,6 @@ #include "pch.h" #include "Rest/Schema/IRestClient.h" #include "SearchRequestSerializer.h" -#include <cpprest/json.h> #include "Rest/Schema/JsonHelper.h" #include "CommonJsonConstants.h" diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/SearchRequestSerializer.h b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/SearchRequestSerializer.h @@ -1,8 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include "pch.h" -#include "cpprest/json.h" +#include <cpprest/json.h> #include "Rest/Schema/IRestClient.h" namespace AppInstaller::Repository::Rest::Schema::V1_0::Json diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/SearchResponseDeserializer.cpp b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/SearchResponseDeserializer.cpp @@ -3,7 +3,6 @@ #include "pch.h" #include "Rest/Schema/IRestClient.h" #include "SearchResponseDeserializer.h" -#include <cpprest/json.h> #include "Rest/Schema/JsonHelper.h" #include "CommonJsonConstants.h" diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/SearchResponseDeserializer.h b/src/AppInstallerRepositoryCore/Rest/Schema/1_0/Json/SearchResponseDeserializer.h @@ -1,8 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include "pch.h" -#include "cpprest/json.h" +#include <cpprest/json.h> #include "Rest/Schema/IRestClient.h" namespace AppInstaller::Repository::Rest::Schema::V1_0::Json diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/CommonRestConstants.h b/src/AppInstallerRepositoryCore/Rest/Schema/CommonRestConstants.h @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include "pch.h" +#include <AppInstallerVersions.h> namespace AppInstaller::Repository::Rest::Schema { diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/IRestClient.h b/src/AppInstallerRepositoryCore/Rest/Schema/IRestClient.h @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include "pch.h" #include "Microsoft/Schema/Version.h" #include <AppInstallerVersions.h> #include <vector> diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/JsonHelper.h b/src/AppInstallerRepositoryCore/Rest/Schema/JsonHelper.h @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include "pch.h" #include <cpprest/json.h> #include "winget/Manifest.h" diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/RestHelper.cpp b/src/AppInstallerRepositoryCore/Rest/Schema/RestHelper.cpp @@ -2,8 +2,6 @@ // Licensed under the MIT License. #include "pch.h" #include "RestHelper.h" -#include "cpprest/uri_builder.h" -#include "cpprest/http_client.h" #include "Rest/Schema/JsonHelper.h" #include "Rest/Schema/1_0/Json/CommonJsonConstants.h" diff --git a/src/AppInstallerRepositoryCore/Rest/Schema/RestHelper.h b/src/AppInstallerRepositoryCore/Rest/Schema/RestHelper.h @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once -#include "cpprest/json.h" +#include <cpprest/json.h> namespace AppInstaller::Repository::Rest::Schema { diff --git a/src/AppInstallerRepositoryCore/pch.h b/src/AppInstallerRepositoryCore/pch.h @@ -6,8 +6,12 @@ #include <windows.h> #include <urlmon.h> +#pragma warning( push ) +#pragma warning ( disable : 6001 6340 6388 ) #include <wil/resource.h> +#include <wil/result.h> #include <wil/result_macros.h> +#pragma warning( pop ) #include <AppInstallerDateTime.h> #include <AppInstallerDeployment.h> @@ -54,3 +58,10 @@ #include <tuple> #include <type_traits> #include <utility> + +#pragma warning( push ) +#pragma warning ( disable : 26495 26439 ) +#include <cpprest/http_client.h> +#include <cpprest/json.h> +#include <cpprest/uri_builder.h> +#pragma warning( pop ) diff --git a/src/CodeAnalysis.ruleset b/src/CodeAnalysis.ruleset @@ -0,0 +1,251 @@ +<?xml version="1.0" encoding="utf-8"?> +<RuleSet Name="Copy of Microsoft Native Recommended Rules" Description="These rules focus on the most critical and common problems in your native code, including potential security holes and application crashes. You should include this rule set in any custom rule set you create for your native projects. This ruleset is designed to work with Visual Studio Professional edition and higher." ToolsVersion="16.0"> + <Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native"> + <Rule Id="C26100" Action="Warning" /> + <Rule Id="C26101" Action="Warning" /> + <Rule Id="C26110" Action="Warning" /> + <Rule Id="C26111" Action="Warning" /> + <Rule Id="C26112" Action="Warning" /> + <Rule Id="C26115" Action="Warning" /> + <Rule Id="C26116" Action="Warning" /> + <Rule Id="C26117" Action="Warning" /> + <Rule Id="C26140" Action="Warning" /> + <Rule Id="C26437" Action="Warning" /> + <Rule Id="C26439" Action="Warning" /> + <Rule Id="C26441" Action="Warning" /> + <Rule Id="C26444" Action="Warning" /> + <Rule Id="C26449" Action="Warning" /> + <Rule Id="C26450" Action="Warning" /> + <Rule Id="C26451" Action="Warning" /> + <Rule Id="C26452" Action="Warning" /> + <Rule Id="C26453" Action="Warning" /> + <Rule Id="C26454" Action="Warning" /> + <Rule Id="C26478" Action="Warning" /> + <Rule Id="C26495" Action="Warning" /> + <Rule Id="C26498" Action="Warning" /> + <Rule Id="C26815" Action="Warning" /> + <Rule Id="C26816" Action="Warning" /> + <Rule Id="C26817" Action="Warning" /> + <Rule Id="C26819" Action="Warning" /> + <Rule Id="C26820" Action="Warning" /> + <Rule Id="C28020" Action="Warning" /> + <Rule Id="C28021" Action="Warning" /> + <Rule Id="C28022" Action="Warning" /> + <Rule Id="C28023" Action="Warning" /> + <Rule Id="C28024" Action="Warning" /> + <Rule Id="C28039" Action="Warning" /> + <Rule Id="C28112" Action="Warning" /> + <Rule Id="C28113" Action="Warning" /> + <Rule Id="C28125" Action="Warning" /> + <Rule Id="C28137" Action="Warning" /> + <Rule Id="C28138" Action="Warning" /> + <Rule Id="C28159" Action="Warning" /> + <Rule Id="C28160" Action="Warning" /> + <Rule Id="C28163" Action="Warning" /> + <Rule Id="C28164" Action="Warning" /> + <Rule Id="C28182" Action="Warning" /> + <Rule Id="C28183" Action="Warning" /> + <Rule Id="C28193" Action="Warning" /> + <Rule Id="C28196" Action="Warning" /> + <Rule Id="C28202" Action="Warning" /> + <Rule Id="C28203" Action="Warning" /> + <Rule Id="C28205" Action="Warning" /> + <Rule Id="C28206" Action="Warning" /> + <Rule Id="C28207" Action="Warning" /> + <Rule Id="C28209" Action="Warning" /> + <Rule Id="C28210" Action="Warning" /> + <Rule Id="C28211" Action="Warning" /> + <Rule Id="C28212" Action="Warning" /> + <Rule Id="C28213" Action="Warning" /> + <Rule Id="C28214" Action="Warning" /> + <Rule Id="C28215" Action="Warning" /> + <Rule Id="C28216" Action="Warning" /> + <Rule Id="C28217" Action="Warning" /> + <Rule Id="C28218" Action="Warning" /> + <Rule Id="C28219" Action="Warning" /> + <Rule Id="C28220" Action="Warning" /> + <Rule Id="C28221" Action="Warning" /> + <Rule Id="C28222" Action="Warning" /> + <Rule Id="C28223" Action="Warning" /> + <Rule Id="C28224" Action="Warning" /> + <Rule Id="C28225" Action="Warning" /> + <Rule Id="C28226" Action="Warning" /> + <Rule Id="C28227" Action="Warning" /> + <Rule Id="C28228" Action="Warning" /> + <Rule Id="C28229" Action="Warning" /> + <Rule Id="C28230" Action="Warning" /> + <Rule Id="C28231" Action="Warning" /> + <Rule Id="C28232" Action="Warning" /> + <Rule Id="C28233" Action="Warning" /> + <Rule Id="C28234" Action="Warning" /> + <Rule Id="C28235" Action="Warning" /> + <Rule Id="C28236" Action="Warning" /> + <Rule Id="C28237" Action="Warning" /> + <Rule Id="C28238" Action="Warning" /> + <Rule Id="C28239" Action="Warning" /> + <Rule Id="C28240" Action="Warning" /> + <Rule Id="C28241" Action="Warning" /> + <Rule Id="C28243" Action="Warning" /> + <Rule Id="C28244" Action="Warning" /> + <Rule Id="C28245" Action="Warning" /> + <Rule Id="C28246" Action="Warning" /> + <Rule Id="C28250" Action="Warning" /> + <Rule Id="C28251" Action="Warning" /> + <Rule Id="C28252" Action="Warning" /> + <Rule Id="C28253" Action="Warning" /> + <Rule Id="C28254" Action="Warning" /> + <Rule Id="C28262" Action="Warning" /> + <Rule Id="C28263" Action="Warning" /> + <Rule Id="C28267" Action="Warning" /> + <Rule Id="C28272" Action="Warning" /> + <Rule Id="C28273" Action="Warning" /> + <Rule Id="C28275" Action="Warning" /> + <Rule Id="C28279" Action="Warning" /> + <Rule Id="C28280" Action="Warning" /> + <Rule Id="C28282" Action="Warning" /> + <Rule Id="C28285" Action="Warning" /> + <Rule Id="C28286" Action="Warning" /> + <Rule Id="C28287" Action="Warning" /> + <Rule Id="C28288" Action="Warning" /> + <Rule Id="C28289" Action="Warning" /> + <Rule Id="C28290" Action="Warning" /> + <Rule Id="C28291" Action="Warning" /> + <Rule Id="C28300" Action="Warning" /> + <Rule Id="C28301" Action="Warning" /> + <Rule Id="C28302" Action="Warning" /> + <Rule Id="C28303" Action="Warning" /> + <Rule Id="C28304" Action="Warning" /> + <Rule Id="C28305" Action="Warning" /> + <Rule Id="C28306" Action="Warning" /> + <Rule Id="C28307" Action="Warning" /> + <Rule Id="C28308" Action="Warning" /> + <Rule Id="C28309" Action="Warning" /> + <Rule Id="C28350" Action="Warning" /> + <Rule Id="C28351" Action="Warning" /> + <Rule Id="C33001" Action="Warning" /> + <Rule Id="C33004" Action="Warning" /> + <Rule Id="C33005" Action="Warning" /> + <Rule Id="C33010" Action="Warning" /> + <Rule Id="C33011" Action="Warning" /> + <Rule Id="C33020" Action="Warning" /> + <Rule Id="C6001" Action="Warning" /> + <Rule Id="C6011" Action="Warning" /> + <Rule Id="C6029" Action="Warning" /> + <Rule Id="C6031" Action="Warning" /> + <Rule Id="C6053" Action="Warning" /> + <Rule Id="C6054" Action="Warning" /> + <Rule Id="C6059" Action="Warning" /> + <Rule Id="C6063" Action="Warning" /> + <Rule Id="C6064" Action="Warning" /> + <Rule Id="C6066" Action="Warning" /> + <Rule Id="C6067" Action="Warning" /> + <Rule Id="C6101" Action="Warning" /> + <Rule Id="C6200" Action="Warning" /> + <Rule Id="C6201" Action="Warning" /> + <Rule Id="C6214" Action="Warning" /> + <Rule Id="C6215" Action="Warning" /> + <Rule Id="C6216" Action="Warning" /> + <Rule Id="C6217" Action="Warning" /> + <Rule Id="C6220" Action="Warning" /> + <Rule Id="C6226" Action="Warning" /> + <Rule Id="C6230" Action="Warning" /> + <Rule Id="C6235" Action="Warning" /> + <Rule Id="C6236" Action="Warning" /> + <Rule Id="C6237" Action="Warning" /> + <Rule Id="C6242" Action="Warning" /> + <Rule Id="C6248" Action="Warning" /> + <Rule Id="C6250" Action="Warning" /> + <Rule Id="C6255" Action="Warning" /> + <Rule Id="C6258" Action="Warning" /> + <Rule Id="C6259" Action="Warning" /> + <Rule Id="C6260" Action="Warning" /> + <Rule Id="C6262" Action="Warning" /> + <Rule Id="C6263" Action="Warning" /> + <Rule Id="C6268" Action="Warning" /> + <Rule Id="C6269" Action="Warning" /> + <Rule Id="C6270" Action="Warning" /> + <Rule Id="C6271" Action="Warning" /> + <Rule Id="C6272" Action="Warning" /> + <Rule Id="C6273" Action="Warning" /> + <Rule Id="C6274" Action="Warning" /> + <Rule Id="C6276" Action="Warning" /> + <Rule Id="C6277" Action="Warning" /> + <Rule Id="C6278" Action="Warning" /> + <Rule Id="C6279" Action="Warning" /> + <Rule Id="C6280" Action="Warning" /> + <Rule Id="C6281" Action="Warning" /> + <Rule Id="C6282" Action="Warning" /> + <Rule Id="C6283" Action="Warning" /> + <Rule Id="C6284" Action="Warning" /> + <Rule Id="C6285" Action="Warning" /> + <Rule Id="C6286" Action="Warning" /> + <Rule Id="C6287" Action="Warning" /> + <Rule Id="C6288" Action="Warning" /> + <Rule Id="C6289" Action="Warning" /> + <Rule Id="C6290" Action="Warning" /> + <Rule Id="C6291" Action="Warning" /> + <Rule Id="C6292" Action="Warning" /> + <Rule Id="C6293" Action="Warning" /> + <Rule Id="C6294" Action="Warning" /> + <Rule Id="C6295" Action="Warning" /> + <Rule Id="C6296" Action="Warning" /> + <Rule Id="C6297" Action="Warning" /> + <Rule Id="C6299" Action="Warning" /> + <Rule Id="C6302" Action="Warning" /> + <Rule Id="C6303" Action="Warning" /> + <Rule Id="C6305" Action="Warning" /> + <Rule Id="C6306" Action="Warning" /> + <Rule Id="C6308" Action="Warning" /> + <Rule Id="C6310" Action="Warning" /> + <Rule Id="C6312" Action="Warning" /> + <Rule Id="C6314" Action="Warning" /> + <Rule Id="C6317" Action="Warning" /> + <Rule Id="C6318" Action="Warning" /> + <Rule Id="C6319" Action="Warning" /> + <Rule Id="C6324" Action="Warning" /> + <Rule Id="C6328" Action="Warning" /> + <Rule Id="C6331" Action="Warning" /> + <Rule Id="C6332" Action="Warning" /> + <Rule Id="C6333" Action="Warning" /> + <Rule Id="C6335" Action="Warning" /> + <Rule Id="C6381" Action="Warning" /> + <Rule Id="C6383" Action="Warning" /> + <Rule Id="C6384" Action="Warning" /> + <Rule Id="C6385" Action="Warning" /> + <Rule Id="C6386" Action="Warning" /> + <Rule Id="C6387" Action="Warning" /> + <Rule Id="C6388" Action="Warning" /> + <Rule Id="C6500" Action="Warning" /> + <Rule Id="C6501" Action="Warning" /> + <Rule Id="C6503" Action="Warning" /> + <Rule Id="C6504" Action="Warning" /> + <Rule Id="C6505" Action="Warning" /> + <Rule Id="C6506" Action="Warning" /> + <Rule Id="C6508" Action="Warning" /> + <Rule Id="C6509" Action="Warning" /> + <Rule Id="C6510" Action="Warning" /> + <Rule Id="C6511" Action="Warning" /> + <Rule Id="C6513" Action="Warning" /> + <Rule Id="C6514" Action="Warning" /> + <Rule Id="C6515" Action="Warning" /> + <Rule Id="C6516" Action="Warning" /> + <Rule Id="C6517" Action="Warning" /> + <Rule Id="C6518" Action="Warning" /> + <Rule Id="C6522" Action="Warning" /> + <Rule Id="C6525" Action="Warning" /> + <Rule Id="C6527" Action="Warning" /> + <Rule Id="C6530" Action="Warning" /> + <Rule Id="C6540" Action="Warning" /> + <Rule Id="C6551" Action="Warning" /> + <Rule Id="C6552" Action="Warning" /> + <Rule Id="C6701" Action="Warning" /> + <Rule Id="C6702" Action="Warning" /> + <Rule Id="C6703" Action="Warning" /> + <Rule Id="C6704" Action="Warning" /> + <Rule Id="C6705" Action="Warning" /> + <Rule Id="C6706" Action="Warning" /> + <Rule Id="C6993" Action="Warning" /> + <Rule Id="C6995" Action="Warning" /> + <Rule Id="C6997" Action="Warning" /> + </Rules> +</RuleSet>+ \ No newline at end of file diff --git a/src/JsonCppLib/JsonCppLib.vcxproj b/src/JsonCppLib/JsonCppLib.vcxproj @@ -50,6 +50,7 @@ <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v142</PlatformToolset> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> @@ -70,16 +71,19 @@ <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v142</PlatformToolset> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v142</PlatformToolset> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v142</PlatformToolset> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> diff --git a/src/WinGetUtil/WinGetUtil.vcxproj b/src/WinGetUtil/WinGetUtil.vcxproj @@ -65,6 +65,18 @@ <WholeProgramOptimization>true</WholeProgramOptimization> <LinkIncremental>false</LinkIncremental> </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> @@ -82,34 +94,58 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>true</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> <LinkIncremental>false</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> + <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> + <RunCodeAnalysis>false</RunCodeAnalysis> + <CodeAnalysisRuleSet>..\CodeAnalysis.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> @@ -134,6 +170,12 @@ <ControlFlowGuard Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</ControlFlowGuard> <ControlFlowGuard Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</ControlFlowGuard> <ControlFlowGuard Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ControlFlowGuard> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</EnablePREfast> </ClCompile> <Link> <GenerateWindowsMetadata>false</GenerateWindowsMetadata> @@ -166,6 +208,8 @@ <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir);$(ProjectDir)..\AppInstallerCommonCore;$(ProjectDir)..\AppInstallerRepositoryCore;$(ProjectDir)..\AppInstallerCommonCore\Public;$(ProjectDir)..\JsonCppLib\json;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <TreatWarningAsError Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</TreatWarningAsError> <ControlFlowGuard Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ControlFlowGuard> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</EnablePREfast> </ClCompile> <Link> <SubSystem Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Windows</SubSystem> @@ -195,6 +239,14 @@ <ControlFlowGuard Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">Guard</ControlFlowGuard> <ControlFlowGuard Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Guard</ControlFlowGuard> <ControlFlowGuard Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Guard</ControlFlowGuard> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</SDLCheck> + <SDLCheck Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</SDLCheck> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</EnablePREfast> + <EnablePREfast Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</EnablePREfast> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> diff --git a/src/WinGetUtil/pch.h b/src/WinGetUtil/pch.h @@ -5,7 +5,11 @@ #define NOMINMAX #include <Windows.h> +#pragma warning( push ) +#pragma warning ( disable : 6001 6340 6388 ) +#include <wil/result.h> #include <wil/result_macros.h> +#pragma warning( pop ) #include <algorithm> #include <filesystem> diff --git a/src/YamlCppLib/YamlCppLib.vcxproj b/src/YamlCppLib/YamlCppLib.vcxproj @@ -104,6 +104,18 @@ <WholeProgramOptimization>false</WholeProgramOptimization> <LinkIncremental>false</LinkIncremental> </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> + <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <SpectreMitigation>Spectre</SpectreMitigation> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</LinkIncremental> <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir> diff --git a/src/cpprestsdk/cpprestsdk.vcxproj b/src/cpprestsdk/cpprestsdk.vcxproj @@ -54,6 +54,7 @@ <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v142</PlatformToolset> <CharacterSet>Unicode</CharacterSet> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> @@ -66,6 +67,7 @@ <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v142</PlatformToolset> <CharacterSet>Unicode</CharacterSet> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> @@ -84,12 +86,14 @@ <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v142</PlatformToolset> <CharacterSet>Unicode</CharacterSet> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration"> <ConfigurationType>StaticLibrary</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v142</PlatformToolset> <CharacterSet>Unicode</CharacterSet> + <SpectreMitigation>Spectre</SpectreMitigation> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -317,7 +321,7 @@ <ClCompile Include="cpprestsdk\Release\src\utilities\asyncrt_utils.cpp" /> <ClCompile Include="cpprestsdk\Release\src\utilities\base64.cpp" /> <ClCompile Include="cpprestsdk\Release\src\utilities\web_utilities.cpp" /> - </ItemGroup> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup>