From 59bc8176b32c3b22d11865e640dbb050821072bb Mon Sep 17 00:00:00 2001 From: Ahmed Saleh Date: Thu, 21 Aug 2025 11:02:32 +0200 Subject: [PATCH 1/7] GH Actions: Use `windows-2025` runner image `windows-2019` is deprecated --- .github/workflows/build.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a411621..d89cf66 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: jobs: build: - runs-on: windows-2019 + runs-on: windows-2025 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 88ceb3f..293b482 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,7 +7,7 @@ on: jobs: build: - runs-on: windows-2019 + runs-on: windows-2025 steps: - uses: actions/checkout@v2 From 2d2068abac50cd3c6d08b011aed517cf9db9547d Mon Sep 17 00:00:00 2001 From: Ahmed Saleh Date: Wed, 20 Aug 2025 17:16:08 +0200 Subject: [PATCH 2/7] Fix AuthHost to work with ExampleApplication --- AuthHost/App.config | 12 +++++------ AuthHost/AuthModule.cs | 47 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/AuthHost/App.config b/AuthHost/App.config index 78fc9b9..1c37715 100644 --- a/AuthHost/App.config +++ b/AuthHost/App.config @@ -1,6 +1,6 @@ - - - - - - + + + + + + diff --git a/AuthHost/AuthModule.cs b/AuthHost/AuthModule.cs index ba7ffd5..584fe6b 100644 --- a/AuthHost/AuthModule.cs +++ b/AuthHost/AuthModule.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using Nancy; +using Newtonsoft.Json; using PusherClient; using PusherClient.Tests.Utilities; using PusherServer; @@ -60,6 +61,50 @@ public AuthModule() return authData; }; + + // Add routes that ExampleApplication expects + Post["/pusher/auth"] = _ => + { + Console.WriteLine($"Processing auth request for '{Request.Form.channel_name}' channel, for socket ID '{Request.Form.socket_id}'"); + + string channelName = Request.Form.channel_name; + string socketId = Request.Form.socket_id; + + string authData = null; + + if (Channel.GetChannelType(channelName) == ChannelTypes.Presence) + { + var channelData = new PresenceChannelData + { + user_id = socketId, + user_info = new { Name = "DefaultUser" } + }; + + authData = provider.Authenticate(channelName, socketId, channelData).ToJson(); + } + else + { + authData = provider.Authenticate(channelName, socketId).ToJson(); + } + + return authData; + }; + + Post["/pusher/auth-user"] = _ => + { + Console.WriteLine($"Processing user auth request for socket ID '{Request.Form.socket_id}'"); + + string socketId = Request.Form.socket_id; + + // For user authentication, return a simple user auth response + var userAuthResponse = new + { + auth = $"{PusherApplicationKey}:{socketId}", + user_data = JsonConvert.SerializeObject(new { id = socketId, name = "DefaultUser" }) + }; + + return JsonConvert.SerializeObject(userAuthResponse); + }; } private async Task SendSecretMessageAsync() @@ -82,4 +127,4 @@ private async Task SendSecretMessageAsync() Console.WriteLine(secretMessage); } } -} \ No newline at end of file +} From 768a32ae3acd0883b1770642fd25a354d768f49c Mon Sep 17 00:00:00 2001 From: Ahmed Saleh Date: Thu, 2 Oct 2025 12:54:08 +0200 Subject: [PATCH 3/7] Force TLS 1.2 --- PusherClient/Connection.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/PusherClient/Connection.cs b/PusherClient/Connection.cs index 4ea5480..752674c 100644 --- a/PusherClient/Connection.cs +++ b/PusherClient/Connection.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Security.Authentication; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; @@ -50,7 +51,8 @@ public async Task ConnectAsync() ChangeState(ConnectionState.Connecting); - _websocket = new WebSocket(_url) + _websocket = new WebSocket(_url, "", null, null, "", + "", WebSocketVersion.None, null, SslProtocols.Tls12) { EnableAutoSendPing = true, AutoSendPingInterval = 1 @@ -210,13 +212,13 @@ private void ProcessPusherEvent(string eventName, string rawJson, Dictionary Date: Thu, 2 Oct 2025 13:28:31 +0200 Subject: [PATCH 4/7] Github Actions: Add CodeQL workflow --- .github/workflows/codeql.yml | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..90700ff --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,44 @@ +name: "CodeQL" + +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master ] + schedule: + - cron: '23 12 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: windows-2025 + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'csharp' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1.0.2 + + - name: Restore dependencies + run: nuget restore pusher-dotnet-client.sln + + - name: Build + run: msbuild /p:deterministic=true /p:msbuildArchitecture=x64 /p:configuration=Release pusher-dotnet-client.sln + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 From 2a78faaba4ddcef59d1af07596333dc12c79aef8 Mon Sep 17 00:00:00 2001 From: Ahmed Saleh Date: Thu, 2 Oct 2025 13:38:10 +0200 Subject: [PATCH 5/7] Github Actions: CodeQL v2 --- .github/workflows/codeql.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 90700ff..58428d0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -11,7 +11,7 @@ on: jobs: analyze: name: Analyze - runs-on: windows-2025 + runs-on: windows-latest permissions: actions: read contents: read @@ -24,15 +24,21 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} + queries: security-and-quality - name: Setup MSBuild - uses: microsoft/setup-msbuild@v1.0.2 + uses: microsoft/setup-msbuild@v2 + + - name: Setup NuGet + uses: nuget/setup-nuget@v1 + with: + nuget-version: 'latest' - name: Restore dependencies run: nuget restore pusher-dotnet-client.sln @@ -41,4 +47,6 @@ jobs: run: msbuild /p:deterministic=true /p:msbuildArchitecture=x64 /p:configuration=Release pusher-dotnet-client.sln - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From 0f810c8385f073f5ced1f1c9518d624bbe2ad0fb Mon Sep 17 00:00:00 2001 From: Ahmed Saleh Date: Thu, 2 Oct 2025 14:10:45 +0200 Subject: [PATCH 6/7] Trigger CI --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 58428d0..1b61e09 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -49,4 +49,4 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 with: - category: "/language:${{matrix.language}}" + category: "/language:${{matrix.language}}" \ No newline at end of file From c05d889f76293b205d0d8214328a5a5b55da4744 Mon Sep 17 00:00:00 2001 From: Pusher CI Date: Thu, 2 Oct 2025 12:33:50 +0000 Subject: [PATCH 7/7] Bump to version --- CHANGELOG.md | 5 ++++- Root.Build.props | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 683b964..c007432 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ -# Changelog +# Changelog + +## +* [CHANGED] Force TLS 1.2 by default. ## 2.3.0-beta * [Added] Introduce user features diff --git a/Root.Build.props b/Root.Build.props index dd96fb2..a43217b 100644 --- a/Root.Build.props +++ b/Root.Build.props @@ -12,9 +12,9 @@ The .NET library for interacting with the Pusher WebSocket API. Register at http://pusher.com MIT icon-128.png - 2.3.0-beta - 2.3.0.0 - 2.3.0.0 + + .0 + .0