Skip to content

Packages ​

The Hardened release publishes 65 packages. The tables on this page list every one of them.

A Kestrel application references these packages, including three source generators:

xml
<ItemGroup>
  <PackageReference Include="Hardened.Shared.Runtime" Version="0.44.0-rc1000" />
  <PackageReference Include="Hardened.Web.Runtime" Version="0.44.0-rc1000" />
  <PackageReference Include="Hardened.Web.Kestrel.Runtime" Version="0.44.0-rc1000" />
  <PackageReference Include="Hardened.Library.SourceGenerator" Version="0.44.0-rc1000" PrivateAssets="all" />
  <PackageReference Include="Hardened.Web.SourceGenerator" Version="0.44.0-rc1000" PrivateAssets="all" />
  <PackageReference Include="ValidationModules.SourceGenerator" Version="1.2.0" PrivateAssets="all" />
</ItemGroup>

Every package is on nuget.org. A release publishes all 65 packages at one version. Project templates reference the packages that each project needs.

Referencing a source generator ​

Reference a source generator package with PrivateAssets="all", as the example does. The seven generator packages are Hardened.Library.SourceGenerator, Hardened.Web.SourceGenerator, Hardened.Function.SourceGenerator, Hardened.OpenApi.SourceGenerator, Hardened.Smithy.SourceGenerator, Hardened.Azure.Functions.SourceGenerator and Hardened.Gcp.Functions.SourceGenerator. The Generator column of the tables below marks each one. The validators come from ValidationModules.SourceGenerator, which is referenced the same way. Validation covers it.

PrivateAssets decides which projects run the generator:

ReferenceThe generator runs in
PrivateAssets="all"The project that declares the reference
No PrivateAssetsThat project, and every project that references it through a ProjectReference

Without PrivateAssets="all", a library's generators also run in a test project that references the library.

Each project that declares a [HardenedModule] or handlers references the generators it needs. A host project with no Hardened.Library.SourceGenerator reference of its own fails with CS1061 when the library it references declares that package with PrivateAssets="all":

text
'Application' does not contain a definition for 'PopulateServiceCollection'

Hardened.OpenApi.SourceGenerator and Hardened.Smithy.SourceGenerator bring Hardened.Idl.SourceGenerator with them. When a library references either one without PrivateAssets="all", a host project that references the library and Hardened.Web.SourceGenerator fails with HRDR008. The build also reports CS0102 and CS0111 on the generated routing names. Diagnostics covers HRDR008.

Core ​

PackageServesAttributePage
Hardened.Shared.Runtime[HardenedModule], [Enable<T>], configuration models and the environment[HardenedModule]Modules
Hardened.Shared.Testing[HardenedTestEntryPoint] and ITestContext, for a test project. A runner package goes beside it: DependencyModules.xUnit, DependencyModules.xUnit4 or DependencyModules.NUnit, which holds [ModuleTest][HardenedTestEntryPoint]Writing a test

Request pipeline ​

PackageServesAttributePage
Hardened.Requests.AbstractThe pipeline interfaces IExecutionContext, IExecutionRequest, IExecutionResponse and IExecutionFilter, Response<T1, T2>, [HardenedFunction] and BatchFailureModeThe execution pipeline
Hardened.Requests.RuntimeThe pipeline: filters, serialization, validation and error handling, and [RequireAuthorization], [CacheResponse<T>], [RateLimit], [Timeout] and [Retry]The execution pipeline
Hardened.Requests.TestingTest doubles for the pipeline, and the conformance tests for an IExecutionRequest implementation. Hardened.Web.Testing and Hardened.Functions.Testing bring itNone
Hardened.Requests.Caching.MemoryAn in-process store for [CacheResponse<T>][HardenedMemoryResponseCache]Response caching
Hardened.Requests.JwtA principal source for JWT bearer tokens. It checks a token against the issuer's JWKS and maps its scopes to grants. It is the only package that brings Microsoft.IdentityModel[JwtBearerAuthentication<TScheme>]Authentication
Hardened.Requests.Jwt.TestingTestJwtIssuer, which signs tokens with a key the application under test trusts[JwtTestIssuer]Authentication
Hardened.Requests.Serializers.MessagePackA MessagePack reader and writer[MessagePackSerializerLibrary]MessagePack
Hardened.Requests.Serializers.NewtonsoftA Newtonsoft.Json serializer for requests and responsesNone. See LimitsNone

Web ​

PackageServesAttributePage
Hardened.Web.RuntimeRouting and the route attributes such as [Get] and [BasePath], the OpenAPI document, CORS, compression, conditional requests and the health endpoints[HardenedWebModule]Routing
Hardened.Web.Kestrel.RuntimeThe Kestrel host, without the ASP.NET Core request pipeline: HardenedKestrelApplication[KestrelRuntime]Hosts
Hardened.Web.AspNetCore.RuntimeThe ASP.NET Core host: app.UseHardened()[AspNetCoreRuntime]Hosts
Hardened.Web.StaticContentServes a directory of files as routes[HardenedStaticContent]None
Hardened.Web.TestingITestWebApp, TestWebRequest, TestWebResponse and the credential attributes, for sending requests in a test[WebTesting]Sending requests
Hardened.Web.Kestrel.TestingRuns a test's requests through Kestrel, on a loopback port the kernel picks[KestrelTesting]Test hosts
Hardened.Web.AspNetCore.TestingRuns a test's requests through the ASP.NET Core pipeline, on a loopback port the kernel picks[AspNetCoreTesting]Test hosts

Client testing ​

PackageServesAttributePage
Hardened.Kiota.TestingMakes each Kiota client a test parameter that sends its requests into the application[KiotaTesting]Typed clients
Hardened.Refit.TestingMakes each Refit interface a test parameter that sends its requests into the application[RefitTesting]Typed clients

Views and project templates ​

PackageServesAttributePage
Hardened.Templates.RazorBladeViews written as .cshtml files and compiled by RazorBlade. The project also references the RazorBlade package[Enable<RazorTemplates>]Views
Hardened.TemplatesThe dotnet new templates hardened-web, hardened-function and hardened-library. dotnet new install Hardened.Templates installs it, and no project references itProject templates

Source generators ​

PackageServesBuild item or propertyGeneratorPage
Hardened.Library.SourceGeneratorEach module's generated half: PopulateServiceCollection, the module's attribute, CreateServiceProvider and the configuration. It holds the Hardened.DependencyModules.SourceGenerator generator as wellYesFrom scratch
Hardened.Web.SourceGeneratorThe routing table, a handler class for each route, the typed links and the OpenAPI documentYesFrom scratch
Hardened.Function.SourceGeneratorHandlers for [HardenedFunction] and the trigger attributesYesTriggers
Hardened.OpenApi.SourceGeneratorModels, the service interface, handlers and routes from an OpenAPI document named by a HardenedOpenApiSpec itemHardenedOpenApiSpec itemYesGenerating from OpenAPI
Hardened.Smithy.SourceGeneratorThe same from a Smithy model named by a HardenedSmithyModel item. The build needs the Smithy CLIHardenedSmithyModel itemYesGenerating from Smithy
Hardened.Idl.SourceGeneratorThe generator the two packages above bring with them. A project does not reference itBrought by the two aboveGenerating from OpenAPI
Hardened.SourceGeneratorThe generators' shared source. A project that sets PackageHardenedIncludeSource to true compiles it in. An application does not reference itPackageHardenedIncludeSourceNone
Hardened.SourceGeneration.TestingGeneratorTestHarness, which runs a generator over an in-memory compilation in a testNone

Functions ​

PackageServesAttributePage
Hardened.Functions.RuntimeThe trigger attributes [Queue], [Topic], [Timer], [Event], [Change], [Stream] and [Blob]The seven trigger attributesTriggers
Hardened.Functions.TestingITriggerDelivery, the generated trigger façades a test sends through, and [PipelineDelivery][FunctionTesting]Testing functions
Hardened.CloudEventsThe CloudEvents 1.0 reader that the Eventarc, Cloud Storage, Firestore and Event Grid adapters use. They bring itNone

Cloud adapters ​

Each adapter package sets an MSBuild property to its module's full type name. For example, Hardened.Aws.Lambda.Sqs sets HardenedQueueModule to Hardened.Aws.Lambda.Sqs.SqsModule. The build uses the property to register the module. Triggers covers these properties. It also covers the cases where an application applies the module attribute itself.

Each adapter's module is in a namespace with the same name as its package. Each adapter's module brings its cloud's runtime module: LambdaRuntimeModule on AWS, CloudRunRuntime on Google Cloud and FunctionsRuntimeModule on Azure.

AWS ​

Hardened.Aws.DynamoDbClient is the DynamoDB client. Hardened.Aws.Lambda.DynamoDb is the DynamoDB Streams adapter.

PackageServesAttribute and build propertyPage
Hardened.Aws.Lambda.RuntimeThe Lambda host: HardenedLambdaBootstrap, the invocation loop, and LambdaEmulator for running locallyNone. Each adapter's module brings LambdaRuntimeModuleAWS Overview
Hardened.Aws.Lambda.Http[Get], [Post], [Put], [Patch] and [Delete], behind an API Gateway HTTP API or a function URL[LambdaHttpModule], HardenedHttpModuleAWS Web applications
Hardened.Aws.Lambda.Invoke[HardenedFunction], invoked directly[InvokeModule], HardenedInvokeModuleAWS Invocations
Hardened.Aws.Lambda.Sqs[Queue], from Amazon SQS[SqsModule], HardenedQueueModuleAWS Queues
Hardened.Aws.Lambda.Sns[Topic], from Amazon SNS[SnsModule], HardenedTopicModuleAWS Topics
Hardened.Aws.Lambda.EventBridge[Timer] and [Event], from Amazon EventBridge[EventBridgeModule], HardenedTimerModule and HardenedEventModuleAWS Timers and Events
Hardened.Aws.Lambda.DynamoDb[Change], from DynamoDB Streams, with [NewImage] and [OldImage][DynamoDbStreamsModule], HardenedChangeModuleAWS Changes
Hardened.Aws.Lambda.Kinesis[Stream], from Kinesis Data Streams[KinesisModule], HardenedStreamModuleAWS Streams
Hardened.Aws.Lambda.S3[Blob], from S3 object notifications[S3Module], HardenedBlobModuleAWS Blobs
Hardened.Aws.LambdaThe runtime and the eight adapters above, in one referenceEvery attribute and property aboveAWS Overview
Hardened.Aws.Lambda.TestingDelivers a test's messages through the envelope each source sends and the invocation loop, and runs web requests through API Gateway[LambdaTesting], [LambdaWebTesting]AWS Testing
Hardened.Aws.DynamoDbClientIDynamoDbClientProvider: named DynamoDB clients[DynamoDbClientModule]AWS DynamoDB client
Hardened.Aws.DynamoDbClient.TestingDynamoDB Local in a Testcontainers container, for a test[LocalDynamoDb]AWS DynamoDB client

Google Cloud ​

PackageServesAttribute and build propertyGeneratorPage
Hardened.Gcp.CloudRun.RuntimeThe Cloud Run host, on Kestrel: CloudRunHost, TriggerFrontDoor and CloudRunTriggerRequest[CloudRunRuntime], HardenedHttpModuleGoogle Cloud Overview
Hardened.Gcp.CloudRun.PubSub[Queue], from a Pub/Sub push subscription, and [Topic], from an Eventarc trigger on a Pub/Sub topic[PubSubModule], HardenedQueueModule and HardenedTopicModuleGoogle Cloud Queues and Topics
Hardened.Gcp.CloudRun.Scheduler[Timer], from a Cloud Scheduler job[SchedulerModule], HardenedTimerModuleGoogle Cloud Timers
Hardened.Gcp.CloudRun.Invoke[HardenedFunction], invoked by a POST to the service[InvokeModule], HardenedInvokeModuleGoogle Cloud Invocations
Hardened.Gcp.CloudRun.Storage[Blob], from Cloud Storage, through Eventarc or a Pub/Sub notification[StorageModule], HardenedBlobModuleGoogle Cloud Blobs
Hardened.Gcp.CloudRun.Firestore[Change], from Firestore through Eventarc, with [OldValue][FirestoreModule], HardenedChangeModuleGoogle Cloud Changes
Hardened.Gcp.CloudRun.Eventarc[Event], any CloudEvent that Eventarc delivers[EventarcModule], HardenedEventModuleGoogle Cloud Events
Hardened.Gcp.CloudRunThe runtime and the six adapters above, in one referenceEvery attribute and property aboveGoogle Cloud Overview
Hardened.Gcp.CloudRun.TestingDelivers a test's messages as the push, CloudEvent, Scheduler request or invocation that Cloud Run receives[CloudRunTesting]Google Cloud Testing
Hardened.Gcp.Functions.RuntimeRuns a [CloudRunRuntime] application as a Cloud Functions 2nd gen function: HardenedFunctionsStartup<TApplication> and CloudFunctionHostGoogle Cloud Web services
Hardened.Gcp.Functions.SourceGeneratorWrites the function's entry typeYesGoogle Cloud Web services

Azure ​

PackageServesAttribute and build propertyGeneratorPage
Hardened.Azure.Functions.RuntimeThe isolated worker host: UseHardened<TApplication> and FunctionsInvocationHandler. Every Azure project references it, beside Microsoft.Azure.Functions.Worker.SdkNone. Each adapter's module brings FunctionsRuntimeModuleAzure Overview
Hardened.Azure.Functions.SourceGeneratorWrites the functions, the metadata provider that lists them and the executor that runs themYesAzure Overview
Hardened.Azure.Functions.ServiceBus[Queue], from a Service Bus queue, and [Topic], from a subscription of a Service Bus topic[ServiceBusModule], HardenedQueueModule and HardenedTopicModuleAzure Queues and Topics
Hardened.Azure.Functions.Timer[Timer], from a timer trigger[TimerModule], HardenedTimerModuleAzure Timers
Hardened.Azure.Functions.EventHubs[Stream], from Event Hubs[EventHubsModule], HardenedStreamModuleAzure Streams
Hardened.Azure.Functions.CosmosDb[Change], from the Cosmos DB change feed[CosmosDbModule], HardenedChangeModuleAzure Changes
Hardened.Azure.Functions.Blobs[Blob], from Blob Storage through Event Grid[BlobsModule], HardenedBlobModuleAzure Blobs
Hardened.Azure.Functions.EventGrid[Event], from Event Grid in the CloudEvents schema[EventGridModule], HardenedEventModuleAzure Events
Hardened.Azure.Functions.HttpThe web routes, behind one anonymous HTTP function[HttpModule], HardenedHttpModuleAzure Web applications
Hardened.Azure.FunctionsThe runtime and the seven adapters above, in one referenceEvery attribute and property aboveAzure Overview
Hardened.Azure.Functions.TestingBuilds the trigger data the worker binds and passes it to the invocation handler[AzureFunctionsTesting], [AzureFunctionsWebTesting]Azure Testing

Retired packages ​

Besides the 65 packages above, nuget.org holds 24 retired package ids. The release does not publish them. The table lists all 24.

PackageLast versionCurrent package
Hardened.Validation.SourceGenerator0.40.0-rc1000ValidationModules.SourceGenerator
Hardened.Aws.Lambda.ApiGateway0.33.0-rc1000Hardened.Aws.Lambda.Http, with [LambdaHttpModule] in place of [ApiGatewayModule]
Hardened.Amz.DynamoDbClient0.22.0-rc1000Hardened.Aws.DynamoDbClient
Hardened.Amz.DynamoDbClient.Testing0.22.0-rc1000Hardened.Aws.DynamoDbClient.Testing
Hardened.Amz.Shared.Lambda.Runtime0.22.0-rc1000Hardened.Aws.Lambda.Runtime
Hardened.Amz.Shared.Lambda.Testing0.22.0-rc1000Hardened.Aws.Lambda.Testing
Hardened.Amz.Web.Lambda.Runtime0.22.0-rc1000Hardened.Aws.Lambda.Http
Hardened.Amz.Web.Lambda.SourceGenerator0.22.0-rc1000None. A Lambda web project uses Hardened.Web.SourceGenerator
Hardened.Amz.Web.Lambda.Streaming0.18.0-rc1000Hardened.Aws.Lambda.Runtime
Hardened.Amz.Web.Lambda.Harness0.21.0-rc1000LambdaEmulator, in Hardened.Aws.Lambda.Runtime
Hardened.Amz.Function.Lambda.Runtime0.22.0-rc1000Hardened.Aws.Lambda.Invoke
Hardened.Amz.Function.Lambda.SourceGenerator0.22.0-rc1000Hardened.Function.SourceGenerator
Hardened.Amz.Function.Lambda.Streaming0.18.0-rc1000Hardened.Aws.Lambda.Runtime
Hardened.Amz.Function.Lambda.Testing0.22.0-rc1000Hardened.Aws.Lambda.Testing
Hardened.Amz.Function.Sqs.Runtime0.22.0-rc1000Hardened.Aws.Lambda.Sqs
Hardened.Amz.Function.Sqs.Testing0.22.0-rc1000Hardened.Aws.Lambda.Testing
Hardened.Amz.Function.DDB.Runtime0.22.0-rc1000Hardened.Aws.Lambda.DynamoDb
Hardened.Amz.Function.DDB.Testing0.22.0-rc1000Hardened.Aws.Lambda.Testing
Hardened.Amz.Cdk0.22.0-rc1000None
Hardened.Commands0.4.0-rc1000None
Hardened.Console.SourceGenerator0.4.0-rc1000None
Hardened.DependencyModules.SourceGenerator0.1.0-rc1Hardened.Library.SourceGenerator, which holds this generator
Hardened.Shared.Testing.xUnit0.39.0-rc1000DependencyModules.xUnit, or DependencyModules.xUnit4 for xunit.v3 4.x. [ModuleTest] replaces [HardenedTest]
Hardened.Shared.Testing.NUnit0.39.0-rc1000DependencyModules.NUnit. [ModuleTest] replaces [HardenedTest]

Moving from a Hardened.Amz Lambda adapter to its current package takes more than a new id. The module attributes differ. For example, Hardened.Amz.Function.Sqs.Runtime has [SqsLambda], and Hardened.Aws.Lambda.Sqs has [SqsModule].

The last version of each Hardened.Amz package is unlisted on nuget.org. Hardened.Aws.Lambda.ApiGateway 0.33.0-rc1000 and Hardened.DependencyModules.SourceGenerator 0.1.0-rc1 are unlisted too. The nuget.org search shows the version before the unlisted one. The search does not show Hardened.DependencyModules.SourceGenerator at all. A restore that names an unlisted version exactly succeeds.

Versions ​

A release is tagged v{line}-rc1000. The tag without its v is the version of every package. The current release is 0.44.0-rc1000. Reference every Hardened package at the same version. The templates set the version of every Hardened package to $(HardenedVersion).

Each push to main whose build passes publishes every package to GitHub Packages as {line}-preview{build}. {line} is the next release's line. {build} is the workflow run number, zero-padded to six digits. A preview sorts below the release of its line. The feed is https://nuget.pkg.github.com/ipjohnson/index.json. GitHub Packages asks for a GitHub token to restore, even for a public package.

GitHub Packages also holds versions 1.0.0-preview10132 to 1.0.0-preview10199 of 18 packages. Hardened.Web.Runtime is one of them. These versions sort above every release. A restore that asks for a version on neither feed resolves to the lowest version above it.

WARNING

With GitHub Packages configured, a version that is not published yet restores as a 1.0.0-preview build. NuGet warns NU1603, and the restore succeeds.

Limits ​

Hardened.Requests.Serializers.Newtonsoft has no module that an application can apply. [NewtonsoftSerializerLibrary] fails with CS0616:

text
'NewtonsoftSerializerLibrary' is not an attribute class

Next ​

PageCovers
Project templatesThe templates and the packages each project references
From scratchAn application assembled from packages, and the files the generators write
TriggersThe adapter for each trigger on each cloud, and how the build binds it
DiagnosticsHRDR008 and the other build diagnostics
RepositoryThe repository's folders, and how to build and test it

Released under the MIT License.