diff --git a/CHANGELOG.md b/CHANGELOG.md index 58de787..2c630d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1. - Updated the build to project-template v0.145.1: the repository's contribution policy is curated, so issues and discussion are welcome and code is by invitation ([#26](https://github.com/NCodeGroup/Mediator/issues/26)). - Package versions come from version.json through Nerdbank.GitVersioning, and each pack is validated against the published 1.0.0 packages ([#26](https://github.com/NCodeGroup/Mediator/issues/26)). - Each package carries its own readme on nuget.org ([#26](https://github.com/NCodeGroup/Mediator/issues/26)). +- `GOVERNANCE.md` names the maintainer and the owners, `ROADMAP.md` lists the plans for the next twelve months, and `docs/assurance-case.md` states the security requirements, the threat model, the design principles and the weaknesses it counters ([#35](https://github.com/NCodeGroup/Mediator/issues/35)). ## [1.0.0] - 2026-01-19 diff --git a/GOVERNANCE.md b/GOVERNANCE.md index e0d26b0..ee6504c 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -5,11 +5,9 @@ what and how decisions are made. ## Roles -[//]: # "Maintainers: name each maintainer in the Who column, such as @octocat." - | Role | Who | Responsibilities | | --- | --- | --- | -| Maintainer | The repository's owners | Sets direction, triages issues, reviews and merges pull requests, answers vulnerability reports, owns the repository's settings and the nuget.org packages | +| Maintainer | [@polewskm](https://github.com/polewskm) | Sets direction, triages issues, reviews and merges pull requests, answers vulnerability reports, owns the repository's settings and the nuget.org packages | | Contributor | Anyone | Opens issues, and a pull request a maintainer asked for on its issue, under [CONTRIBUTING.md](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md) | | Automation | `ncode-review[bot]`, `ncode-review-approver[bot]`, Dependabot, GitHub Actions | Reviews and approves a clean pull request, as `ncode-review-approver[bot]` where NCode Review's approver is set up, whose approval meets the ruleset's required approval ([ADR-0036](docs/decisions/project-template/0036-a-required-approval-is-met-by-ncode-reviews-approver-app.md)), proposes dependency updates, runs CI, tags and publishes releases where `AGENTS.md`'s Landing section sets `release: tag+release`; never merges a pull request except the pin bump `code-review-auto-merge.yml` merges once the required checks pass and, where the ruleset requires an approval, it is approved: by `ncode-review-approver[bot]` after a clean review where NCode Review's approver is set up ([ADR-0041](docs/decisions/project-template/0041-ncode-review-reviews-and-approves-dependabots-pull-requests.md)), else by a maintainer | @@ -41,10 +39,10 @@ organization that owns it, so anyone given access can carry on with no knowledge owners can administer every repository it holds, so they can step in when the repository's maintainers can't. nuget.org publishing runs in `.github/workflows/main.yml`: hand over whatever credential it uses with the repository. -[//]: # "Maintainers: name the owners, and keep the list current." - -Owners today: the repository's owners and the owners of the nuget.org packages. Continuity needs at least two people who -can administer both; until there are two, it is incomplete, and the OpenSSF Best Practices silver level can't be claimed +Owners today: [@polewskm](https://github.com/polewskm), the one owner of the NCodeGroup organization and the one admin +of this repository. The packages on nuget.org belong to the nuget.org account +[`NCode`](https://www.nuget.org/profiles/NCode). Continuity needs at least two people who can administer both; until +there are two, it is incomplete, and the OpenSSF Best Practices silver level can't be claimed ([docs/best-practices-badge.md](docs/best-practices-badge.md)). ## Changing This Document diff --git a/NCode.Mediator.Tests/Middleware/StandardCommandMiddlewareTests.cs b/NCode.Mediator.Tests/Middleware/StandardCommandMiddlewareTests.cs index 3eb1a33..c8a6e8e 100644 --- a/NCode.Mediator.Tests/Middleware/StandardCommandMiddlewareTests.cs +++ b/NCode.Mediator.Tests/Middleware/StandardCommandMiddlewareTests.cs @@ -486,12 +486,13 @@ public async Task HandleExceptionAsync_WhenHandlerSetsHandled_ReturnsHandledStat #region Exception Handling Integration Tests [Fact] - public async Task HandleAsync_WhenPreProcessorThrows_NotifiesListenersAndInvokesHandlers() + public async Task HandleAsync_WhenPreProcessorThrows_SkipsNextNotifiesListenersAndInvokesHandlers() { var exception = new InvalidOperationException("pre-processor error"); var command = new TestCommand { Value = "test" }; var listenerInvoked = false; var handlerInvoked = false; + var nextInvoked = false; var mockListenerWrapper = new Mock>(); mockListenerWrapper @@ -520,10 +521,15 @@ public async Task HandleAsync_WhenPreProcessorThrows_NotifiesListenersAndInvokes var middleware = new StandardCommandMiddleware(serviceProvider, preProcessors, postProcessors); await Assert.ThrowsAsync( - () => middleware.HandleAsync(command, () => ValueTask.CompletedTask, CancellationToken.None).AsTask()); + () => middleware.HandleAsync(command, () => + { + nextInvoked = true; + return ValueTask.CompletedTask; + }, CancellationToken.None).AsTask()); Assert.True(listenerInvoked); Assert.True(handlerInvoked); + Assert.False(nextInvoked); mockListenerWrapper.Verify(); mockHandlerWrapper.Verify(); } diff --git a/NCode.Mediator.Tests/Middleware/StandardCommandResponseMiddlewareTests.cs b/NCode.Mediator.Tests/Middleware/StandardCommandResponseMiddlewareTests.cs index c01eb03..92aa425 100644 --- a/NCode.Mediator.Tests/Middleware/StandardCommandResponseMiddlewareTests.cs +++ b/NCode.Mediator.Tests/Middleware/StandardCommandResponseMiddlewareTests.cs @@ -545,12 +545,13 @@ public async Task HandleExceptionAsync_WhenHandlerSetsHandled_ReturnsHandledStat #region Exception Handling Integration Tests [Fact] - public async Task HandleAsync_WhenPreProcessorThrows_NotifiesListenersAndInvokesHandlers() + public async Task HandleAsync_WhenPreProcessorThrows_SkipsNextNotifiesListenersAndInvokesHandlers() { var exception = new InvalidOperationException("pre-processor error"); var command = new TestCommand { Value = "test" }; var listenerInvoked = false; var handlerInvoked = false; + var nextInvoked = false; var mockListenerWrapper = new Mock>(); mockListenerWrapper @@ -579,10 +580,15 @@ public async Task HandleAsync_WhenPreProcessorThrows_NotifiesListenersAndInvokes var middleware = new StandardCommandResponseMiddleware(serviceProvider, preProcessors, postProcessors); await Assert.ThrowsAsync( - () => middleware.HandleAsync(command, () => ValueTask.FromResult("response"), CancellationToken.None).AsTask()); + () => middleware.HandleAsync(command, () => + { + nextInvoked = true; + return ValueTask.FromResult("response"); + }, CancellationToken.None).AsTask()); Assert.True(listenerInvoked); Assert.True(handlerInvoked); + Assert.False(nextInvoked); mockListenerWrapper.Verify(); mockHandlerWrapper.Verify(); } diff --git a/ROADMAP.md b/ROADMAP.md index ec690cd..3d850ad 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -3,8 +3,6 @@ What NCode.Mediator intends to do over the next year. Open issues hold the detail and the current state; this page is the direction. It is reviewed at least once a year and when a release changes it. -[//]: # "Maintainers: replace the prompts with the project's own plans, and review this page at least once a year." - ## Scope NCode.Mediator covers what [README.md](README.md) describes. A feature outside that starts as an issue, where the @@ -12,17 +10,28 @@ maintainers say whether it fits. ## Next Twelve Months -[//]: # "Maintainers: list what the project plans to do in the next twelve months, one bullet each, linking its epic rather than listing its stories." - +- **Supported .NET.** Move both packages off the older LTS they target, past its end of support as of 2026-11-29, so + they target only LTS releases Microsoft supports, and record which version ships the change + ([#33](https://github.com/NCodeGroup/Mediator/issues/33), + [ADR-0155](docs/decisions/project-template/0155-dotnet-code-targets-only-lts-releases-and-prose-names-no-dotnet-version.md)). +- **Publishing.** Publish the packages through nuget.org trusted publishing instead of an API key kept as a secret, + retire the build and test jobs of `.github/workflows/main.yml`, which `ci.yml` already runs, and harden its publish + job ([#25](https://github.com/NCodeGroup/Mediator/issues/25)). +- **Decisions left from the template upgrades.** Settle the assembly version, the auto-merge exception, the + `CA1711` and `CA1716` names in the public API, who owns `Directory.Packages.props`, and the changelog's backfill of + 1.0.0 ([#25](https://github.com/NCodeGroup/Mediator/issues/25)). - **Supply chain.** Keep external inputs pinned and current - ([ADR-0008](docs/decisions/project-template/0008-external-inputs-are-pinned-and-kept-current.md)), - and raise the OpenSSF Scorecard score where the repository controls it + ([ADR-0008](docs/decisions/project-template/0008-external-inputs-are-pinned-and-kept-current.md)), drop NCode + Review v1.7.0's cooldown exception once the version is three days old + ([#32](https://github.com/NCodeGroup/Mediator/issues/32), + [ADR-0009](docs/decisions/project-template/0009-new-dependency-versions-wait-a-cooldown.md)), and raise the OpenSSF + Scorecard score where the repository controls it ([ADR-0020](docs/decisions/project-template/0020-github-projects-are-scored-by-openssf-scorecard.md)). -- **OpenSSF Best Practices.** Reach the silver level, which needs a second owner for continuity - ([GOVERNANCE.md](GOVERNANCE.md#continuity), [docs/best-practices-badge.md](docs/best-practices-badge.md)). +- **OpenSSF Best Practices.** Register the project at bestpractices.dev and reach the silver level, which needs a second + owner for continuity ([GOVERNANCE.md](GOVERNANCE.md#continuity), + [docs/best-practices-badge.md](docs/best-practices-badge.md)). ## Not Planned -[//]: # "Maintainers: list what the project rules out, and why." - -- Nothing is ruled out yet. +No decision record or document rules out a feature yet. A request outside the [scope](#scope) starts as an issue; when +the maintainers rule one out, the decision is recorded in [docs/decisions/](docs/decisions/README.md) and listed here. diff --git a/docs/assurance-case.md b/docs/assurance-case.md index 22d0bc1..c61db1d 100644 --- a/docs/assurance-case.md +++ b/docs/assurance-case.md @@ -6,62 +6,198 @@ user-facing summary. ## Security Requirements -[//]: # "Maintainers: list what the project is expected to do as R1, R2, ..., and what users must not rely on." - -Not written yet. +NCode.Mediator is an in-process library. It dispatches the commands an application sends to the components the +application registered in its dependency injection container, inside the application's process and with its +privileges. It parses no input, opens no file, socket or process, and holds no secret. + +- **R1.** Only code the application registered runs. `AddMediator` registers the library's own types, scoped and + through `TryAdd`, so it replaces none of the application's registrations, and `DefaultMediator` and the standard + middleware resolve every handler, middleware, pre- and post-processor, exception listener and exception handler from + the application's `IServiceProvider`. The library scans no assembly, loads no type by name and creates no component + the container doesn't hold. +- **R2.** A command reaches only the pipeline of its own type. `SendAsync` resolves the pipeline from the command's + compile-time type; `PolymorphicSendAsync` closes the same pipeline type over the command object's runtime type with + `MakeGenericType` and resolves it from the container. A command that returns a response and has no registered + handler fails with `InvalidOperationException` instead of returning a default; a command without a response runs + each of its handlers, none when none is registered. +- **R3.** Failures fail closed. An exception from any part of the pipeline reaches the caller, rethrown unchanged with + `throw;`, unless an exception handler the application registered marks it handled. The steps after the one that + threw don't run: a pre-processor that throws stops the handler. The standard middleware catches what its + pre-processors, the rest of the pipeline inside it and its post-processors throw, notifies the exception listeners + resolved for the exception's runtime type, and runs the exception handlers resolved for it until one marks it + handled; only then does the call complete, and a command with a response returns the fallback response that handler + set. +- **R4.** Order is deterministic. Pre-processors, post-processors, the handlers of a command without a response, + exception listeners and exception handlers run in descending `ISupportMediatorPriority.MediatorPriority`, a + component without it counting as 0, and components of equal priority in the order the container returns them, their + registration order in Microsoft's container. So a validation or authorization pre-processor runs before the others + when its priority says so. Middleware nest the other way, with the lowest priority outermost, so it runs first. +- **R5.** The library keeps nothing it is given: it stores no command, response or exception after the call returns, + writes no log, and serializes, deserializes or formats none of them, so it adds no path by which a command's data + leaves the process. +- **R6.** The packages are built from reviewed code. Every change reaches `main` through a pull request with an + approval of its last push, the required checks passing and every review thread resolved. A package is published + only from a published GitHub release, by `.github/workflows/main.yml` after its build and test jobs pass on the + release's commit and it checks that each package carries the release's version, and the `Protect release tags` + ruleset refuses moving or deleting a `v*` tag. + +Users must not rely on what these requirements don't say: + +- The mediator authenticates, authorizes and validates nothing: it passes each command as the caller built it. Checks + belong in the application's pre-processors, middleware or handlers; a pre-processor that throws stops the handler + (R3) and runs in the order its priority gives (R4). +- The pre-processors, post-processors, listeners and exception handlers run inside the standard middleware, which + `AddMediator` registers as the open generic `ICommandMiddleware<>` and `ICommandResponseMiddleware<,>` through + `TryAdd`. An application that registers its own open generic middleware for either before calling `AddMediator` + replaces it, and then none of them runs. +- An exception handler the application registers for an exception's type can mark it handled, which suppresses it, + `OperationCanceledException` included, and gives the caller the fallback response. The library passes the + cancellation token to each component and doesn't check it itself. +- `DefaultMediatorPriorities.High` and `Low` are static properties any code in the process can set, read each time a + pipeline is sorted: a component whose order matters returns a priority of its own. +- A middleware with a high priority doesn't run first, though the README and the XML documentation say so: middleware + run lowest priority first (R4), and [#38](https://github.com/NCodeGroup/Mediator/issues/38) decides which to change. + Put a check that must come first in a pre-processor. +- `PolymorphicSendAsync` and the standard middleware build generic types at run time and are marked + `[RequiresDynamicCode]`: they need a runtime that supports dynamic code. +- As of 2026-11-29, `.github/workflows/main.yml`, which publishes, refers to its `actions/*` steps by version tag rather + than commit SHA, expands the release's tag name and the NuGet API key inside `run:`, makes no build provenance + attestation, and doesn't check that the release's tag names a commit on `main`. It pushes with the `NUGET_APIKEY` + secret, which neither the repository nor the organization holds for it, so a release publishes nothing to nuget.org + until a key is stored or trusted publishing replaces it; [#25](https://github.com/NCodeGroup/Mediator/issues/25) + tracks trusted publishing and the workflow's hardening. Both packages still target an older LTS release, past its end + of support, until [#33](https://github.com/NCodeGroup/Mediator/issues/33) moves them off it. ## Threat Model -[//]: # "Maintainers: add a table (Threat, In scope, Countered by) and state the trust boundary." - -Not written yet. +The trust boundary is the host application's process. Inside it are the application's code, its dependency injection +container and every component registered there, which the library trusts as it trusts the application. A command and +its data are the application's: when they carry untrusted input, such as a request body, the application's +pre-processors, middleware and handlers validate it, and the library passes it through without reading it. Packages +cross the boundary inward from nuget.org, built from this repository's reviewed sources. Out of scope: a component the +application registers acting against it, a compromised GitHub, nuget.org or maintainer account, and a vulnerability +in .NET, the container or a dependency itself ([SECURITY.md](../SECURITY.md#scope)). + +| Threat | In scope | Countered by | +| --- | --- | --- | +| A command runs a handler or other code the application didn't register | Yes | R1 | +| A command's runtime type, chosen from data the application received, makes the mediator load a type or run another command's pipeline | Yes | R2: the type is the object's own, and only the container's registrations for it are resolved | +| A command that returns a response is sent with no handler and the caller gets a default value | Yes | R2: it fails with `InvalidOperationException` | +| A validation or authorization pre-processor that rejects a command is bypassed | Yes | R3: a pre-processor that throws stops the handler; R4: it runs in a fixed order | +| A middleware given a high priority to run first runs after the others | Yes | Not yet: middleware run lowest priority first, against the documentation; [#38](https://github.com/NCodeGroup/Mediator/issues/38) | +| An exception is swallowed and the caller acts on a partial result | Yes | R3: it is rethrown unless an exception handler the application registered marks it handled | +| The library leaks a command's or a response's data through a log, a file or a message | Yes | R5 | +| A component the application registers is harmful | No | Out of scope: the application chooses what it registers | +| A dependency with a known vulnerability ships in a package | Yes | One runtime dependency; a NuGet advisory fails CI's build; Dependabot proposes security updates | +| Restore takes a package from an unexpected feed | Yes | `nuget.config` clears every source and adds nuget.org alone | +| A published package doesn't match its source | Yes | Deterministic CI builds with Source Link, and CI's `reproducible-build` job builds the packages twice and compares them | +| An unreviewed change reaches `main` or a release | Yes | R6 | +| A pull request's code runs with a secret or a token that can change the repository | Yes | The jobs that build a pull request hold `contents: read`, and `main.yml`'s `test` job `checks: write` for its test report; they keep no credentials in their checkouts and receive no secret. NCode Review runs from the default branch and never builds or runs the pull request's code | +| An action a workflow uses changes under its tag | Partly | Every action is pinned by full commit SHA, which Dependabot moves after a three-day cooldown, except the `actions/*` steps of `main.yml` ([#25](https://github.com/NCodeGroup/Mediator/issues/25)) | +| A stolen NuGet API key publishes a package | Partly | Only `main.yml`'s `publish` job reads `NUGET_APIKEY`, on a published release, and no such secret is stored as of 2026-11-29; trusted publishing would retire the key ([#25](https://github.com/NCodeGroup/Mediator/issues/25)) | +| A maintainer merges a harmful change | No | Out of scope: the review, the ruleset and CodeQL reduce the chance, and [GOVERNANCE.md](../GOVERNANCE.md) says who merges | ## Secure Design Principles Applied -[//]: # "Maintainers: say how the design applies economy of mechanism, fail-safe defaults, complete mediation, least -privilege and open design." - -Not written yet. +- **Economy of mechanism:** two small packages. `NCode.Mediator.Abstractions` holds only the contracts and depends on + no package; `NCode.Mediator` depends only on it and `Microsoft.Extensions.DependencyInjection.Abstractions`. A + pipeline is a chain of delegates built from the container's registrations, with no code generation, assembly + scanning or configuration format to parse. +- **Fail-safe defaults:** an exception reaches the caller unless a handler the application registered marks it + handled, a command with a response and no handler fails, and `AddMediator` adds its registrations through `TryAdd`, + so it never replaces one the application made (R1–R3). +- **Complete mediation:** every send, generic or polymorphic, resolves its command type's pipeline from the container, + so the pre-processors, middleware and exception handling registered for a command type run on every send of it, + whichever method sends it (R2). +- **Least privilege:** the library asks for no permission: no file, network, environment or process access, and no + secret (R5). Each workflow's top-level permissions are read-only or empty, and only the jobs that must write hold a + write permission. Each secret reaches only the job that needs it: NCode Review's keys only its jobs, which run from + the default branch, the approver's through the `code-review` environment, which only the default branch deploys to, + and `NUGET_APIKEY` only `main.yml`'s `publish` job. +- **Open design:** the sources, the build, the workflows, the tests and the decision records are public under + Apache-2.0, each package's PDB maps it to its source through Source Link, and no protection depends on the design + staying hidden: only keys are secret. ## Common Weaknesses Countered -[//]: # "Maintainers: list the CWE ids the design counters, each with the requirement that counters it." - -Not written yet. +- CWE-470, use of externally-controlled input to select classes or code: R1 and R2; the mediator resolves only the + container's registrations and loads no type by name. +- CWE-636 and CWE-755, not failing securely and improper handling of exceptional conditions: R3. +- CWE-696, incorrect behavior order: R4 for pre-processors, post-processors, handlers, listeners and exception + handlers; middleware run lowest priority first, against the documentation, until + [#38](https://github.com/NCodeGroup/Mediator/issues/38) is decided. +- CWE-532, insertion of sensitive information into a log file: R5. +- CWE-1395, dependency on a vulnerable third-party component: one runtime dependency, a NuGet advisory fails CI, and + Dependabot proposes security updates. +- CWE-829, inclusion of functionality from an untrusted control sphere: `nuget.config` restores from nuget.org alone, + and every action is pinned by full commit SHA, except the `actions/*` steps of `main.yml` + ([#25](https://github.com/NCodeGroup/Mediator/issues/25)). +- CWE-250, execution with unnecessary privileges: the jobs that run a pull request's code hold no write permission + to the repository's contents and no secret. ## Evidence -[//]: # "Maintainers: add the tests and the coverage the project keeps." - -- **Gate:** `./build/dod.ps1` builds in Release with warnings as errors +- **Gate:** `./build/dod.ps1` checks the decision index, builds in Release with warnings as errors ([ADR-0100](decisions/project-template/0100-warnings-are-errors-in-every-project.md)), runs the analyzers and the banned-API list in `build/BannedSymbols.txt` - ([ADR-0102](decisions/project-template/0102-disallowed-apis-are-banned-at-build-time.md)), and runs the tests; CI runs - the commands on every pull request. -- **Static analysis:** with `.github/workflows/codeql.yml`, which runs CodeQL on every pull request, a fork's too, or - else CodeQL's default setup configured and analyzing at least one language, the repository ruleset blocks a pull + ([ADR-0102](decisions/project-template/0102-disallowed-apis-are-banned-at-build-time.md)), fails on a NuGet advisory, + runs the tests and packs, validating each package against the published 1.0.0 + ([ADR-0147](decisions/project-template/0147-packages-are-validated-against-the-last-published-package.md)). CI's + `build-and-test` job runs it on every pull request, and `main.yml`'s `build` and `test` jobs build and test again. +- **Requirements under test:** `DefaultMediatorTests` checks R2: a command with a response and no handler throws + `InvalidOperationException`, sent either way, and polymorphic dispatch resolves the runtime type's pipeline. The + `StandardCommandMiddlewareTests` and `StandardCommandResponseMiddlewareTests` check R3: a pre-processor that throws + skips the handler, an unhandled exception is rethrown, and a handled one returns the fallback; the exception handler + wrappers' tests check that the first handler to mark it handled stops the rest. Each wrapper's and middleware's + `Sort_*` and equal-priority tests check R4, and `HandleAsync_MultipleMiddlewares_ExecuteInPriorityOrder` pins the + middleware order [#38](https://github.com/NCodeGroup/Mediator/issues/38) questions. R1 and R5 are the code's shape, + which review checks: `AddMediator`, `DefaultMediator` and the standard middleware's exception path are the only code + that touches the container. Coverage is neither measured nor gated: the template's `coverage_gate` answer is + `false`. +- **Static analysis:** `.github/workflows/codeql.yml` runs CodeQL's `security-extended` queries on the C# code and the + workflows on every pull request, every push to `main` and every week, and the `Protect main` ruleset blocks a pull request that adds a CodeQL alert at warning level or above, or a security alert of any severity ([ADR-0005](decisions/project-template/0005-the-default-branch-accepts-changes-only-through-pull-requests.md), [ADR-0030](decisions/project-template/0030-the-code-scanning-rule-is-added-only-where-codeql-analyzes-a-language.md), - [ADR-0044](decisions/project-template/0044-a-fork-pull-request-merges-without-a-bypass.md)). -- **Review:** every change reaches the default branch through a pull request with passing CI and every conversation - resolved, and the ruleset refuses force pushes and deletion - ([ADR-0005](decisions/project-template/0005-the-default-branch-accepts-changes-only-through-pull-requests.md), + [ADR-0044](decisions/project-template/0044-a-fork-pull-request-merges-without-a-bypass.md)). OpenSSF Scorecard scores + the repository on every push to `main` and every week (`.github/workflows/scorecard.yml`). +- **Review:** every change reaches `main` through a pull request, with no bypass: the `Protect main` ruleset requires + one approval of the last push, dismisses an approval a push makes stale, requires every review thread resolved and + the `build`, `build-and-test` and `test` checks passing on a branch up to date with `main`, and refuses force + pushes and deletion ([ADR-0005](decisions/project-template/0005-the-default-branch-accepts-changes-only-through-pull-requests.md), [ADR-0014](decisions/project-template/0014-every-pull-request-discussion-is-remediated-and-replied-to-before-it-merges.md)). - NCode Review reviews each pull request and approves a clean one. + NCode Review reviews each pull request, and its approver's approval of a clean review meets the required approval + ([ADR-0036](decisions/project-template/0036-a-required-approval-is-met-by-ncode-reviews-approver-app.md)). - **Dependencies:** pinned, and moved by reviewed updates ([ADR-0008](decisions/project-template/0008-external-inputs-are-pinned-and-kept-current.md)) that wait three days for a new version ([ADR-0009](decisions/project-template/0009-new-dependency-versions-wait-a-cooldown.md)). Dependabot - proposes the updates. Central package management keeps one version of each package - ([ADR-0101](decisions/project-template/0101-central-package-management.md)). -- **Release integrity:** packages are deterministic and source-linked - ([ADR-0130](decisions/project-template/0130-source-link-and-symbol-packages.md)). The project's own workflow, - `.github/workflows/main.yml`, publishes them to nuget.org. [SECURITY.md](../SECURITY.md#verify-a-package) says how to - verify a package. -- **Response:** [SECURITY.md](../SECURITY.md) defines private reporting, coordinated disclosure and credit. + proposes the updates and the security updates. Central package management keeps one version of each package + ([ADR-0101](decisions/project-template/0101-central-package-management.md)), and `nuget.config` restores from + nuget.org alone. Secret scanning and its push protection are on. +- **Release integrity:** packages are deterministic and source-linked, with symbol packages + ([ADR-0130](decisions/project-template/0130-source-link-and-symbol-packages.md)), and CI's `reproducible-build` job + builds them twice and compares them on every pull request, though no ruleset requires it + ([ADR-0154](decisions/project-template/0154-a-library-build-takes-nothing-from-the-clock-and-ci-builds-it-twice.md)). + `.github/workflows/main.yml` publishes them to nuget.org from a published release, after checking that each package + carries the release's version, with no build provenance attestation, and the `Protect release tags` ruleset refuses + moving or deleting a `v*` tag. [SECURITY.md](../SECURITY.md#verify-a-package) says how to verify a package. +- **Response:** [SECURITY.md](../SECURITY.md) defines private reporting, which is on, coordinated disclosure and + credit. ## Security Reviews -[//]: # "Maintainers: record each security review, newest first: its date, who did it, what it covered (the security requirements and the trust boundary above) and what it found. The OpenSSF Best Practices gold level asks for one in the last five years." +No independent security review of NCode.Mediator has been done. The OpenSSF Best Practices gold level asks for one in +the last five years ([best-practices-badge.md](best-practices-badge.md)); each one is recorded here, newest first, with +its date, who did it, what it covered and what it found. + +What reviews every change instead, none of it independent of the project: + +- NCode Review, the AI reviewer of NCodeGroup/code-review, reviews each pull request when it opens and again on a + maintainer's `/review`, and its approval of the last push is the one the ruleset requires. +- CodeQL's `security-extended` queries analyze the C# code and the workflows on every pull request and every week, + and OpenSSF Scorecard scores the repository's practices every week. +- Dependabot's security updates, and secret scanning with push protection, run on the repository continuously. -None recorded yet. +This page was first written on 2026-11-29 from the code and the repository's settings +([#35](https://github.com/NCodeGroup/Mediator/issues/35)): it states the requirements and the trust boundary a review +would cover, and is no review itself.