Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 18 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
FROM ubuntu:22.04 as base

# Ensure the Microsoft packages are preferred over the Ubuntu packages
RUN echo "Package: *\nPin: origin packages.microsoft.com\nPin-Priority: 1001" > /etc/apt/preferences.d/dotnet

# Install the base packages needed to install the Microsoft packages
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
curl ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install the Microsoft deb
RUN curl -sSL https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -o packages-microsoft-prod.deb \
FROM debian:13 AS base

# Install the base packages
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
ca-certificates \
wget \
&& wget https://packages.microsoft.com/config/debian/13/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
Comment on lines +9 to 10
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dockerfile downloads and installs packages-microsoft-prod.deb with wget and then dpkg -i without any signature or checksum verification. If the download is tampered (e.g., via DNS/cert compromise or supply-chain attack), a malicious .deb can execute maintainer scripts during dpkg -i, compromising the image and persisting backdoored repositories. Verify integrity before installation (e.g., pin and check a published SHA256 checksum or verify a detached GPG signature), or install the repo using a pinned signed-by GPG key and a verified source, for example:

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates gnupg \
 && wget -O /usr/share/keyrings/microsoft.gpg https://packages.microsoft.com/keys/microsoft.asc \
 && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/debian/13/prod bookworm main" \
    > /etc/apt/sources.list.d/microsoft-prod.list

Then run apt-get update and install dotnet-sdk-10.0 from the signed repo.

Copilot uses AI. Check for mistakes.
&& rm packages-microsoft-prod.deb

# Install MsQuic
RUN apt-get update && apt-get install -y --no-install-recommends \
libmsquic \
&& rm packages-microsoft-prod.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

FROM base as build
FROM base AS build

# Install the .NET 8 SDK
RUN apt-get update && apt-get install -y --no-install-recommends \
dotnet-sdk-8.0 \
# Install .NET 10 SDK on the build stage
RUN apt-get update \
&& apt-get install -y --no-install-recommends dotnet-sdk-10.0 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -37,15 +29,15 @@ RUN dotnet build -c Release

FROM base

# Install the .NET 8 runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
dotnet-runtime-8.0 \
# Install .NET 10 runtime on the final stage
RUN apt-get update \
&& apt-get install -y --no-install-recommends libmsquic dotnet-runtime-10.0 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Copy the built application from the build stage
WORKDIR /app
COPY --from=build /app/src/Hello/bin/Release/net8.0/ .
COPY --from=build /app/src/Hello/bin/Release/net10.0/ .

# Expose the port for the TCP and QUIC transports
EXPOSE 4062/tcp
Expand Down
25 changes: 0 additions & 25 deletions Hello.sln

This file was deleted.

3 changes: 3 additions & 0 deletions Hello.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="src/Hello/Hello.csproj" />
</Solution>
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ transports on the default port (`4062`):

| Service | Path | Description | Example Clients |
| ---------------------------------------------- | --------------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Slice Greeter](./src//slice/Greeter.slice) | `/VisitorCenter.Greeter` | A simple service that greets visitors | [C# Slice Secure](https://github.com/icerpc/icerpc-csharp/tree/0.3.x/examples/slice/Secure/Client)<br>[C# Slice QUIC](https://github.com/icerpc/icerpc-csharp/tree/0.3.x/examples/slice/Quic/Client) |
| [Protobuf Greeter](./src/proto/greeter.proto) | `/visitor_center.Greeter` | A simple service that greets visitors | [C# Protobuf Secure](https://github.com/icerpc/icerpc-csharp/tree/0.3.x/examples/protobuf/Secure/Client)<br>[C# Protobuf QUIC](https://github.com/icerpc/icerpc-csharp/tree/0.3.x/examples/protobuf/Quic/Client) |
| [Slice Stream](./src/slice/Generator.slice) | `/StreamExample.Generator` | A service that streams data | [C# Slice Stream](https://github.com/icerpc/icerpc-csharp/tree/0.3.x/examples/slice/Stream/Client) |
| [Protobuf Stream](./src/proto/generator.proto) | `/stream_example.Generator` | A service that streams data | [C# Protobuf Stream](https://github.com/icerpc/icerpc-csharp/tree/0.3.x/examples/protobuf/Stream/Client) |
| [Slice Greeter](./src//slice/Greeter.slice) | `/VisitorCenter.Greeter` | A simple service that greets visitors | [C# Slice Secure](https://github.com/icerpc/icerpc-csharp/tree/0.5.x/examples/slice/Secure/Client)<br>[C# Slice QUIC](https://github.com/icerpc/icerpc-csharp/tree/0.5.x/examples/slice/Quic/Client) |
| [Protobuf Greeter](./src/proto/greeter.proto) | `/visitor_center.Greeter` | A simple service that greets visitors | [C# Protobuf Secure](https://github.com/icerpc/icerpc-csharp/tree/0.5.x/examples/protobuf/Secure/Client)<br>[C# Protobuf QUIC](https://github.com/icerpc/icerpc-csharp/tree/0.5.x/examples/protobuf/Quic/Client) |
| [Slice Stream](./src/slice/Generator.slice) | `/StreamExample.Generator` | A service that streams data | [C# Slice Stream](https://github.com/icerpc/icerpc-csharp/tree/0.5.x/examples/slice/Stream/Client) |
| [Protobuf Stream](./src/proto/generator.proto) | `/stream_example.Generator` | A service that streams data | [C# Protobuf Stream](https://github.com/icerpc/icerpc-csharp/tree/0.5.x/examples/protobuf/Stream/Client) |

## Running the server using Docker

Expand Down
23 changes: 12 additions & 11 deletions src/Hello/Hello.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Version>0.1.0</Version>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>14</LangVersion>
<Version>0.2.0</Version>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AnalysisMode>All</AnalysisMode>
Expand All @@ -14,15 +15,15 @@
<EnablePreviewFeatures>True</EnablePreviewFeatures>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IceRpc.Deadline" Version="0.3.*" />
<PackageReference Include="IceRpc.Logger" Version="0.3.*" />
<PackageReference Include="IceRpc.Protobuf.Tools" Version="0.3.*" PrivateAssets="All" />
<PackageReference Include="IceRpc.Protobuf" Version="0.3.*" />
<PackageReference Include="IceRpc.Slice.Tools" Version="0.3.*" PrivateAssets="All" />
<PackageReference Include="IceRpc.Slice" Version="0.3.*" />
<PackageReference Include="IceRpc.Transports.Quic" Version="0.3.*" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.*" />
<PackageReference Include="IceRpc.Deadline" Version="0.5.*" />
<PackageReference Include="IceRpc.Logger" Version="0.5.*" />
<PackageReference Include="IceRpc.Protobuf.Tools" Version="0.5.*" PrivateAssets="All" />
<PackageReference Include="IceRpc.Protobuf" Version="0.5.*" />
<PackageReference Include="IceRpc.Slice.Tools" Version="0.5.*" PrivateAssets="All" />
<PackageReference Include="IceRpc.Slice" Version="0.5.*" />
<PackageReference Include="IceRpc.Transports.Quic" Version="0.5.*" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.*" />

<!-- The 1.2 beta version is required for supporting the latest language features.
See: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3187 -->
Expand Down