MintPlayer.Spark.Webhooks.GitHub.DevTunnel 10.0.0-preview.83

This is a prerelease version of MintPlayer.Spark.Webhooks.GitHub.DevTunnel.
dotnet add package MintPlayer.Spark.Webhooks.GitHub.DevTunnel --version 10.0.0-preview.83
                    
NuGet\Install-Package MintPlayer.Spark.Webhooks.GitHub.DevTunnel -Version 10.0.0-preview.83
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MintPlayer.Spark.Webhooks.GitHub.DevTunnel" Version="10.0.0-preview.83" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MintPlayer.Spark.Webhooks.GitHub.DevTunnel" Version="10.0.0-preview.83" />
                    
Directory.Packages.props
<PackageReference Include="MintPlayer.Spark.Webhooks.GitHub.DevTunnel" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MintPlayer.Spark.Webhooks.GitHub.DevTunnel --version 10.0.0-preview.83
                    
#r "nuget: MintPlayer.Spark.Webhooks.GitHub.DevTunnel, 10.0.0-preview.83"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MintPlayer.Spark.Webhooks.GitHub.DevTunnel@10.0.0-preview.83
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MintPlayer.Spark.Webhooks.GitHub.DevTunnel&version=10.0.0-preview.83&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MintPlayer.Spark.Webhooks.GitHub.DevTunnel&version=10.0.0-preview.83&prerelease
                    
Install as a Cake Tool

MintPlayer.Spark.Webhooks.GitHub.DevTunnel

Development-only tunneling for MintPlayer.Spark.Webhooks.GitHub. GitHub can't reach localhost, so this package gives you two ways to receive real webhook deliveries on your dev machine — without deploying.

Dev-only. Reference this package from local/development builds only. Production deployments need just the core MintPlayer.Spark.Webhooks.GitHub package, which receives webhooks directly over HTTPS.

Installation


<PackageReference Include="MintPlayer.Spark.Webhooks.GitHub.DevTunnel" Version="10.0.0-preview.42" />

Both tunnels are wired through the core package's options object, so you configure them inside spark.AddGithubWebhooks(...).

Option A — smee.io tunnel

No production deployment needed. Point your GitHub App's Webhook URL at a smee.io channel, then relay it to your local app:

using MintPlayer.Spark.Webhooks.GitHub.DevTunnel.Extensions;

spark.AddGithubWebhooks(options =>
{
    options.WebhookSecret = builder.Configuration["GitHub:WebhookSecret"] ?? string.Empty;
    options.AddSmeeDevTunnel(builder.Configuration["GitHub:SmeeChannelUrl"]!);
});

AddSmeeDevTunnel(smeeChannelUrl) registers a SmeeBackgroundService that connects to the channel over Server-Sent Events and feeds each delivery into the same SparkWebhookEventProcessor used in production. Signature validation still applies, and it reconnects on its own if the channel drops.

Why it reads the SSE stream by hand rather than using a smee client library. GitHub signs the exact bytes it sends, so the body must reach the processor unchanged. A client library that hands back a parsed body has already destroyed them: this tunnel previously went through Smee.IO.Client, whose body is typed object and materializes as a Newtonsoft JObject, and the body GitHub signed as {"created_at":"2024-01-01T12:00:12.000+02:00","amount":1.50} came back as {"created_at":"2024-01-01T11:00:12+01:00","amount":1.5} — the decimal lost its trailing zero and the timestamp was rebased into the host machine's timezone. Every such delivery failed HMAC validation and was silently dropped. The body is now lifted straight out of the frame with JsonElement.GetRawText(). The rule: capture the signed bytes, never reconstruct them.

Option B — WebSocket forwarding from production

When your app is already deployed, run two GitHub Apps (e.g. MyBot and MyBot-Dev) pointing at the same production webhook URL. Production processes its own app's webhooks and forwards the dev app's webhooks to connected developers over a WebSocket.

using MintPlayer.Spark.Webhooks.GitHub.DevTunnel.Extensions;

// Developer's local Program.cs — do NOT set DevelopmentAppId locally
spark.AddGithubWebhooks(options =>
{
    options.WebhookSecret = builder.Configuration["GitHub:WebhookSecret"] ?? string.Empty;
    options.AddWebSocketDevTunnel(
        builder.Configuration["GitHub:DevWebSocketUrl"]!,   // wss://yourapp.com/spark/github/dev-ws
        builder.Configuration["GitHub:DevGitHubToken"]!);   // your GitHub token
});

AddWebSocketDevTunnel(productionWebSocketUrl, githubToken) registers a WebSocketDevClientService that connects to the production server's dev-WS endpoint. The handshake sends your GitHub token; the server validates it against the GitHub API to determine your username and (if AllowedDevUsers is configured on the server) whether you're allowed to connect. Forwarded deliveries are processed locally through SparkWebhookEventProcessor, exactly as a direct delivery would be.

The production side of this flow (DevelopmentAppId, DevWebSocketPath, AllowedDevUsers, DevSocketFilter) is configured on the core package — see the GitHub Webhooks README.

Which developer gets which delivery

With several developers connected, the production side routes each delivery rather than fanning it out to everyone. By default a delivery goes to the developer who caused itsender.login matched case-insensitively against the login they authenticated with. A payload carrying no sender goes to everyone, so an unattributed delivery is never lost.

AllowedDevUsers does not do this: it gates who may connect, not who receives which delivery. Without routing, every connected developer sees every other developer's webhook traffic.

Override it on the production side:

// Route by repository instead of by sender
options.DevSocketFilter = (context, developerLogin) =>
    context.RepositoryFullName.StartsWith($"{developerLogin}/", StringComparison.OrdinalIgnoreCase);

// Or restore the old fan-out-to-everyone behaviour
options.DevSocketFilter = static (_, _) => true;

context is a GitHubWebhookRoutingContext carrying EventName, SenderLogin, RepositoryFullName and InstallationId, read from the already-signature-verified payload. Route on those values; don't authorize on them — anyone who can open a pull request controls SenderLogin.

Extension methods

Method Description
AddSmeeDevTunnel(string smeeChannelUrl) Relay a smee.io channel into the local webhook processor via SSE.
AddWebSocketDevTunnel(string productionWebSocketUrl, string githubToken) Connect to a production server's dev-WS endpoint to receive forwarded dev-app webhooks.

Both are extensions on GitHubWebhooksOptions and are called inside spark.AddGithubWebhooks(...).

Requirements

  • .NET 10.0+
  • MintPlayer.Spark.Webhooks.GitHub (referenced automatically)
  • A GitHub App with a webhook secret (see the core package README)

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.0-preview.83 0 9/19/2026
10.0.0-preview.82 35 9/17/2026
10.0.0-preview.81 41 9/15/2026
10.0.0-preview.80 56 9/10/2026
10.0.0-preview.79 63 9/9/2026
10.0.0-preview.78 59 9/9/2026
10.0.0-preview.77 56 9/9/2026
10.0.0-preview.76 57 9/9/2026
10.0.0-preview.75 61 9/7/2026
10.0.0-preview.74 67 9/7/2026
10.0.0-preview.73 69 9/7/2026
10.0.0-preview.72 65 9/6/2026
10.0.0-preview.71 77 9/3/2026
10.0.0-preview.70 66 9/2/2026
10.0.0-preview.69 56 9/1/2026
10.0.0-preview.68 77 8/29/2026
10.0.0-preview.67 71 8/29/2026
10.0.0-preview.65 71 8/28/2026
10.0.0-preview.64 78 8/24/2026
10.0.0-preview.63 68 8/23/2026
Loading failed