HoneyDrunk.Vault.EventGrid 0.8.0

dotnet add package HoneyDrunk.Vault.EventGrid --version 0.8.0
                    
NuGet\Install-Package HoneyDrunk.Vault.EventGrid -Version 0.8.0
                    
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="HoneyDrunk.Vault.EventGrid" Version="0.8.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HoneyDrunk.Vault.EventGrid" Version="0.8.0" />
                    
Directory.Packages.props
<PackageReference Include="HoneyDrunk.Vault.EventGrid" />
                    
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 HoneyDrunk.Vault.EventGrid --version 0.8.0
                    
#r "nuget: HoneyDrunk.Vault.EventGrid, 0.8.0"
                    
#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 HoneyDrunk.Vault.EventGrid@0.8.0
                    
#: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=HoneyDrunk.Vault.EventGrid&version=0.8.0
                    
Install as a Cake Addin
#tool nuget:?package=HoneyDrunk.Vault.EventGrid&version=0.8.0
                    
Install as a Cake Tool

HoneyDrunk.Vault.EventGrid

Azure Event Grid webhook helpers for HoneyDrunk.Vault. This package wires Key Vault rotation events into SecretCache invalidation so running workloads refresh rotated secrets within seconds instead of waiting on TTL.

Overview

This package is the transport glue for ADR-0006 Tier 3 rotation propagation. It is designed for hosts that already use HoneyDrunk.Vault and need to receive Azure Event Grid events raised by Azure Key Vault, validate the subscription handshake, authenticate inbound webhook requests, and invalidate cached secret names through ISecretCacheInvalidator.

Features:

  • Parses Microsoft.KeyVault.SecretNewVersionCreated
  • Accepts Event Grid schema and CloudEvents schema payloads
  • Handles Event Grid subscription validation handshake
  • Authenticates webhook requests with a shared secret resolved from ISecretStore
  • Exposes ASP.NET Core endpoint mapping helpers
  • Exposes a Functions-friendly handler wrapper
  • Never logs secret values, only secret names

Installation

dotnet add package HoneyDrunk.Vault
dotnet add package HoneyDrunk.Vault.EventGrid

Prerequisites

  • Azure Key Vault configured to emit Event Grid events
  • An Azure Event Grid subscription targeting your application webhook
  • HoneyDrunk.Vault configured with a provider capable of resolving VaultInvalidationWebhookSecret
  • A host application using ASP.NET Core or Azure Functions

Quick Start

ASP.NET Core Minimal API

using HoneyDrunk.Vault.EventGrid.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddVault(...);
builder.Services.AddVaultEventGridInvalidation();

var app = builder.Build();
app.MapVaultInvalidationWebhook("/internal/vault/invalidate");
app.Run();

Azure Functions Friendly Wrapper

public sealed class VaultInvalidationFunction
{
    private readonly VaultInvalidationFunctionHandler _handler;

    public VaultInvalidationFunction(VaultInvalidationFunctionHandler handler)
    {
        _handler = handler;
    }

    public Task<VaultInvalidationWebhookResponse> RunAsync(
        IReadOnlyDictionary<string, string?> headers,
        string body,
        CancellationToken cancellationToken)
    {
        return _handler.HandleAsync(headers, body, cancellationToken);
    }
}

Authentication Model

Requests are authenticated by:

  1. Event Grid origin and subscription validation flow
  2. A shared secret header, X-HoneyDrunk-Vault-Webhook-Secret

The expected shared secret value is not hardcoded and is not read from an environment variable. It is resolved from ISecretStore using the secret name VaultInvalidationWebhookSecret.

Event Handling

For Microsoft.KeyVault.SecretNewVersionCreated, the handler reads objectName from the event payload and calls ISecretCacheInvalidator.Invalidate(secretName).

That means:

  • the cache entry for that secret name is removed
  • the next ISecretStore.GetSecretAsync(new SecretIdentifier(name)) call fetches from the provider
  • callers continue resolving the latest version without pinning, preserving invariant 21

Example Event Shapes

Event Grid Schema

[
  {
    "eventType": "Microsoft.KeyVault.SecretNewVersionCreated",
    "data": {
      "objectName": "DbPassword"
    }
  }
]

CloudEvents Schema

[
  {
    "type": "Microsoft.KeyVault.SecretNewVersionCreated",
    "data": {
      "objectName": "DbPassword"
    }
  }
]

Best Practices

  1. Keep the webhook endpoint internal or network-restricted where possible.
  2. Store VaultInvalidationWebhookSecret in the same secure Vault system as other application secrets.
  3. Do not pin applications to a secret version when relying on cache invalidation.
  4. Treat cache TTL as a fallback safety net, not the primary propagation mechanism.
  5. Log only secret names and operational status, never secret values.

License

MIT License

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 (3)

Showing the top 3 NuGet packages that depend on HoneyDrunk.Vault.EventGrid:

Package Downloads
HoneyDrunk.Auth.AspNetCore

ASP.NET Core integration for HoneyDrunk.Auth. Provides middleware for JWT Bearer token authentication, HttpContext identity accessors, and seamless integration with ASP.NET Core's authentication pipeline.

HoneyDrunk.Web.Rest.AspNetCore

ASP.NET Core integration for HoneyDrunk REST conventions. Provides middleware for correlation propagation, exception mapping, and request logging. Includes MVC filters for model validation, minimal API endpoint conventions, and JSON serialization defaults. Ensures consistent API responses across all services.

HoneyDrunk.Data.AspNetCore

ASP.NET Core integration for HoneyDrunk.Data. Provides Event Grid Vault cache invalidation endpoint helpers for ADR-0006 secret rotation propagation.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.8.0 432 6/5/2026
0.7.0 1,135 5/27/2026
0.6.0 120 5/26/2026
0.5.0 893 5/18/2026
0.4.0 106 5/4/2026
0.3.0 764 4/25/2026

v0.8.0: Version alignment with the HoneyDrunk.Vault 0.8.0 release. No behavior change. See CHANGELOG.md for details.