Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge refactor of project files to make compilation security settings easier #3275

Draft
wants to merge 44 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9772558
Disable warnings in external projects
florelis May 16, 2023
c87e9b4
Update azure-pipelines.yml for Azure Pipelines
florelis May 17, 2023
8e8b943
update binskim glob pattern
florelis May 17, 2023
01188a1
Simplify vcxprojs with Directory.Build.props
florelis May 17, 2023
bb6e510
Fix build errors
florelis May 17, 2023
9a25bf4
Fix build errors
florelis May 18, 2023
97d1d02
Always publish analysis logs
florelis May 18, 2023
82848c0
Enable codeql
florelis May 18, 2023
59b8583
standardize pragma warnings
florelis May 18, 2023
224c358
Fix build errors
florelis May 18, 2023
a73f542
Restore external project changes
florelis May 18, 2023
5444473
test
florelis May 18, 2023
071f40b
spelling
florelis May 18, 2023
7e8d02f
Revert "test"
florelis May 18, 2023
f6f5131
fix
florelis May 18, 2023
4743aab
Some more errors from static analysis
florelis May 22, 2023
9f20a8e
Fix warnings in test project
florelis May 23, 2023
7fec4f4
run codql manually
florelis May 23, 2023
49a6d09
Fix more warnings
florelis May 23, 2023
903ca2f
always run static analysis for testing
florelis May 23, 2023
b94e493
More warnings
florelis May 23, 2023
afd9972
More warnings
florelis May 23, 2023
08bf8dc
Disable tests for quicker testing
florelis May 24, 2023
ba9d74f
Supress warning in test project
florelis May 24, 2023
9c7521b
Fix test
florelis May 24, 2023
46d6e0c
Show available space
florelis May 24, 2023
a24eb74
Fix codeql call
florelis May 24, 2023
9b5d9cc
Try disabling binskim required flags
florelis May 24, 2023
b916228
Reeenable conformance mode
florelis May 25, 2023
48e87b6
Continue on error
florelis May 25, 2023
8ccc8fe
Only PREFast
florelis May 25, 2023
3e1e38f
Only SDL check
florelis May 25, 2023
1934f68
Only CETCompat
florelis May 25, 2023
d6fb024
Only ControlFlow guard
florelis May 25, 2023
5ac0fd8
CodeQL
florelis May 25, 2023
62870ba
only ControlFlowGuard
florelis May 25, 2023
10dd98a
only CETCompat
florelis May 25, 2023
e3321cf
Only SDLCheck
florelis May 25, 2023
59fade2
Only spectre
florelis May 25, 2023
090d12a
Enable all binskim configs
florelis May 25, 2023
761de73
Disable binskim config
florelis May 25, 2023
e3c96cd
Clean up pipeline
florelis May 25, 2023
043f1f6
Merge branch 'master' into staticanalysis
florelis May 25, 2023
bd25948
Clean up directory.build.props
florelis May 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/excludes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
\.pdf$
\.pem$
\.png$
\.props$
\.psd$
\.pyc$
\.s$
Expand Down
12 changes: 7 additions & 5 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ cls
clsctx
clsid
CODEOWNERS
Codeql
COINIT
COMGLB
commandline
Expand Down Expand Up @@ -216,20 +217,20 @@ LPICONDIR
LPICONDIRENTRY
LPICONIMAGE
lpitemidlist
LPW
maclachlan
LPSTR
LPW
LPWCH
LPWSTR
LSTATUS
LTDA
luffy
Luffytaro
maclachlan
malware
mapview
Maxed
maxvalue
maybenull
Maxed
MBH
mdmp
MDs
Expand Down Expand Up @@ -284,8 +285,8 @@ nuffing
objbase
objidl
ofile
osfhandle
OPTOUT
osfhandle
Outptr
packageinuse
packageinusebyapplication
Expand Down Expand Up @@ -348,8 +349,8 @@ riid
roblox
ronomon
rosoft
roy
rowids
roy
RRF
rrr
runspace
Expand All @@ -359,6 +360,7 @@ rzkzqaqjwj
SARL
schematab
sddl
Semmle
seof
servercert
servercertificate
Expand Down
73 changes: 52 additions & 21 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ pool:
variables:
solution: 'src\AppInstallerCLI.sln'
appxPackageDir: '$(Build.ArtifactStagingDirectory)/AppxPackages/'
# Enable CodeQL/Semmle static analysis for default branch
Codeql.Enabled: true
# TODO: Remove. Only for testing, we should use standard cadence of 72h
CodeQL.Cadence: 0

# Do not set the build version for a PR build.

Expand Down Expand Up @@ -60,6 +64,10 @@ jobs:
packageLayoutDir: $(Build.BinariesDirectory)\WingetPackageLayout

steps:

# TODO: Remove; only to test in non-default branch
- task: CodeQL3000Init@0

- task: NuGetToolInstaller@1
displayName: Install Nuget

Expand Down Expand Up @@ -96,6 +104,9 @@ jobs:
arguments: '-TargetFile binver\binver\version.h -BuildVersion $(BuildVer)'
workingDirectory: 'src'

# TODO: remove
- powershell: Get-Volume; @('.', '$(Build.ArtifactStagingDirectory)') | %{ $mb = (Get-ChildItem $_ -Recurse | Measure-Object -Sum Length).Sum / (1024 * 1024); Write-Host "$_ :`t$mb MBs" }

# Build all solutions in the root directory.
- task: VSBuild@1
displayName: Build Solution
Expand All @@ -109,6 +120,9 @@ jobs:
/p:AppxBundle=Always
/p:UapAppxPackageBuildMode=SideloadOnly'

- powershell: Get-Volume; @('.', '$(Build.ArtifactStagingDirectory)') | %{ $mb = (Get-ChildItem $_ -Recurse | Measure-Object -Sum Length).Sum / (1024 * 1024); Write-Host "$_ :`t$mb MBs" }
condition: always()

- task: VSBuild@1
displayName: Build Test Project
inputs:
Expand All @@ -121,6 +135,41 @@ jobs:
/p:AppxBundle=Always
/p:UapAppxPackageBuildMode=SideloadOnly'

# Run static analysis and compliance checks for all the binaries
- task: ComponentGovernanceComponentDetection@0
displayName: Component Governance
inputs:
scanType: 'LogOnly'
verbosity: 'Verbose'
alertWarningLevel: 'High'
failOnAlert: true

- task: CredScan@3

# TODO: remove
- powershell: Get-Volume; @('.', '$(Build.ArtifactStagingDirectory)') | %{ $mb = (Get-ChildItem $_ -Recurse | Measure-Object -Sum Length).Sum / (1024 * 1024); Write-Host "$_ :`t$mb MBs" }
condition: always()

- task: BinSkim@4
inputs:
InputType: 'Basic'
Function: 'analyze'
TargetPattern: 'guardianGlob'
AnalyzeTargetGlob: 'f|$(buildOutDir)/**.dll;f|$(buildOutDir)/**.exe;f|$(Build.SourcesDirectory)\src\WinGetUtilInterop\bin\*.dll'
continueOnError: true # TODO: remove once we pass these checks

# TODO: remove
- powershell: Get-Volume; @('.', '$(Build.ArtifactStagingDirectory)') | %{ $mb = (Get-ChildItem $_ -Recurse | Measure-Object -Sum Length).Sum / (1024 * 1024); Write-Host "$_ :`t$mb MBs" }
condition: always()

- task: PublishSecurityAnalysisLogs@3
inputs:
ArtifactName: 'CodeAnalysisLogs'
ArtifactType: 'Container'
AllTools: true
ToolLogsNotFoundAction: 'Standard'
condition: succeededOrFailed()

- task: CopyFiles@2
displayName: 'Copy WindowsPackageManager.dll Symbols to artifacts folder'
inputs:
Expand Down Expand Up @@ -329,28 +378,10 @@ jobs:
targetPath: '$(artifactsDir)'
condition: always()

- task: ComponentGovernanceComponentDetection@0
displayName: Component Governance
inputs:
scanType: 'Register'
verbosity: 'Verbose'
alertWarningLevel: 'High'

# Run BimSkim for all the binaries
- task: BinSkim@3
displayName: 'Run BinSkim '
inputs:
arguments: 'analyze
"$(buildOutDir)\AppInstallerCLI\winget.exe"
"$(buildOutDir)\WinGetUtil\WinGetUtil.dll"
"$(buildOutDir)\WindowsPackageManager\WindowsPackageManager.dll"
"$(buildOutDir)\Microsoft.Management.Deployment.InProc\Microsoft.Management.Deployment.InProc.dll"
"$(Build.SourcesDirectory)\src\WinGetUtilInterop\bin\WinGetUtil*Interop.dll"
"$(buildOutDir)\UndockedRegFreeWinRT\winrtact.dll"
"$(buildOutDir)\Microsoft.WinGet.Client\Microsoft.WinGet.*Client.dll" --config default --recurse'

- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2
displayName: 'Publish Security Analysis Logs'
# TODO: Remove; only to test in non-default branch
- task: CodeQL3000Finalize@0
condition: always()

- job: 'BuildPowerShellModule'
timeoutInMinutes: 120
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1A5D7A7D-5CB2-47D5-B40D-4E61CAEDC798}"
ProjectSection(SolutionItems) = preProject
CodeAnalysis.ruleset = CodeAnalysis.ruleset
Directory.Build.props = Directory.Build.props
nuget.config = nuget.config
stylecop.json = stylecop.json
EndProjectSection
Expand Down