Skip to content

Commit 500b733

Browse files
committed
updating messageing lib and docker scanning
Signed-off-by: Neil South <[email protected]>
1 parent 11721d4 commit 500b733

File tree

77 files changed

+1154
-489
lines changed

Some content is hidden

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

77 files changed

+1154
-489
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,13 +433,34 @@ jobs:
433433
tags: ${{ steps.meta.outputs.tags }}
434434
labels: ${{ steps.meta.outputs.labels }}
435435

436-
- name: Scan image with Azure Container Scan
437-
env:
438-
TRIVY_TIMEOUT_SEC: 360s
439-
uses: Azure/[email protected]
436+
# - name: Scan image with Azure Container Scan
437+
# env:
438+
# TRIVY_TIMEOUT_SEC: 360s
439+
# uses: Azure/[email protected]
440+
# if: ${{ (matrix.os == 'ubuntu-latest') }}
441+
# with:
442+
# image-name: ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
443+
444+
- name: Run Trivy vulnerability scanner
445+
uses: aquasecurity/trivy-action@master
446+
if: ${{ (matrix.os == 'ubuntu-latest') }}
447+
with:
448+
image-ref: ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
449+
format: 'table'
450+
exit-code: '1'
451+
ignore-unfixed: true
452+
vuln-type: 'os,library'
453+
severity: 'CRITICAL'
454+
fail-build: true
455+
456+
- uses: goodwithtech/dockle-action@main
440457
if: ${{ (matrix.os == 'ubuntu-latest') }}
441458
with:
442-
image-name: ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
459+
image: ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
460+
format: 'list'
461+
exit-code: '1'
462+
exit-level: 'warn'
463+
ignore: 'CIS-DI-0001,CIS-DI-0010,DKL-DI-0006'
443464

444465
- name: Anchore container scan
445466
id: anchore-scan
@@ -450,7 +471,7 @@ jobs:
450471
fail-build: true
451472
severity-cutoff: critical
452473

453-
- name: Upload Anchore scan SARIF report
474+
- name: Upload scan SARIF report
454475
uses: github/codeql-action/upload-sarif@v2
455476
if: ${{ (matrix.os == 'ubuntu-latest') }}
456477
with:

Dockerfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,31 @@ RUN dotnet publish -c Release -o out --nologo src/InformaticsGateway/Monai.Deplo
2727

2828
# Build runtime image
2929
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy
30+
RUN adduser --system --group --no-create-home appuser
3031

3132
# Enable elastic client compatibility mode
3233
ENV ELASTIC_CLIENT_APIVERSIONING=true
3334
ENV DEBIAN_FRONTEND=noninteractive
3435

3536
RUN apt-get clean \
3637
&& apt-get update \
37-
&& apt-get install -y --no-install-recommends \
38-
curl \
39-
&& rm -rf /var/lib/apt/lists
38+
&& apt-get install -y --no-install-recommends curl \
39+
&& apt-get install -y libc6-dev=2.35-0ubuntu3.6 \
40+
&& rm -rf /var/lib/apt/lists # this is a workaround for Mongo encryption library
41+
42+
4043

4144
WORKDIR /opt/monai/ig
4245

46+
RUN chown -R appuser:appuser /opt/monai/ig
47+
4348
COPY --from=build /app/out .
4449
COPY --from=build /tools /opt/dotnetcore-tools
4550
COPY LICENSE ./
4651
COPY docs/compliance/third-party-licenses.md ./
4752

53+
RUN ln -s /usr/lib/x86_64-linux-gnu/libdl.so.2 /opt/monai/ig/libdl.so # part 2 of workaround for Mongo encryption library
54+
4855
EXPOSE 104
4956
EXPOSE 2575
5057
EXPOSE 5000
@@ -54,4 +61,6 @@ HEALTHCHECK --interval=10s --retries=10 CMD curl --fail http://localhost:5000/he
5461
RUN ls -lR /opt/monai/ig
5562
ENV PATH="/opt/dotnetcore-tools:${PATH}"
5663

64+
USER appuser
65+
5766
ENTRYPOINT ["/opt/monai/ig/Monai.Deploy.InformaticsGateway"]

doc/dependency_decisions.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,8 @@
583583
- Microsoft.NET.ILLink.Tasks
584584
- :versions:
585585
- 8.0.0
586+
- 8.0.1
587+
- 8.0.2
586588
:when: 2022-10-14T23:37:16.793Z
587589
:who: mocsharp
588590
:why: MIT (https://github.com/dotnet/runtime/raw/main/LICENSE.TXT)
@@ -659,14 +661,14 @@
659661
- - :approve
660662
- Monai.Deploy.Messaging
661663
- :versions:
662-
- 2.0.0
664+
- 2.0.2
663665
:when: 2023-10-13T18:06:21.511Z
664666
:who: neilsouth
665667
:why: Apache-2.0 (https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)
666668
- - :approve
667669
- Monai.Deploy.Messaging.RabbitMQ
668670
- :versions:
669-
- 2.0.0
671+
- 2.0.2
670672
:when: 2023-10-13T18:06:21.511Z
671673
:who: neilsouth
672674
:why: Apache-2.0 (https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)
@@ -1775,4 +1777,4 @@
17751777
- 7.0.0
17761778
:when: 2023-08-10T20:50:14.759Z
17771779
:who: mocsharp
1778-
:why: MIT (https://raw.githubusercontent.com/dotnet/runtime/main/LICENSE.TXT)
1780+
:why: MIT (https://raw.githubusercontent.com/dotnet/runtime/main/LICENSE.TXT)

src/Api/HL7DestinationEntity.cs

100644100755
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ namespace Monai.Deploy.InformaticsGateway.Api.Models
2525
/// {
2626
/// "name": "MYPACS",
2727
/// "hostIp": "10.20.100.200",
28-
/// "aeTitle": "MONAIPACS",
2928
/// "port": 1104
3029
/// }
3130
/// </code>
@@ -36,5 +35,10 @@ public class HL7DestinationEntity : BaseApplicationEntity
3635
/// Gets or sets the port to connect to.
3736
/// </summary>
3837
public int Port { get; set; }
38+
39+
public override string ToString()
40+
{
41+
return $"Name: {Name}/Host: {HostIp}/Port: {Port}";
42+
}
3943
}
4044
}

src/Api/Models/BaseApplicationEntity.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ public class BaseApplicationEntity : MongoDBEntityBase
3535
/// </summary>
3636
public string Name { get; set; } = default!;
3737

38-
/// <summary>
39-
/// Gets or sets the AE Title (AET) used to identify itself in a DICOM association.
40-
/// </summary>
41-
public string AeTitle { get; set; } = default!;
4238

4339
/// <summary>
4440
/// Gets or set the host name or IP address of the AE Title.
@@ -62,13 +58,10 @@ public class BaseApplicationEntity : MongoDBEntityBase
6258

6359
public BaseApplicationEntity()
6460
{
65-
SetDefaultValues();
6661
}
6762

68-
public void SetDefaultValues()
63+
public virtual void SetDefaultValues()
6964
{
70-
if (string.IsNullOrWhiteSpace(Name))
71-
Name = AeTitle;
7265
}
7366

7467
public void SetAuthor(ClaimsPrincipal user, EditMode editMode)
@@ -90,7 +83,7 @@ public void SetAuthor(ClaimsPrincipal user, EditMode editMode)
9083

9184
public override string ToString()
9285
{
93-
return $"Name: {Name}/AET: {AeTitle}/Host: {HostIp}";
86+
return $"Name: {Name} /Host: {HostIp}";
9487
}
9588
}
9689
}

src/Api/Models/DestinationApplicationEntity.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,30 @@ namespace Monai.Deploy.InformaticsGateway.Api.Models
3232
/// </example>
3333
public class DestinationApplicationEntity : BaseApplicationEntity
3434
{
35+
public DestinationApplicationEntity() : base()
36+
{
37+
SetDefaultValues();
38+
}
39+
3540
/// <summary>
3641
/// Gets or sets the port to connect to.
3742
/// </summary>
3843
public int Port { get; set; }
44+
45+
/// <summary>
46+
/// Gets or sets the AE Title (AET) used to identify itself in a DICOM association.
47+
/// </summary>
48+
public string AeTitle { get; set; } = default!;
49+
50+
public override void SetDefaultValues()
51+
{
52+
if (string.IsNullOrWhiteSpace(Name))
53+
Name = AeTitle;
54+
}
55+
56+
public override string ToString()
57+
{
58+
return $"Name: {Name}/AET: {AeTitle}/Host: {HostIp}/Port: {Port}";
59+
}
3960
}
4061
}

src/Api/Monai.Deploy.InformaticsGateway.Api.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
<PackageReference Include="fo-dicom" Version="5.1.2" />
5252
<PackageReference Include="HL7-dotnetcore" Version="2.36.0" />
5353
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
54-
<PackageReference Include="Monai.Deploy.Messaging" Version="2.0.0" />
55-
<PackageReference Include="Monai.Deploy.Messaging.RabbitMQ" Version="2.0.0" />
54+
<PackageReference Include="Monai.Deploy.Messaging" Version="2.0.2" />
55+
<PackageReference Include="Monai.Deploy.Messaging.RabbitMQ" Version="2.0.2" />
5656
<PackageReference Include="Monai.Deploy.Storage" Version="1.0.0" />
5757
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.0" />
5858
</ItemGroup>

src/Api/SourceApplicationEntity.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,25 @@ namespace Monai.Deploy.InformaticsGateway.Api
3333
/// </example>
3434
public class SourceApplicationEntity : BaseApplicationEntity
3535
{
36+
public SourceApplicationEntity() : base()
37+
{
38+
SetDefaultValues();
39+
}
40+
41+
/// <summary>
42+
/// Gets or sets the AE Title (AET) used to identify itself in a DICOM association.
43+
/// </summary>
44+
public string AeTitle { get; set; } = default!;
45+
46+
public override void SetDefaultValues()
47+
{
48+
if (string.IsNullOrWhiteSpace(Name))
49+
Name = AeTitle;
50+
}
51+
52+
public override string ToString()
53+
{
54+
return $"Name: {Name}/AET: {AeTitle}/Host: {HostIp}";
55+
}
3656
}
3757
}

src/Api/Storage/Hl7FileStorageMetadata.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Monai.Deploy.InformaticsGateway.Api.Storage
2727
public sealed record Hl7FileStorageMetadata : FileStorageMetadata
2828
{
2929
public const string Hl7SubDirectoryName = "ehr";
30-
public const string FileExtension = ".txt";
30+
public const string FileExtension = ".hl7";
3131

3232
/// <inheritdoc/>
3333
[JsonIgnore]

src/Api/Storage/Payload.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ public TimeSpan Elapsed
8686

8787
public int FilesFailedToUpload { get => Files.Count(p => p.IsUploadFailed); }
8888

89-
public string DestinationFolder { get; set; } = string.Empty;
90-
9189
public Payload(string key, string correlationId, string? workflowInstanceId, string? taskId, DataOrigin dataTrigger, uint timeout)
9290
{
9391
Guard.Against.NullOrWhiteSpace(key, nameof(key));
@@ -108,7 +106,7 @@ public Payload(string key, string correlationId, string? workflowInstanceId, str
108106
DataTrigger = dataTrigger;
109107
}
110108

111-
public Payload(string key, string correlationId, string? workflowInstanceId, string? taskId, DataOrigin dataTrigger, uint timeout, string? payloadId = null, string? DestinationFolder = null) :
109+
public Payload(string key, string correlationId, string? workflowInstanceId, string? taskId, DataOrigin dataTrigger, uint timeout, string? payloadId) :
112110
this(key, correlationId, workflowInstanceId, taskId, dataTrigger, timeout)
113111
{
114112
Guard.Against.NullOrWhiteSpace(key, nameof(key));
@@ -121,7 +119,6 @@ public Payload(string key, string correlationId, string? workflowInstanceId, str
121119
{
122120
PayloadId = Guid.Parse(payloadId);
123121
}
124-
DestinationFolder ??= string.Empty;
125122
}
126123

127124
public void Add(FileStorageMetadata value)

src/Api/Test/HL7DestinationEntityTest.cs

100644100755
Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,23 @@ namespace Monai.Deploy.InformaticsGateway.Api.Test
2121
{
2222
public class HL7DestinationEntityTest
2323
{
24-
[Fact]
25-
public void GivenAMonaiApplicationEntity_WhenNameIsNotSet_ExepectSetDefaultValuesToBeUsed()
26-
{
27-
var entity = new HL7DestinationEntity
28-
{
29-
AeTitle = "AET",
30-
};
31-
32-
entity.SetDefaultValues();
3324

34-
Assert.Equal(entity.AeTitle, entity.Name);
35-
}
3625

3726
[Fact]
3827
public void GivenAMonaiApplicationEntity_WhenNameIsSet_ExepectSetDefaultValuesToNotOverwrite()
3928
{
4029
var entity = new HL7DestinationEntity
4130
{
42-
AeTitle = "AET",
31+
Port = 1104,
4332
HostIp = "IP",
4433
Name = "Name"
4534
};
4635

4736
entity.SetDefaultValues();
4837

49-
Assert.Equal("AET", entity.AeTitle);
5038
Assert.Equal("IP", entity.HostIp);
5139
Assert.Equal("Name", entity.Name);
40+
Assert.Equal(1104, entity.Port);
5241
}
5342
}
5443
}

src/Api/Test/BaseApplicationEntityTest.cs renamed to src/Api/Test/SourceBaseApplicationEntityTest.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@
1414
* limitations under the License.
1515
*/
1616

17-
using Monai.Deploy.InformaticsGateway.Api.Models;
1817
using Xunit;
1918

2019
namespace Monai.Deploy.InformaticsGateway.Api.Test
2120
{
22-
public class BaseApplicationEntityTest
21+
public class SourceBaseApplicationEntityTest
2322
{
2423
[Fact]
2524
public void GivenABaseApplicationEntity_WhenNameIsNotSet_ExpectSetDefaultValuesToSetName()
2625
{
27-
var entity = new BaseApplicationEntity
26+
var entity = new SourceApplicationEntity
2827
{
2928
AeTitle = "AET",
3029
HostIp = "IP"
@@ -38,7 +37,7 @@ public void GivenABaseApplicationEntity_WhenNameIsNotSet_ExpectSetDefaultValuesT
3837
[Fact]
3938
public void GivenABaseApplicationEntity_WhenNameIsSet_ExpectSetDefaultValuesToNotSetName()
4039
{
41-
var entity = new BaseApplicationEntity
40+
var entity = new SourceApplicationEntity
4241
{
4342
AeTitle = "AET",
4443
HostIp = "IP",

0 commit comments

Comments
 (0)