Skip to content

Commit ddba9f4

Browse files
authored
CheckmarxOne feature implementation (#194)
* adding configuration validator * begin cxone integration * more unit tests * CxOne login context implemented * CxOne login working * CxOne API integration start * CxOne results deserializing * CxOne project info and sast scan summary mostly working * dependency update * dependency update * sast details and summary * scan statistics * beginning of SCA integration * sca details implemented * code cleanup * code cleanup, dependency updates * regression tests for scan statistics * add disposes * query severity and other info * sca project/scan tags * added preset to project info * add remarks to details * documentation update * adding fields to output * allow pre-release from a branch * removed redundant config element * CxOne updates for manual * build work * make tags and filters work properly * regression test update * update template config file * Small documentation fix * fix startup bug * handle null tag collection * stabilization * stabilization * doc clarification * development docs * typo * fix for runtime exit on error * memory leak resolution * memory leak resolution * shutdown stabilization * bug fixes * issue #195 impl * stabilizing * stabilization * stabilizing * manual update * doc update * stabilizing * fix unit tests * stabilizing
1 parent 7f8df57 commit ddba9f4

File tree

116 files changed

+5964
-866
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+5964
-866
lines changed

.github/workflows/build-prerelease.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111
jobs:
1212
create-tag:
1313
runs-on: ubuntu-latest
14-
if: github.ref == 'refs/heads/master'
1514
outputs:
1615
tag: ${{ steps.create-tag.outputs.tag }}
1716
steps:

.github/workflows/build-release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111
jobs:
1212
create-tag:
1313
runs-on: ubuntu-latest
14-
if: github.ref == 'refs/heads/master'
1514
outputs:
1615
tag: ${{ steps.create-tag.outputs.tag }}
1716
steps:

.github/workflows/publish-build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
build-packages:
2323
runs-on: ubuntu-latest
2424
env:
25-
DOCKER_REPO: ghcr.io/checkmarx-ts/cxanalytix/cxanalytix
25+
DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/cxanalytix/cxanalytix
2626
steps:
2727
- name: Set up Docker Buildx
2828
id: buildx
@@ -81,6 +81,9 @@ jobs:
8181
echo \<P\> >> release.md
8282
echo docker pull $DOCKER_REPO:v${{ inputs.tag }} >> release.md
8383
84+
- name: Edit manual's version stamp
85+
run: echo ${{ inputs.tag }} > manual/version.tex
86+
8487
- name: Build PDF Manual
8588
uses: xu-cheng/latex-action@v2
8689
with:

Applications/CxAnalytixCLI/CxAnalytixCLI.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
</None>
4545
</ItemGroup>
4646

47+
<ItemGroup>
48+
<PackageReference Include="CommandLineParser" Version="2.9.1" />
49+
</ItemGroup>
50+
4751
<ItemGroup>
4852
<ProjectReference Include="..\..\Libs\Executive\Executive.csproj" />
4953
</ItemGroup>
Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,38 @@
1-
using CxAnalytix.Executive;
2-
using System;
1+
using System;
2+
using System.Threading;
3+
using CommandLine;
4+
using CxAnalytix.Executive;
35

46

57
namespace CxAnalytixCLI
68
{
79
class Program
810
{
11+
public class CommandLineOpts
12+
{
13+
[Option('l', "loop", Default = false, Required = false, HelpText = "Do not exit, continue running in a loop like the service or daemon.")]
14+
public bool Loop { get; set; }
15+
}
16+
917
static void Main(string[] args)
1018
{
11-
ExecuteOnce.Execute();
19+
Parser.Default.ParseArguments<CommandLineOpts>(args).WithParsed((opts) =>
20+
{
21+
if (!opts.Loop)
22+
ExecuteOnce.Execute();
23+
else
24+
{
25+
var ctoken = new CancellationTokenSource();
26+
Console.CancelKeyPress += (sender, args) =>
27+
{
28+
Console.WriteLine("CTRL-C: Exiting!");
29+
ctoken.Cancel();
30+
};
31+
32+
ExecuteLoop.Execute(ctoken);
33+
}
34+
});
1235
}
36+
1337
}
1438
}

Applications/CxAnalytixCLI/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"CxAnalytixCLI": {
44
"commandName": "Executable",
55
"executablePath": "dotnet.exe",
6-
"commandLineArgs": "CxAnalytixCLI.dll"
6+
"commandLineArgs": "CxAnalytixCLI.dll --loop"
77
}
88
}
99
}

Applications/CxAnalytixDaemon/CxAnalytixDaemon.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
<ItemGroup>
3535
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
3636
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="6.0.0" />
37-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
38-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
37+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
3938
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
4039
</ItemGroup>
4140

Applications/CxAnalytixDaemon/Daemon.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public Task StartAsync(CancellationToken cancellationToken)
2525
{
2626
_cancelToken = new CancellationTokenSource();
2727

28-
_serviceTask = Task.Run( () =>
28+
_serviceTask = Task.Run( () =>
2929
{
3030
ExecuteLoop.Execute(_cancelToken);
3131

@@ -38,9 +38,10 @@ public Task StopAsync(CancellationToken cancellationToken)
3838
{
3939
if (_cancelToken != null && _serviceTask != null && !_serviceTask.IsCompleted)
4040
{
41-
_cancelToken.Cancel();
41+
if (!_cancelToken.IsCancellationRequested)
42+
_cancelToken.Cancel();
4243

43-
try
44+
try
4445
{
4546
_serviceTask.Wait(cancellationToken);
4647
}

Applications/CxAnalytixService/ServiceLifecycleControl.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ private void stopService()
2525
{
2626
if (_cancelToken != null)
2727
{
28-
_cancelToken.Cancel();
28+
if (!_cancelToken.IsCancellationRequested)
29+
_cancelToken.Cancel();
2930

3031
if (_serviceTask != null && !_serviceTask.IsCompleted)
3132
{
@@ -53,8 +54,7 @@ protected override void OnStart(string[] args)
5354

5455
_cancelToken = new CancellationTokenSource();
5556

56-
57-
_serviceTask = Task.Run( () =>
57+
_serviceTask = Task.Run( () =>
5858
{
5959
ExecuteLoop.Execute(_cancelToken);
6060

CxAnalytix.sln

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SastTransformer", "XForm\Sa
8989
EndProject
9090
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "XForm\Common\Common.csproj", "{BE71BE3E-7591-4D62-BFB3-F77D7B57F12A}"
9191
EndProject
92+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CxOneTransformer", "XForm\CxOneTransformer\CxOneTransformer.csproj", "{9F56B86B-C692-4D85-BABB-735B969D2D4E}"
93+
EndProject
9294
Global
9395
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9496
Debug|Any CPU = Debug|Any CPU
@@ -865,6 +867,30 @@ Global
865867
{BE71BE3E-7591-4D62-BFB3-F77D7B57F12A}.ReleaseWindows|x64.Build.0 = Release|Any CPU
866868
{BE71BE3E-7591-4D62-BFB3-F77D7B57F12A}.ReleaseWindows|x86.ActiveCfg = Release|Any CPU
867869
{BE71BE3E-7591-4D62-BFB3-F77D7B57F12A}.ReleaseWindows|x86.Build.0 = Release|Any CPU
870+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
871+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
872+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Debug|x64.ActiveCfg = Debug|Any CPU
873+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Debug|x64.Build.0 = Debug|Any CPU
874+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Debug|x86.ActiveCfg = Debug|Any CPU
875+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Debug|x86.Build.0 = Debug|Any CPU
876+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
877+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Release|Any CPU.Build.0 = Release|Any CPU
878+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Release|x64.ActiveCfg = Release|Any CPU
879+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Release|x64.Build.0 = Release|Any CPU
880+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Release|x86.ActiveCfg = Release|Any CPU
881+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.Release|x86.Build.0 = Release|Any CPU
882+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseLinux|Any CPU.ActiveCfg = Release|Any CPU
883+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseLinux|Any CPU.Build.0 = Release|Any CPU
884+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseLinux|x64.ActiveCfg = Release|Any CPU
885+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseLinux|x64.Build.0 = Release|Any CPU
886+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseLinux|x86.ActiveCfg = Release|Any CPU
887+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseLinux|x86.Build.0 = Release|Any CPU
888+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseWindows|Any CPU.ActiveCfg = Release|Any CPU
889+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseWindows|Any CPU.Build.0 = Release|Any CPU
890+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseWindows|x64.ActiveCfg = Release|Any CPU
891+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseWindows|x64.Build.0 = Release|Any CPU
892+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseWindows|x86.ActiveCfg = Release|Any CPU
893+
{9F56B86B-C692-4D85-BABB-735B969D2D4E}.ReleaseWindows|x86.Build.0 = Release|Any CPU
868894
EndGlobalSection
869895
GlobalSection(SolutionProperties) = preSolution
870896
HideSolutionNode = FALSE
@@ -903,6 +929,7 @@ Global
903929
{2B0E82D0-D423-4D3A-B16E-A64365D1C131} = {203A826C-286F-442C-B7B9-E43F806B8778}
904930
{0788985B-731F-4BA5-A7E3-5C7996074B54} = {203A826C-286F-442C-B7B9-E43F806B8778}
905931
{BE71BE3E-7591-4D62-BFB3-F77D7B57F12A} = {203A826C-286F-442C-B7B9-E43F806B8778}
932+
{9F56B86B-C692-4D85-BABB-735B969D2D4E} = {203A826C-286F-442C-B7B9-E43F806B8778}
906933
EndGlobalSection
907934
GlobalSection(ExtensibilityGlobals) = postSolution
908935
SolutionGuid = {103FD3A6-4F85-4DC0-B65F-7E974EA202FE}

0 commit comments

Comments
 (0)