From 18227db820897f724bff4e069c2a1165d6b04f46 Mon Sep 17 00:00:00 2001 From: LaBani Said Date: Tue, 10 Nov 2026 16:59:08 +0100 Subject: [PATCH 1/2] Prepare RimBank to be published as an open-source project Add the governance, support, changelog, citation and third-party notices a public project needs, ship BIAN's Apache 2.0 licence next to the specifications we redistribute, add the dependency-review and OpenSSF Scorecard workflows, and document the main ruleset and repository security settings (ADR 0041). Co-Authored-By: Claude Opus 5.5 --- .github/ISSUE_TEMPLATE/config.yml | 3 + .github/release.yml | 21 ++ .github/workflows/dependency-review.yml | 34 +++ .github/workflows/scorecard.yml | 53 +++++ CHANGELOG.md | 15 ++ CITATION.cff | 24 +++ CONTRIBUTING.md | 28 ++- GOVERNANCE.md | 27 +++ README.md | 26 ++- SUPPORT.md | 13 ++ THIRD-PARTY-NOTICES.md | 17 ++ doc-0/release14.0.0/LICENSE | 201 ++++++++++++++++++ .../0041-open-source-repository-governance.md | 45 ++++ .../08-deployment-security-operations.md | 17 +- 14 files changed, 508 insertions(+), 16 deletions(-) create mode 100644 .github/release.yml create mode 100644 .github/workflows/dependency-review.yml create mode 100644 .github/workflows/scorecard.yml create mode 100644 CHANGELOG.md create mode 100644 CITATION.cff create mode 100644 GOVERNANCE.md create mode 100644 SUPPORT.md create mode 100644 THIRD-PARTY-NOTICES.md create mode 100644 doc-0/release14.0.0/LICENSE create mode 100644 docs/adr/0041-open-source-repository-governance.md diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 947e0f6..04a7b4b 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -3,3 +3,6 @@ contact_links: - name: Report a security vulnerability url: https://github.com/KsiProgramming/RimBank/security/advisories/new about: Please report vulnerabilities privately, never in a public issue. + - name: Ask a question or share an idea + url: https://github.com/KsiProgramming/RimBank/discussions + about: Questions about BIAN, the architecture or how to use RimBank belong in Discussions. diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..f0826f0 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,21 @@ +# Categories for GitHub's generated release notes, keyed on the type: labels (CONTRIBUTING.md#labels). +changelog: + exclude: + labels: [invalid, duplicate, wontfix] + categories: + - title: Security + labels: [type:security] + - title: Features + labels: [type:feature] + - title: Bug fixes + labels: [type:bug] + - title: Architecture decisions + labels: [type:adr] + - title: Documentation + labels: [type:docs] + - title: Dependencies + labels: [dependencies] + - title: Maintenance + labels: [type:chore] + - title: Other changes + labels: ["*"] diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..205d3d0 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,34 @@ +# Blocks pull requests that add a dependency with a known vulnerability (moderate or worse) or a +# strong copyleft licence. Policy: docs/adr/0005-ci-and-supply-chain-policy.md and ADR 0041. +# Dependency review needs the dependency graph, which is free only on public repositories, so the +# job is skipped while the repository is private (a skipped required check counts as passed). +name: dependency-review + +on: + pull_request: + +permissions: + contents: read + +concurrency: + group: dependency-review-${{ github.ref }} + cancel-in-progress: true + +jobs: + review: + name: dependency-review + if: ${{ !github.event.repository.private }} + runs-on: ubuntu-24.04 + timeout-minutes: 10 + steps: + - name: Check out + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Review dependency changes + uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 + with: + fail-on-severity: moderate + deny-licenses: AGPL-3.0-only, AGPL-3.0-or-later, GPL-2.0-only, GPL-2.0-or-later, GPL-3.0-only, GPL-3.0-or-later + show-patched-versions: true diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000..5ff83f2 --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,53 @@ +# OpenSSF Scorecard: grades the repository's supply-chain practices (pinned actions, branch +# protection, token permissions, code review, SAST, …), publishes the score for the README badge +# and uploads findings to Security > Code scanning. Policy: ADR 0005 and ADR 0041. +# Scorecard can only publish results for a public repository, so the job is skipped while private. +# Do not add top-level env or defaults, or other actions: publishing requires this minimal shape. +name: scorecard + +on: + branch_protection_rule: + push: + branches: [main] + schedule: + - cron: "41 5 * * 2" # Tuesdays 05:41 UTC + workflow_dispatch: + +permissions: + contents: read + +jobs: + analysis: + name: scorecard + if: ${{ !github.event.repository.private }} + runs-on: ubuntu-24.04 + timeout-minutes: 15 + permissions: + contents: read + actions: read + security-events: write # upload the SARIF to code scanning + id-token: write # sign the published results (OIDC) + steps: + - name: Check out + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Run Scorecard + uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 + with: + results_file: results.sarif + results_format: sarif + publish_results: true + + - name: Keep the results + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: scorecard-sarif + path: results.sarif + retention-days: 14 + + - name: Upload to code scanning + uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3 + with: + sarif_file: results.sarif diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0881221 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +All notable changes to RimBank are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Until 1.0.0, a minor version may contain breaking changes. + +GitHub release notes are generated from merged pull requests and grouped by their `type:` label ([.github/release.yml](.github/release.yml)). This file keeps the summary that people read. + +## [Unreleased] + +### Added + +- **Stage 0, Foundations:** solution skeleton, CI and CodeQL, the SharedKernel (`Result`/`Error`, typed ids, `Money`/`Currency`, decider and projection), architecture tests, the .NET Aspire AppHost and ServiceDefaults, RFC 9457 Problem Details, Marten and Wolverine wiring, idempotency keys, the authentication baseline, the BIAN conformance harness and MCP wiring. +- **Stage 1, Party Reference Data Directory:** the event-sourced `PartyReferenceDataDirectoryEntry` with its Demographics, Reference, Associations and BankRelations Behavior Qualifiers, every in-scope BIAN operation over HTTP and as MCP tools with parity, per-operation authorisation policies, and the published integration events. +- The public open-source repository set-up: governance, support, third-party notices, OpenSSF Scorecard and dependency review ([ADR 0041](docs/adr/0041-open-source-repository-governance.md)). + +[Unreleased]: https://github.com/KsiProgramming/RimBank/commits/main diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..62150bb --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,24 @@ +cff-version: 1.2.0 +message: "If you use RimBank in research or teaching, please cite it as below." +title: "RimBank: an open-source core banking platform implementing BIAN v14" +type: software +authors: + - name: "RimBank contributors" + - family-names: "Said" + given-names: "LaBani" + alias: "KsiProgramming" +repository-code: "https://github.com/KsiProgramming/RimBank" +abstract: >- + RimBank is an open-source core banking platform built in .NET that implements the + BIAN Service Landscape v14 using Domain-Driven Design, event sourcing and hexagonal + architecture. Every capability is exposed both as a BIAN HTTP API and as a Model + Context Protocol tool for AI agents. +keywords: + - core banking + - BIAN + - domain-driven design + - event sourcing + - hexagonal architecture + - .NET + - Model Context Protocol +license: MIT diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d2e9a7..bde08ef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -232,7 +232,7 @@ dotnet test --project tests/RimBank.Architecture.Tests ### What CI runs -Every push to `main` and every pull request runs two workflows (policy: [ADR 0005](docs/adr/0005-ci-and-supply-chain-policy.md)): +Every push to `main` and every pull request runs these workflows (policy: [ADR 0005](docs/adr/0005-ci-and-supply-chain-policy.md) and [ADR 0041](docs/adr/0041-open-source-repository-governance.md)): - **`ci` / `build`**: the same commands you can run locally: @@ -245,9 +245,15 @@ Every push to `main` and every pull request runs two workflows (policy: [ADR 000 ``` - **`codeql` / `analyze (actions)` and `analyze (csharp)`**: static analysis of the workflows and the C# code (the `security-and-quality` suite). It also runs weekly. +- **`dependency-review`** (pull requests only): fails if the PR adds a dependency with a known vulnerability of moderate severity or worse, or a GPL/AGPL licence. +- **`scorecard`** (pushes to `main` and weekly): OpenSSF Scorecard grades the repository's supply-chain practices and uploads its findings to Security > Code scanning. + +`dependency-review` and `scorecard` need public-repository features and are skipped while the repository is private. Dependabot opens weekly PRs for NuGet packages, GitHub Actions and the .NET SDK. +Pull requests from forks run their workflows only after a maintainer approves the run. No workflow uses `pull_request_target`, and the default token is read-only. + When you change a workflow: - Pin every action to a full commit SHA with a version comment, for example `uses: actions/checkout@<40-char sha> # v7.0.1`. @@ -278,23 +284,29 @@ Every issue and pull request carries **one `type:`** label, any **`area:`** labe | `stage:` | `stage:0` … `stage:8` | Which roadmap stage (synced) | | | `roadmap-phase` | An issue mirrored from the roadmap (synced: edit the roadmap, not the issue) | | | `dependencies` | Opened by Dependabot | +| | `good first issue`, `help wanted` | GitHub's community labels: small, well-scoped work for newcomers, and work the maintainer would welcome help with. Listed on the repository's `/contribute` page | A new label is added to `LABELS` in a PR, never created by hand, so the taxonomy stays in one place. A new bounded context adds its `context:` label in the same PR as its BIAN mapping ADR. ### Branch protection (maintainers) -Configure a branch ruleset for `main` in the repository settings: +`main` is protected by the repository ruleset **`main`** ([ADR 0041](docs/adr/0041-open-source-repository-governance.md), Settings > Rules > Rulesets): + +- A pull request is required, with one approval. Stale approvals are dismissed when new commits are pushed, and review threads must be resolved. +- Review from code owners ([.github/CODEOWNERS](.github/CODEOWNERS)) is required. +- These status checks must pass on a branch that is up to date with `main`: `build`, `analyze (actions)`, `analyze (csharp)`, `dependency-review`. +- History stays linear (squash merge only). Force pushes and deletion of `main` are blocked. +- **Bypass:** only the repository admin, and only inside a pull request. That lets the single maintainer merge their own green PR without a second approver. Nobody can push to `main` directly. -- Require a pull request before merging, with at least one approval, and dismiss stale approvals when new commits are pushed. -- Require review from code owners ([.github/CODEOWNERS](.github/CODEOWNERS)). -- Require these status checks to pass, and require branches to be up to date: `build`, `analyze (actions)`, `analyze (csharp)`. -- Block force pushes and branch deletion. +To check the live ruleset: `gh api repos/KsiProgramming/RimBank/rulesets`. When a second maintainer joins, remove the bypass (see GOVERNANCE.md). ## Commits and pull requests -- Write commit messages in the imperative mood ("Add Money arithmetic"), and keep each one focused. +- Work from a fork (or a branch, for maintainers) and open a pull request against `main`. Only the maintainer merges ([GOVERNANCE.md](GOVERNANCE.md)). +- Write commit messages in the imperative mood ("Add Money arithmetic"), and keep each one focused. PRs are squash-merged, so the PR title becomes the commit on `main`: make it imperative too. - Fill in the pull request template, including the Definition of done checklist. -- At least one maintainer review is required before merging. +- A maintainer review is required before merging. +- New to the project? Start with an issue labelled [`good first issue`](https://github.com/KsiProgramming/RimBank/labels/good%20first%20issue), or ask in [Discussions](https://github.com/KsiProgramming/RimBank/discussions). ## Code of Conduct and security diff --git a/GOVERNANCE.md b/GOVERNANCE.md new file mode 100644 index 0000000..afd1bbd --- /dev/null +++ b/GOVERNANCE.md @@ -0,0 +1,27 @@ +# Governance + +RimBank is a young project with a single maintainer. This document says who decides what, and how that will change as the community grows. + +## Roles + +| Role | Who | Can | +|---|---|---| +| **Maintainer** | [@KsiProgramming](https://github.com/KsiProgramming) | Merge pull requests, cut releases, accept ADRs, change the constitution in [`specs/`](specs/), triage and moderate | +| **Contributor** | Anyone who opens an issue, discussion or pull request | Propose changes from a fork. Every change reaches `main` through a reviewed pull request | + +The maintainer is the only person who can merge into `main`. The `main` branch is protected by a ruleset (see [CONTRIBUTING.md](CONTRIBUTING.md#branch-protection-maintainers)): no direct pushes, no force pushes, no deletion, required status checks, and code-owner approval for every pull request. + +## How decisions are made + +- **Day-to-day changes** are decided in pull request review, against the [mission](specs/mission.md), the [tech stack](specs/tech-stack.md) and the [Definition of done](specs/roadmap.md#definition-of-done-every-phase). +- **Significant or BIAN-interpretation decisions** are recorded as an [architecture decision record](docs/adr/). Anyone can propose one in a pull request. The maintainer accepts or rejects it, and gives the reasons in the ADR. +- **The roadmap** ([specs/roadmap.md](specs/roadmap.md)) is changed only by pull request. Proposals start as a [feature or roadmap proposal](https://github.com/KsiProgramming/RimBank/issues/new?template=feature_request.yml) or a [discussion](https://github.com/KsiProgramming/RimBank/discussions). +- When the maintainer and a contributor disagree, the constitution in `specs/` is the tie-breaker. If it is silent, the maintainer decides and records the decision in an ADR. + +## Becoming a maintainer + +Contributors who have landed several substantial pull requests, reviewed others' work and shown they follow the constitution may be invited to become maintainers. When that happens, this file, [CODEOWNERS](.github/CODEOWNERS) and the `main` ruleset are updated in the same pull request. Decisions will then need agreement between maintainers. + +## Code of Conduct + +Everyone in the project follows the [Code of Conduct](CODE_OF_CONDUCT.md). The maintainer enforces it. diff --git a/README.md b/README.md index 663c3f4..88a5e19 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,11 @@ [![ci](https://github.com/KsiProgramming/RimBank/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/KsiProgramming/RimBank/actions/workflows/ci.yml) [![codeql](https://github.com/KsiProgramming/RimBank/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/KsiProgramming/RimBank/actions/workflows/codeql.yml) +[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/KsiProgramming/RimBank/badge)](https://scorecard.dev/viewer/?uri=github.com/KsiProgramming/RimBank) +[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) +[![.NET 10](https://img.shields.io/badge/.NET-10-512BD4.svg)](global.json) +[![BIAN v14](https://img.shields.io/badge/BIAN-v14-0a7d6e.svg)](doc-0/release14.0.0/) +[![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md) **RimBank is an open-source, production-grade core banking platform built in .NET that implements the [BIAN](https://bian.org) Service Landscape v14 using Domain-Driven Design and hexagonal architecture.** @@ -10,6 +15,14 @@ The code is meant to read like the business it serves. Every BIAN service domain > **Status:** early development. Stage 0 (Foundations) and Stage 1 (Party Reference Data Directory) are done; Stage 2 (Product Directory) is next. See the [roadmap](specs/roadmap.md). > RimBank is not a licensed bank and provides no regulatory certification. +## Highlights + +- **BIAN v14, faithfully:** service domains, Control Records, Behavior Qualifiers and operations mapped one-to-one, checked by a BIAN conformance harness against the official OpenAPI and AsyncAPI files. +- **Event-sourced DDD core:** pure decisions, append-only events in PostgreSQL (Marten), read models rebuilt from each context's own event store, and optimistic concurrency and idempotency keys on every command. +- **HTTP and MCP, the same rules:** every BIAN operation is a REST endpoint *and* a [Model Context Protocol](https://modelcontextprotocol.io) tool for AI agents, with parity tests, per-operation OAuth scopes and RFC 9457 Problem Details on both. +- **Modular monolith, loosely coupled:** contexts integrate only through published integration events (Wolverine outbox), and architecture tests enforce the boundaries. +- **Production habits from day one:** .NET Aspire, OpenTelemetry, Testcontainers, warnings as errors, locked restore, SHA-pinned CI, CodeQL and OpenSSF Scorecard. + ## How BIAN maps to the code | BIAN concept | DDD / code concept | Example | @@ -32,7 +45,7 @@ Namespaces follow `RimBank..[.]` (adapte ├─ Directory.Packages.props # central package versions ├─ specs/ # the constitution: mission, tech stack, roadmap, phase plans ├─ docs/adr/ # architecture decision records -├─ doc-0/release14.0.0/ # BIAN v14 specifications (read-only input) +├─ doc-0/release14.0.0/ # BIAN v14 specifications (read-only input, Apache 2.0, see THIRD-PARTY-NOTICES.md) ├─ src/ # production code: RimBank.Core (every context's domain and application logic) and each context's adapters └─ tests/ # test projects ``` @@ -60,8 +73,15 @@ To run RimBank (Docker required): `dotnet run --project src/RimBank.AppHost`, th ## Contributing -Contributions are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md). To report a vulnerability, see [SECURITY.md](SECURITY.md). +Contributions are welcome, from a typo fix to a whole BIAN service domain. Read [CONTRIBUTING.md](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md), then pick a [good first issue](https://github.com/KsiProgramming/RimBank/labels/good%20first%20issue) or a phase from the [roadmap](specs/roadmap.md). + +- Questions and ideas: [Discussions](https://github.com/KsiProgramming/RimBank/discussions). See [SUPPORT.md](SUPPORT.md). +- Who decides and how: [GOVERNANCE.md](GOVERNANCE.md). +- What changed: [CHANGELOG.md](CHANGELOG.md). +- Vulnerabilities: report them privately, as described in [SECURITY.md](SECURITY.md). + +If RimBank helps you learn BIAN, DDD or event sourcing, a ⭐ helps others find it. ## License -[MIT](LICENSE) © 2026 RimBank contributors +[MIT](LICENSE) © 2026 RimBank contributors. The BIAN specifications in `doc-0/` are © BIAN under the Apache License 2.0. See [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md). RimBank is not affiliated with BIAN. To cite RimBank, see [CITATION.cff](CITATION.cff). diff --git a/SUPPORT.md b/SUPPORT.md new file mode 100644 index 0000000..70a33ef --- /dev/null +++ b/SUPPORT.md @@ -0,0 +1,13 @@ +# Getting help + +| You want to… | Go to | +|---|---| +| Ask how something works, or share an idea | [GitHub Discussions](https://github.com/KsiProgramming/RimBank/discussions) | +| Report a bug | [Bug report](https://github.com/KsiProgramming/RimBank/issues/new?template=bug_report.yml) | +| Propose a feature, a roadmap phase or a new BIAN service domain | [Feature or roadmap proposal](https://github.com/KsiProgramming/RimBank/issues/new?template=feature_request.yml) | +| Report a security vulnerability | **Privately**, as described in [SECURITY.md](SECURITY.md). Never in a public issue | +| Contribute code or documentation | [CONTRIBUTING.md](CONTRIBUTING.md), then pick a [good first issue](https://github.com/KsiProgramming/RimBank/labels/good%20first%20issue) | + +Before asking, check the [architecture and business documentation](docs/README.md), the [ADRs](docs/adr/) and the [roadmap](specs/roadmap.md). Many "why is it like this?" questions are answered there. + +RimBank is maintained by volunteers on a best-effort basis. There is no commercial support and no service-level agreement. RimBank is **not a licensed bank** and provides no regulatory certification. diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md new file mode 100644 index 0000000..916c505 --- /dev/null +++ b/THIRD-PARTY-NOTICES.md @@ -0,0 +1,17 @@ +# Third-party notices + +RimBank's own code and documentation are licensed under the [MIT License](LICENSE). This repository also redistributes third-party material under its own licence, listed below. + +## BIAN Semantic APIs, release 14.0.0 + +- **Location:** [`doc-0/release14.0.0/`](doc-0/release14.0.0/) +- **Source:** [github.com/bian-official/public](https://github.com/bian-official/public), folder `release14.0.0` +- **Copyright:** Banking Industry Architecture Network (BIAN), [bian.org](https://bian.org) +- **Licence:** [Apache License 2.0](doc-0/release14.0.0/LICENSE) +- **Changes:** none. The OpenAPI and AsyncAPI files are kept as published, as the read-only source of truth for service domains, operations and events. + +RimBank is an independent project. It is not affiliated with, endorsed by or certified by BIAN. "BIAN" is used only to say which specification RimBank implements. + +## NuGet packages + +RimBank's runtime and test dependencies are NuGet packages, restored at build time and not committed to this repository. Their versions are pinned in [`Directory.Packages.props`](Directory.Packages.props), and each package carries its own licence. Pull requests that add a dependency under a strong copyleft licence (GPL, AGPL) are blocked by the `dependency-review` workflow. diff --git a/doc-0/release14.0.0/LICENSE b/doc-0/release14.0.0/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/doc-0/release14.0.0/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/docs/adr/0041-open-source-repository-governance.md b/docs/adr/0041-open-source-repository-governance.md new file mode 100644 index 0000000..ea56391 --- /dev/null +++ b/docs/adr/0041-open-source-repository-governance.md @@ -0,0 +1,45 @@ +# 0041. Open-source repository governance + +- Status: Accepted +- Date: 2026-11-10 +- Roadmap phase: n/a + +## Context + +RimBank was always meant to be an MIT open-source project ([mission](../../specs/mission.md)), but until now the repository was private and owned by a user account. [ADR 0005](0005-ci-and-supply-chain-policy.md) designed the pipeline for that state: CodeQL kept its SARIF as an artifact, and the dependency-review action was left "for later". Making the repository public changes four things: + +- **Anyone can open a pull request.** The single maintainer must stay the only person who can change `main`, and every change, the maintainer's included, must pass the same checks. +- **Public-only security features become free:** code scanning uploads, secret scanning with push protection, private vulnerability reporting (which [SECURITY.md](../../SECURITY.md) already points to), the dependency graph and dependency review. +- **Redistribution becomes visible.** `doc-0/release14.0.0/` copies the BIAN Semantic APIs, which BIAN publishes under the Apache License 2.0. Apache 2.0 allows redistribution, but the licence text and attribution must go with the files. +- **Contributors and adopters need to know** who decides, where to ask and what changed. + +## Options considered + +1. **Classic branch protection, maintainer can push directly.** Simple. But the maintainer would skip the checks that contributors face, and classic protection is less expressive than rulesets. +2. **A `main` ruleset that requires a pull request and code-owner approval, with the repository admin allowed to bypass only inside a pull request.** Contributors' PRs need the maintainer's approval. The maintainer cannot approve their own PR, so they can merge it without an approval, but only through a PR and only once the required checks are green. Nobody, admin included, can push directly, force-push or delete `main`. +3. **Require approval from a second person for every PR.** The strongest review guarantee, but impossible with one maintainer. + +## Decision + +Option 2, together with the public-repository set-up below. + +- **Ruleset `main`** (target: the default branch): pull request required, 1 approval, stale approvals dismissed on push, code-owner review required, review threads resolved, linear history, no force push, no deletion. Required status checks, with branches up to date: `build`, `analyze (actions)`, `analyze (csharp)`, `dependency-review`. Bypass: the repository admin role, in pull requests only. +- **Merge settings:** squash merge only (the PR title becomes the commit message, matching CONTRIBUTING's imperative-mood rule), branches deleted after merge, "update branch" offered. +- **Security settings:** secret scanning with push protection, private vulnerability reporting, Dependabot alerts and security updates, and CodeQL results uploaded to code scanning (already automatic in `codeql.yml`). +- **Fork pull requests:** workflows from outside collaborators wait for the maintainer's approval before they run. The default `GITHUB_TOKEN` stays read-only, and no workflow uses `pull_request_target`. +- **New workflows**, under ADR 0005's rules (SHA-pinned, `contents: read` at the top, skipped while the repository is private): + - `dependency-review` blocks PRs that add a dependency with a vulnerability of moderate severity or worse, or a GPL/AGPL licence. + - `scorecard` runs OpenSSF Scorecard weekly and on every push to `main`. It publishes the score (README badge) and uploads findings to code scanning. +- **Community files:** [GOVERNANCE.md](../../GOVERNANCE.md) (single-maintainer model and how it grows), [SUPPORT.md](../../SUPPORT.md) (Discussions for questions), [CHANGELOG.md](../../CHANGELOG.md) (Keep a Changelog) with generated release notes grouped by `type:` label ([.github/release.yml](../../.github/release.yml)), [CITATION.cff](../../CITATION.cff), and Discussions enabled. +- **Third-party material:** BIAN's Apache 2.0 licence is copied to [doc-0/release14.0.0/LICENSE](../../doc-0/release14.0.0/LICENSE), and [THIRD-PARTY-NOTICES.md](../../THIRD-PARTY-NOTICES.md) records the source, the licence, that the files are unmodified, and that RimBank is not affiliated with BIAN. + +Option 2 wins because it treats the maintainer's code exactly like a contributor's: the same checks, always through a PR. The only exception is the approval nobody else can give yet. + +## Consequences + +- When a second maintainer joins, remove the admin pull-request bypass, so every PR needs another person's approval. Update CODEOWNERS and GOVERNANCE.md in the same PR. +- A new required check means updating both the ruleset and the list in CONTRIBUTING.md ("Branch protection"). +- Scorecard needs its workflow to keep its minimal shape (no top-level `env` or `defaults`, only the actions it allows), or publishing fails. +- Because of the GPL/AGPL rule, a dependency under those licences needs an ADR and an explicit allow entry in `dependency-review.yml`. +- Commit author emails in the existing history become public with the repository. +- SBOM generation, signed releases and container images stay in roadmap 7.5. diff --git a/docs/architecture/08-deployment-security-operations.md b/docs/architecture/08-deployment-security-operations.md index 07c72bc..9c9af46 100644 --- a/docs/architecture/08-deployment-security-operations.md +++ b/docs/architecture/08-deployment-security-operations.md @@ -111,7 +111,9 @@ flowchart LR | Error hygiene | RFC 9457 only; no stack traces; `traceId` for support | [ADR 0015](../adr/0015-problem-details-mapping.md) | | Data isolation | Per-context schema and login role with no grants elsewhere | Testcontainers isolation test | | Integrity | Idempotency, optimistic concurrency, append-only events | [ADR 0018](../adr/0018-idempotency-keys-for-commands.md), [ADR 0027](../adr/0027-optimistic-concurrency-for-commands.md) | -| Supply chain | CodeQL, Dependabot, NuGet audit, locked restore, nuget.org-only source mapping; SBOM and signed releases planned (7.5) | [ADR 0005](../adr/0005-ci-and-supply-chain-policy.md), [ADR 0013](../adr/0013-warning-and-package-governance.md) | +| Supply chain | SHA-pinned actions, read-only default token; CodeQL, Dependabot, dependency review (blocks moderate+ vulnerabilities and GPL/AGPL), OpenSSF Scorecard, NuGet audit, locked restore, nuget.org-only source mapping; SBOM and signed releases planned (7.5) | [ADR 0005](../adr/0005-ci-and-supply-chain-policy.md), [ADR 0013](../adr/0013-warning-and-package-governance.md), [ADR 0041](../adr/0041-open-source-repository-governance.md) | +| Change control | `main` ruleset: PR, code-owner approval and green required checks for every change; no direct or force push; admin bypass only inside a PR; fork workflows wait for maintainer approval | [ADR 0041](../adr/0041-open-source-repository-governance.md), [CONTRIBUTING](../../CONTRIBUTING.md#branch-protection-maintainers) | +| Repository secrets and disclosure | Secret scanning with push protection; private vulnerability reporting | [SECURITY.md](../../SECURITY.md), [ADR 0041](../adr/0041-open-source-repository-governance.md) | ### 3.3 STRIDE summary (Party context) @@ -152,10 +154,15 @@ flowchart LR PR[Pull request] --> B[Restore locked
Build warnings-as-errors] B --> F[dotnet format verify] F --> T[Tests: unit, property,
architecture, conformance,
Testcontainers, MCP parity] - T --> Q[CodeQL] - Q --> M[Merge to main] + PR --> Q[CodeQL
actions and C#] + PR --> DR["Dependency review
(vulnerabilities, licences)"] + T --> G{"main ruleset:
checks green, code-owner approval"} + Q --> G + DR --> G + G --> M[Squash merge to main] + M --> BOARD[Roadmap board sync] + M --> SC[OpenSSF Scorecard] M --> R["Release: SBOM, signed tag,
container image (7.5)"] - PR --> BOARD[Roadmap board sync] ``` -Workflows: `.github/workflows/ci.yml`, `codeql.yml`, `roadmap-board.yml`. +Workflows: `.github/workflows/ci.yml`, `codeql.yml`, `dependency-review.yml`, `scorecard.yml` (also weekly), `roadmap-board.yml` (only when the roadmap changes). Required checks and the ruleset: [CONTRIBUTING](../../CONTRIBUTING.md#branch-protection-maintainers). From 8dba880dd7bea27d3f284130623c6ba37d65850f Mon Sep 17 00:00:00 2001 From: LaBani Said <76583348+KsiProgramming@users.noreply.github.com> Date: Tue, 10 Nov 2026 18:26:56 +0100 Subject: [PATCH 2/2] Find the approved published-language contracts on CI as well as locally The schema contract tests located Publication/Approved through [CallerFilePath]. On CI, ContinuousIntegrationBuild maps source paths to /_/, so the approved file was never found, the test reported a mismatch, and writing the received file threw DirectoryNotFoundException: main's build has been red since roadmap 1.13. Embed the project directory as assembly metadata and read the contracts from it. Co-Authored-By: Claude Opus 5.5 --- .../PartyPublishedLanguageSchemaTests.cs | 14 +++++++++++--- ...yReferenceDataDirectory.Postgresql.Tests.csproj | 9 +++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/Party/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests/Publication/PartyPublishedLanguageSchemaTests.cs b/tests/Party/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests/Publication/PartyPublishedLanguageSchemaTests.cs index 343b2f5..26da9fd 100644 --- a/tests/Party/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests/Publication/PartyPublishedLanguageSchemaTests.cs +++ b/tests/Party/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests/Publication/PartyPublishedLanguageSchemaTests.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Reflection; using System.Text.Encodings.Web; using System.Text.Json; using System.Text.Json.Nodes; @@ -132,6 +132,14 @@ private static Published.PartyReferenceDataDirectoryEntryCreated Created() => private static Published.PartyReferenceDataDirectoryEntryUpdated Updated() => new(_eventId, _at, _entryId, 2, Published.PartyTypes.Organisation, Published.DirectoryEntryDateTypes.RefreshDate, _at); - private static string ApprovedPath(string identity, [CallerFilePath] string thisFile = "") => - Path.Combine(Path.GetDirectoryName(thisFile)!, "Approved", identity + ".approved.json"); + // The project directory is embedded at build time (see the .csproj): [CallerFilePath] is mapped to /_/ on CI. + private static string ApprovedPath(string identity) => + Path.Combine(ProjectDirectory(), "Publication", "Approved", identity + ".approved.json"); + + private static string ProjectDirectory() => + typeof(PartyPublishedLanguageSchemaTests).Assembly + .GetCustomAttributes() + .Single(attribute => attribute.Key == "ProjectDirectory") + .Value + .ShouldNotBeNull(); } diff --git a/tests/Party/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests.csproj b/tests/Party/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests.csproj index e4facd8..3fd7974 100644 --- a/tests/Party/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests.csproj +++ b/tests/Party/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests/RimBank.Party.PartyReferenceDataDirectory.Postgresql.Tests.csproj @@ -25,4 +25,13 @@ + + + + +