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 14
14
- uses : actions/checkout@v3
15
15
- name : Check dotnet Style
16
16
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
17
28
NET_Tests :
18
29
# derived from https://dev.to/felipetofoli/github-actions-for-net-full-framework-build-and-test-299h
19
30
runs-on : windows-2022
Original file line number Diff line number Diff line change 14
14
</ItemGroup >
15
15
16
16
<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 >
20
24
</ItemGroup >
21
25
22
26
</Project >
Original file line number Diff line number Diff line change 10
10
</ItemGroup >
11
11
12
12
<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 >
16
20
</ItemGroup >
17
21
18
22
</Project >
Original file line number Diff line number Diff line change 12
12
</PropertyGroup >
13
13
14
14
<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 >
22
26
</ItemGroup >
23
27
24
28
<ItemGroup >
Original file line number Diff line number Diff line change 1
1
using System ;
2
- using System . Collections . Generic ;
3
2
using Newtonsoft . Json ;
4
3
5
4
namespace EasyPost . Base
Original file line number Diff line number Diff line change 61
61
<ItemGroup >
62
62
<PackageReference Include =" Newtonsoft.Json" Version =" [13.0.1, 14.0.0)" />
63
63
<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 >
64
68
</ItemGroup >
65
69
66
70
</Project >
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . Runtime . Serialization ;
4
- using System . Security . Permissions ;
5
4
6
5
namespace EasyPost
7
6
{
@@ -52,14 +51,14 @@ public class PropertyMissing : Exception
52
51
{
53
52
private readonly string _property ;
54
53
55
- public PropertyMissing ( string property )
54
+ public override string Message
56
55
{
57
- _property = property ;
56
+ get { return $ "Missing { _property } " ; }
58
57
}
59
58
60
- public override string Message
59
+ public PropertyMissing ( string property )
61
60
{
62
- get { return $ "Missing { _property } " ; }
61
+ _property = property ;
63
62
}
64
63
}
65
64
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . Threading . Tasks ;
4
- using EasyPost . Utilities ;
5
4
using Newtonsoft . Json ;
6
5
using RestSharp ;
7
6
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
- using System . Linq ;
4
3
using System . Threading . Tasks ;
5
4
using EasyPost . Utilities ;
6
5
using Newtonsoft . Json ;
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ build:
24
24
install-cert :
25
25
scripts\i nstall_cert.bat ${cert} ${pass}
26
26
27
+ # # install-scanner - Install SecurityCodeScan to your system
28
+ install-scanner :
29
+ dotnet tool install -g security-scan
30
+
27
31
# # sign - Sign all generated DLLs and NuGet packages with the provided certificate (Windows only)
28
32
# @parameters:
29
33
# cert= - The certificate to use for signing the built assets.
56
60
lint-scripts :
57
61
scripts\l int_scripts.bat
58
62
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