File tree Expand file tree Collapse file tree 10 files changed +55
-22
lines changed
Expand file tree Collapse file tree 10 files changed +55
-22
lines changed Original file line number Diff line number Diff line change 1414 - uses : actions/checkout@v3
1515 - name : Check dotnet Style
1616 run : dotnet-format --check --exclude /
17+ security :
18+ runs-on : windows-2022
19+ steps :
20+ - name : Install security-code-scan
21+ run : dotnet tool install -g security-scan
22+ - uses : actions/checkout@v3
23+ - name : Run security analysis
24+ run : security-scan EasyPost.sln --ignore-msbuild-errors --verbose
25+ # "--ignore-msbuild-errors" needed since MSBuild does not like F#: https://github.com/security-code-scan/security-code-scan/issues/235
26+ # In the future, we can collect the output logs by enabling Code Scanning and using the pre-built GitHub Action: https://github.com/marketplace/actions/securitycodescan
27+ # https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github#uploading-a-code-scanning-analysis-with-github-actions
1728 NET_Tests :
1829 # derived from https://dev.to/felipetofoli/github-actions-for-net-full-framework-build-and-test-299h
1930 runs-on : windows-2022
Original file line number Diff line number Diff line change 1414 </ItemGroup >
1515
1616 <ItemGroup >
17- <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.1.0" />
18- <PackageReference Include =" MSTest.TestAdapter" Version =" 2.2.8" />
19- <PackageReference Include =" MSTest.TestFramework" Version =" 2.2.8" />
17+ <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.1.0" />
18+ <PackageReference Include =" MSTest.TestAdapter" Version =" 2.2.8" />
19+ <PackageReference Include =" MSTest.TestFramework" Version =" 2.2.8" />
20+ <PackageReference Include =" SecurityCodeScan.VS2019" Version =" [5.0.0, 6.0.0)" >
21+ <PrivateAssets >all</PrivateAssets >
22+ <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
23+ </PackageReference >
2024 </ItemGroup >
2125
2226</Project >
Original file line number Diff line number Diff line change 1010 </ItemGroup >
1111
1212 <ItemGroup >
13- <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.1.0" />
14- <PackageReference Include =" MSTest.TestAdapter" Version =" 2.2.8" />
15- <PackageReference Include =" MSTest.TestFramework" Version =" 2.2.8" />
13+ <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.1.0" />
14+ <PackageReference Include =" MSTest.TestAdapter" Version =" 2.2.8" />
15+ <PackageReference Include =" MSTest.TestFramework" Version =" 2.2.8" />
16+ <PackageReference Include =" SecurityCodeScan.VS2019" Version =" [5.0.0, 6.0.0)" >
17+ <PrivateAssets >all</PrivateAssets >
18+ <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
19+ </PackageReference >
1620 </ItemGroup >
1721
1822</Project >
Original file line number Diff line number Diff line change 1212 </PropertyGroup >
1313
1414 <ItemGroup >
15- <PackageReference Include =" EasyVCR" Version =" 0.3.1" />
16- <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 16.5.0" />
17- <PackageReference Include =" coverlet.collector" Version =" 1.2.0" />
18- <PackageReference Include =" Newtonsoft.Json" Version =" [13.0.1, 14.0.0)" />
19- <PackageReference Include =" RestSharp" Version =" [107.3.0, 108.0.0)" />
20- <PackageReference Include =" MSTest.TestFramework" Version =" 2.2.8" />
21- <PackageReference Include =" MSTest.TestAdapter" Version =" 2.2.8" />
15+ <PackageReference Include =" EasyVCR" Version =" 0.3.1" />
16+ <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 16.5.0" />
17+ <PackageReference Include =" coverlet.collector" Version =" 1.2.0" />
18+ <PackageReference Include =" Newtonsoft.Json" Version =" [13.0.1, 14.0.0)" />
19+ <PackageReference Include =" RestSharp" Version =" [107.3.0, 108.0.0)" />
20+ <PackageReference Include =" MSTest.TestFramework" Version =" 2.2.8" />
21+ <PackageReference Include =" MSTest.TestAdapter" Version =" 2.2.8" />
22+ <PackageReference Include =" SecurityCodeScan.VS2019" Version =" [5.0.0, 6.0.0)" >
23+ <PrivateAssets >all</PrivateAssets >
24+ <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
25+ </PackageReference >
2226 </ItemGroup >
2327
2428 <ItemGroup >
Original file line number Diff line number Diff line change 11using System ;
2- using System . Collections . Generic ;
32using Newtonsoft . Json ;
43
54namespace EasyPost . Base
Original file line number Diff line number Diff line change 6161 <ItemGroup >
6262 <PackageReference Include =" Newtonsoft.Json" Version =" [13.0.1, 14.0.0)" />
6363 <PackageReference Include =" RestSharp" Version =" [107.3.0, 108.0.0)" />
64+ <PackageReference Include =" SecurityCodeScan.VS2019" Version =" [5.0.0, 6.0.0)" >
65+ <PrivateAssets >all</PrivateAssets >
66+ <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
67+ </PackageReference >
6468 </ItemGroup >
6569
6670</Project >
Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
33using System . Runtime . Serialization ;
4- using System . Security . Permissions ;
54
65namespace EasyPost
76{
@@ -52,14 +51,14 @@ public class PropertyMissing : Exception
5251 {
5352 private readonly string _property ;
5453
55- public PropertyMissing ( string property )
54+ public override string Message
5655 {
57- _property = property ;
56+ get { return $ "Missing { _property } " ; }
5857 }
5958
60- public override string Message
59+ public PropertyMissing ( string property )
6160 {
62- get { return $ "Missing { _property } " ; }
61+ _property = property ;
6362 }
6463 }
6564
Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
33using System . Threading . Tasks ;
4- using EasyPost . Utilities ;
54using Newtonsoft . Json ;
65using RestSharp ;
76
Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
3- using System . Linq ;
43using System . Threading . Tasks ;
54using EasyPost . Utilities ;
65using Newtonsoft . Json ;
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ build:
2424install-cert :
2525 scripts\i nstall_cert.bat ${cert} ${pass}
2626
27+ # # install-scanner - Install SecurityCodeScan to your system
28+ install-scanner :
29+ dotnet tool install -g security-scan
30+
2731# # sign - Sign all generated DLLs and NuGet packages with the provided certificate (Windows only)
2832# @parameters:
2933# cert= - The certificate to use for signing the built assets.
5660lint-scripts :
5761 scripts\l int_scripts.bat
5862
59- .PHONY : help release build-dev build install-cert sign clean restore lint lint-check test lint-scripts
63+ # # scan - Scan the project for security issues (must run install-scanner first)
64+ # Makefile cannot access global dotnet tools, so you need to run the below command manually.
65+ scan :
66+ security-scan --verbose --no-banner --ignore-msbuild-errors EasyPost.sln
67+ # "--ignore-msbuild-errors" needed since MSBuild does not like F#: https://github.com/security-code-scan/security-code-scan/issues/235
68+
69+ .PHONY : help release build-dev build install-cert sign clean restore lint lint-check test lint-scripts install-scanner scan
You can’t perform that action at this time.
0 commit comments