code.overheid.nl · Architecture decisions

ADR 0002

code.overheid.nl as publication platform and identity hub, with forges hosted by Code Punt

Status
Proposed
Date
24 November 2026
Discussion
Pull request #102

See it working. A proof of concept implements this decision, with made-up organizations and people. Open the demo with a walkthrough

Context and Problem Statement

Government code lives on several forges and will keep doing so. Some organizations run their own forge or want one, others never will. code.overheid.nl runs Forgejo (0001) and offers SSOn Rijk and GovConext as logins. Code Punt, the team that runs the platform, is not one of the organizations whose code it mirrors or hosts. Below, code.overheid.nl means the platform and Code Punt the people who run it.

Three questions are open. Where is a repository authoritative, who can sign in where, and who may change what? The GovForges architecture notes lay out the options. They deliberately keep hosting, interaction and authority apart, and identity apart from authorization. This ADR picks a direction within that frame.

Take an example. Amsterdam and Utrecht build a component together, a module for reports about public space that both of them run. It lives on Amsterdam's forge. A developer from Utrecht does half the work and should be able to merge. Today Amsterdam gives that developer a local account, and has to remember to remove it when they leave Utrecht.

We tried this twice in November 2026. First came a demo with three forges (Kiesraad, RVO and Logius, with made-up people and projects). It compared a mirror on code.overheid.nl, changes without an account, and signing in with another forge's account. Signing in across forges worked with Forgejo as it is. Forwarding changes through the central platform was the most fragile part (see A2). A proof of concept then built this decision on Forgejo 15.0.11. It runs as a demo with a walkthrough. It leaves out parts of the decision, which Confirmation lists. Every Forgejo limitation named below is unchanged in Forgejo 17.0.2.

This decision changes the mission of code.overheid.nl. Mission and vision names a collaboration platform and a build platform as goals two and three. Under this decision, projects are developed on the forges of organizations, and code.overheid.nl publishes, checks and brokers identity. It builds mirrored code to produce evidence. A mirror runs the workflows its origin already has (0003, rule 10). What code.overheid.nl builds from mirrored code, it publishes signed in its own package registry (same ADR, rule 11). No project has its build defined on code.overheid.nl.

Decision Drivers

Considered Options

Where the code lives:

How identity works across forges:

Decision Outcome

Chosen option: "A1. At the forges of organizations, with read-only mirrors and checks on code.overheid.nl" together with "B6. Organizations vouch through their own identity provider where it is connected to GovConext or SSOn Rijk, and through their forge otherwise, with code.overheid.nl as the hub". Together they meet the drivers with what Forgejo already has: pull mirrors, OAuth2 as provider and client, pull requests through AGit, and the commit status API. A1 needs rule 8 for organizations without a forge. Reporting at the origin stays a cost.

Under the name code.overheid.nl we do three things. It is the publication platform where government code is found, mirrored, checked and built. The signed artifacts of those builds go in its registry (0003, rule 11). It is also the identity hub through which someone from one organization is known at another organization's forge (rule 4). And it is where a request for a forge arrives, which Code Punt then runs (rule 8). It holds no project of its own, only mirrors, what is built from them, and the register. The code lives on the forge an organization runs itself (rule 7) or has Code Punt run (rule 8). The projects on code.overheid.nl today move to a forge that Code Punt runs for their organization. Their address on code.overheid.nl becomes the mirror.

flowchart TB
    subgraph forges["Forges of organizations"]
        direction LR
        ams["Forge of Amsterdam<br/>run by Amsterdam"]
        utr["Forge of Utrecht<br/>run by Utrecht"]
        host["Forge of another organization<br/>run by Code Punt"]
    end

    subgraph cod["code.overheid.nl"]
        direction LR
        mirror["Read-only mirrors"] --> checks["Checks"]
    end

    forges == "pull mirror" ==> mirror
    checks -. "results, fetched by<br/>a forge that opts in" .-> forges

Each organization vouches for its own people to code.overheid.nl, through its identity provider or its forge. Every forge trusts code.overheid.nl for people from elsewhere. No forge has to trust another directly.

flowchart LR
    ams["Forge of Amsterdam<br/>run by Amsterdam"]
    utr["Forge of Utrecht<br/>run by Utrecht"]
    host["Forge of another organization<br/>run by Code Punt"]
    kr["Forge of the Kiesraad<br/>run by the Kiesraad"]
    krc["Community forge of the Kiesraad<br/>open to anyone, not in the register"]
    idp["GovConext, SSOn Rijk<br/>identity providers of organizations"]

    hub(("code.overheid.nl<br/>identity hub"))
    register[("Register: per domain<br/>who vouches, and the home forge")]

    ams <-- "@amsterdam.nl" --> hub
    utr <-- "@utrecht.nl" --> hub
    host <-- "sign-in from elsewhere" --> hub
    kr <-- "its own team only" --> hub
    krc -- "suppliers, community" --> kr
    idp -- "connected organizations" --> hub
    register -.- hub

How the developer from Utrecht works on the code of Amsterdam:

sequenceDiagram
    actor dev as Developer at Utrecht
    participant ams as Forge of Amsterdam
    participant hub as code.overheid.nl
    participant utr as Forge of Utrecht

    dev->>ams: Sign in (OAuth2)
    ams->>hub: Sign in (OAuth2)
    hub->>utr: Sign in (OAuth2)
    utr-->>hub: developer@utrecht.nl
    hub->>hub: Check the register for @utrecht.nl
    hub-->>ams: developer@utrecht.nl, vouched by Utrecht
    dev->>ams: Choose Fork
    ams->>hub: Fork for someone from Utrecht
    hub->>utr: Create the fork, with consent of the developer
    Note over utr: The fork belongs to the organization Utrecht.
    dev->>utr: Commit in a branch of the fork
    dev->>hub: Open a pull request at Amsterdam
    hub->>utr: Fetch the branch from the fork
    hub->>ams: Push that branch to refs/for/main/<topic>, in the developer's name
    Note over ams: The pull request is the developer's.<br/>Amsterdam reviews and decides who may merge.<br/>Only a vouched account can get that right.

Rules

1. The origin is the source of truth. Every repository has one origin forge. code.overheid.nl holds a read-only pull mirror of it. The mirror names the origin's organization, in that organization's color, with the origin's address and the time of the last sync. Issues are off on the mirror, and Forgejo allows no pull requests on a mirror. The buttons for both lead to the origin. Fork leads to the forge of your own organization (rule 2). code.overheid.nl never commits to a mirror. What it builds, it builds from a definition outside the repository (0003, rule 10). Read-only holds for code and issues. The mirror does run the origin's own workflows, as the origin wrote them and without its secrets (same rule).

A private repository stays outside the federation. It gets no mirror and no checks, no fork at anyone's own forge and no pull request between forges. The system webhook of rule 7 also fires for private repositories, so code.overheid.nl drops those pushes unread. People who work together on a private repository keep doing so as today, with a local account at the forge that holds it.

When a forge leaves the register, its mirrors stay on code.overheid.nl as an archive. They are read-only, stop syncing, and carry a notice that the origin is gone. They are removed only at the request of the organization or after a takedown.

2. Changes are made in a fork at your own organization and proposed at the origin. Fork leads to code.overheid.nl. That holds on a mirror there, and on a federated forge for someone who signed in through the hub. The hub knows this person's home forge from the register. It creates the fork there, with their consent, in an organization they belong to. If they have a fork of the repository there already, it uses that one.

The pull request goes back through AGit. code.overheid.nl pushes the fork's branch to refs/for/<target branch>/<topic> at the origin, in the person's name and with their consent there. Forgejo turns that push into a pull request by that person, without a fork or write rights at the origin. The pull request lives entirely at the origin, where it is reviewed and merged. A second push updates it. Unlike A2, nothing is translated or kept in two places. Only a git push crosses between forges.

This holds for maintainers too. The Utrecht developer with merge rights at Amsterdam works in the fork at Utrecht and merges at Amsterdam. A branch in the repository itself is for the people of the organization that holds it. Someone outside the federation, such as a supplier or a contributor with a private address, forks at the origin with a local account there.

Issues follow the same split. An issue about the code goes to the origin. The Utrecht developer opens it at Amsterdam, signed in through the hub, and Amsterdam's list shows that she came from Utrecht. The fork at Utrecht has issues of its own, for the work in progress there. They stay at Utrecht and are not copied to the origin. code.overheid.nl holds no issues, and the button on a mirror leads to the origin. Someone outside the federation opens an issue at the origin with a local account there, if that forge allows it.

3. code.overheid.nl checks every mirrored commit, and the origin chooses whether it hears about it. The checks cover, for example, publiccode.yml, licenses, leaked secrets and known vulnerabilities in dependencies. They also cover what a build by code.overheid.nl shows, such as an SBOM, the test result and coverage (0003, rules 10 and 11). Every mirror gets the same checks. Results are public on code.overheid.nl, except for leaked secrets and known vulnerabilities. Those go first to the forge's contacts in the register, and become public once fixed or after a fixed period.

A repository says what it wants in the nl section of its publiccode.yml. There it sets whether the checks run and whether the results are reported back to the origin. It also sets how suggestions reach it (0003, rule 13). A check that does not apply can be named there with a reason, which code.overheid.nl then shows instead of a failure. The organization sets the default for its repositories when it joins or requests a forge (rule 9), and the repository's own choice wins.

Reporting back is opt-in and runs at the origin. A workflow in the repository fetches the results for its commit from code.overheid.nl and sets the commit status with the origin's own token. code.overheid.nl offers that workflow as a suggestion (0003, rule 12). A repository is in when it has the workflow and asks for reporting back, in its nl section or through its organization's default. The same workflow fetches the suggestions for a repository that wants them as pull requests (0003, rule 14). code.overheid.nl needs no account or rights at the origin for this. The origin does need Actions to run the workflow. A result is evidence in the sense of the GovForges note on software security. That note keeps evidence apart from policy and leaves open what a failed check blocks. The origin decides that in its branch protection.

4. Organizations vouch through their identity provider or their forge, and code.overheid.nl is the hub. An organization connected to GovConext or SSOn Rijk vouches through that identity provider. Any other organization vouches through its forge, which then acts as an OAuth2 provider for code.overheid.nl. Every federated forge trusts code.overheid.nl as the one identity provider for people from elsewhere. The forge someone visits hears who they are and who vouched for them. Each forge keeps its own login for its own people. It refuses identities from the hub for the people it vouches for itself.

Signing in starts with the work address. code.overheid.nl looks up the domain in the register and sends the person to the source that vouches for it (rule 5). That source asks for the password. A domain belongs to one organization, so the lookup has one answer. Someone whose address is in no registered domain, such as a contractor, picks the organization from a list. Forgejo needs no code change for this, only a login template on the hub that looks up the domain.

A vouch lasts 30 days and is renewed at every sign-in through the home source. When a vouch lapses, code.overheid.nl removes the account from the teams through which forges give rights. It also publishes the list of those accounts, so forges can take away their rights, keys and tokens (rule 7).

code.overheid.nl acts in someone's name only for rule 2, and for sending a suggestion that person chose to send (0003, rule 14). It does so through a second OAuth2 application at each forge. Forgejo keeps the scope of the first consent to an application, so with a single application the sign-in would decide for good what acting may do. The sign-in asks only read:user next to the OpenID scopes. Acting asks write access to repositories and organizations, next to read:user. That is the narrowest scope Forgejo has for creating a repository, pushing a branch and writing a pull request. code.overheid.nl uses the acting token only for that action. The details are in the notes of the proof of concept.

5. An organization vouches only for the people it marks as its own. For each organization, the register names the team on its forge that holds the people who work for it. That covers employees and contractors alike, whatever their address. code.overheid.nl vouches only for an account whose sign-in comes directly from that forge and carries that team. An organization that vouches through its identity provider vouches for the addresses in its domains instead.

An organization may list the domains of its addresses. A domain belongs to one organization only, and an address in it is never vouched for by another. An account at Utrecht's forge with an amsterdam.nl address is therefore vouched for by nobody. A small municipality whose developers all work for a supplier lists no domain and puts those developers in its team.

Trust that a forge places in some other source does not carry over to code.overheid.nl. The Kiesraad, for example, can run a community forge open to anyone behind its own forge, and let those people sign in there. They are not in the Kiesraad's team, even with an address at kiesraad.nl. The register also names the home forge where forks of an organization's people go. An organization without one can sign in and review. It needs a forge (rule 8) before its people fork.

6. Only vouched accounts come through the hub. code.overheid.nl has no registration. Every account on it came in through a source in the register. The only others are a few administrator and bot accounts of Code Punt, which an administrator makes. A bot posts the results of rule 3 on the mirrors. None of these accounts signs in at a forge, with one exception that an organization chooses for itself. Where its entry in the register admits it, the forge has an account without rights for the bot of code.overheid.nl. That bot opens pull requests with suggestions there (0003, rule 14).

A forge may give rights to an account from the hub only while the hub vouches for it. Everyone else, such as a supplier or a community contributor, works with a local account at the forge where they contribute. Whether that account gets rights is up to the organization that runs the forge. Forgejo cannot enforce the limit on rights from the hub, and code.overheid.nl holds no token to read a forge's teams. So every forge checks it itself (rule 7).

7. Every organization can run its own forge. This is the normal case, as for Amsterdam and Utrecht. The organization chooses the software, the hosting and who runs it, and joins through the register (rule 9). To join, a forge has to do seven things:

  1. Let code.overheid.nl mirror its public repositories, and tell it about every push with a system webhook.
  2. Sign in its own people from the organization's identity provider, where it has one. Keep the people it vouches for in its team. For an organization that vouches through its forge, sign them in for code.overheid.nl (rules 4 and 5). People who come in through another source of the forge, such as a community forge behind it, never land in that team. An account from such a source is never linked automatically to an existing account by its address.
  3. Accept code.overheid.nl as identity provider for people from elsewhere.
  4. Let code.overheid.nl act in someone's name for forks and pull requests, with that person's consent (rule 2). This is a second OAuth2 application.
  5. Give rights through the federation only to vouched accounts. Check that every week and report the result to code.overheid.nl (rule 6).
  6. Take away rights, keys and tokens of accounts whose vouch has lapsed (rule 4).
  7. Sign the commits the forge makes itself, such as merges and edits in the web interface, with a key of its own. A commit at the origin then shows which forge made it.

An eighth is optional. An organization that wants suggestions as pull requests, without anyone acting first, creates an account for the bot of code.overheid.nl on its forge. That account is in no team and has no rights on any repository. The organization gives Code Punt a token for it (0003, rule 14). Another kind of forge, such as GitLab, can join when it does the same and accepts a pull request pushed as in AGit. GitLab has no such route today. An organization may run several forges, for example one per department, but only one of them is the home forge for a given domain.

8. An organization that does not want to run a forge gets one on request. It requests the forge from code.overheid.nl with a pull request on the register (rule 9). Every organization gets its own Forgejo instance from the same image, with its own administrators. It also chooses the address. That can be a name under code.overheid.nl, or its own domain if the platform Code Punt runs on can issue a certificate for it. Once Code Punt merges the request, the forge runs within minutes, joined and mirrored. Code Punt runs it. The organization owns what is in it and who gets access.

Code Punt sets the forge up as operator, not as hub. It creates the organization's first administrator and an organization for its code, and does the things of rule 7 with that account. After that it keeps no account or token on the forge. The one exception is the bot of 0003, rule 14, where the organization admits it. The organization's administrator creates that account. The first password goes by mail to the administrator, who chooses their own at first sign-in. From then on Code Punt forgets the first password. The image runs the weekly check of rule 7 itself. Reaching the container is part of running the forge, but code.overheid.nl as hub still holds no rights there.

An organization with a forge can also have a forge behind it, such as the Kiesraad's community forge. The organization runs it itself, or Code Punt runs it at the organization's request. Such a forge is not in the register. code.overheid.nl does not mirror or check it, and vouches for nobody on it. Its people sign in at the organization's own forge and nowhere else (rule 5). Code Punt keeps the list of forges it runs this way apart from the register. It approves a request for one the way it approves a request for the register. This goes one level deep. A forge behind a forge gets no further forge behind it from Code Punt, and an organization that wants more layers runs them itself. Who runs CI on such a forge is the organization's responsibility, since a forge with open registration lets strangers run code on its runners. A forge that Code Punt runs this way gets a runner only when the organization asks for one and answers for what runs on it. That covers isolation, outbound traffic and abuse.

An organization can move its forge to its own hosting later. It moves the whole instance, so accounts keep their identity and every sign-in through the hub keeps working. Under its own domain only the DNS record changes. Under code.overheid.nl, the old address redirects to the new one.

9. The register is a repository on code.overheid.nl. Each organization has a file of its own, so two requests never touch the same file. The file gives the organization's name, its forge address and the team of the people it vouches for. It lists its domains if it has any, and says whether it vouches through its identity provider or its forge (rule 5). It names the contacts, and the organization's color for the pages that show its code elsewhere. Last come the organization's defaults for its repositories: whether the checks run, whether results are reported back, and how suggestions are delivered. The setting for suggestions is also where the organization admits the bot of code.overheid.nl to its forge (0003, rule 13). The organization chooses these defaults when it joins or requests a forge, and a repository's own publiccode.yml always wins.

An organization joins or makes a change through a pull request. Code Punt merges it when the organization is a government organization with an OIN or TOOI identifier, a DNS record proves each domain, and a contact at that domain confirms the request. Code Punt removes an organization at its request, or after a report that stays unresolved past an announced deadline. Code Punt decides on the register and on the rules in this ADR, but not on its own. A change to them is a pull request on the register or a new ADR. The contacts of every organization in the register hear about it and can comment before Code Punt merges it.

Consequences

Confirmation

The proof of concept tests the register, the rights report, the no-account rule and a forge on request. It also tests the Kiesraad with a community forge behind it, where a supplier works at the Kiesraad but is vouched for nowhere else. The team reaches the hub as a group claim, which Forgejo syncs into a team on the hub at every sign-in. The proof of concept vouches through forges only, with no identity provider behind them. On the hub's sign-in page a person picks their organization, without the lookup by work address of rule 4. The rights check runs inside the image of a forge it set up, at an interval of its own. It checks the head of each default branch rather than every commit. A mirror in the proof of concept runs the workflows of its origin on a runner of the hub. That runner runs jobs directly on its host, not in a fresh container per job. Forgejo cannot archive a mirror. An archived mirror in the proof of concept is therefore a mirror that stopped syncing, with a notice. It does not test the mirror report against a broken mirror, or an operation outside the scope of the acting token. The onboarding of rule 3 was not built.

The proof of concept leaves out more of the decision:

It also differs from the decision in four places. The register has a file per forge rather than per organization, so an organization without a forge cannot be in it. The first password of a forge on request stays with the service and shows on its status page, since no mail goes out. Every forge on request, and every forge behind one, gets a runner without asking for it. The hub also holds a templates organization with mirrors of project templates, kept in sync by an account of its own.

Effort

The proof of concept took about 24 hours of focused work with AI assistance. It shows that the rules work with Forgejo as it is, on demo forges with made-up people. It does not tell how long production takes. Its code is not meant to be kept, and what it leaves out (persistence, monitoring, security, upgrades, support) is most of the work. Working the same way, with attention and AI assistance, that work can go a good deal faster than a conventional estimate would say. We therefore name the parts and their relative size, and pin no dates on them.

Work Size
The service, the hub and the register for production, with review of register changes, monitoring, a security test and the DPIA large
Workflows on mirrors in a fresh container per job, and the signing key out of the service and into a hardware security module (0003, rule 11) medium
The contributions to Forgejo under More Information, including review upstream small each, but the pace is set upstream
Keeping up with Forgejo releases: the image overrides one Forgejo template (the consent page), adds five of its own, and relies on admin forms and API behavior that can change small, with every release
Running code.overheid.nl and the forges of rule 8: updates, backups, monitoring and incidents ongoing, and how it grows with the number of forges is to be measured
Helping an organization join or request a forge small each, more for the first ones

The way to find out is to build one part for production, such as the hub with the register, and measure it. Each Forgejo contribution that is accepted upstream removes a workaround from the image and some of the work per release.

Pros and Cons of the Options

Each option is scored against the drivers. The identity options are also scored against three criteria of their own. ✓ means it meets it, ~ that it meets it partly or at a cost, and ✗ that it does not.

Where the code lives
Driver A1 A2 A3 A4
One source of truth ✓ ✗ ✓ ✓
The organization keeps control ✓ ~ ~ ✓
The work stays with the employer ✓ ✗ ~ ✓
Anyone can report and propose ~ ✓ ~ ~
Works with Forgejo as it is ✓ ✗ ✓ ✓
An organization without a forge takes part ~ ~ ✓ ~
Every commit gets the same checks, in public ✓ ✓ ✓ ✗
The code stays visible when its origin goes down ✓ ✓ ✓ ✗
How identity works across forges
Driver B1 B2 B3 B4 B5 B6
Only vouched accounts get rights ~ ~ ✗ ~ ~ ~
Access ends at the home organization ~ ~ ✗ ✓ ~ ✓
The work stays with the employer ✓ ✓ ✗ ✓ ✓ ✓
Suppliers and the community take part ~ ~ ✓ ~ ✓ ~
Covers every government organization today ✓ ✓ ✓ ~ ✗ ✓
One trust relationship per forge ✓ ✗ ~ ✓ ✓ ✓
Works with Forgejo as it is ✓ ✓ ✓ ✓ ~ ✓

A1 is the only option where nothing lives in two places, the organization keeps control, and the code can still be checked and found when its origin goes down. In A3, one platform holds every organization's rights and data. That is what sets it apart from a forge per organization run by Code Punt (rule 8).

B1 and B6 pay for their single trust relationship with the hub. The hub becomes one point of failure and one target for every sign-in across organizations (see Consequences). B2 has neither problem, but it copies the register into every forge, where the copies drift apart without anyone noticing. A hub can be run redundantly and watched in one place. Ninety copies kept by ten organizations cannot be kept consistent. That is why we accept the hub.

No option enforces "only vouched accounts get rights" in Forgejo. Every one of them rests on the forge. From B4, B6 takes what a government login does well, which is that leaving ends at the employer. From B1 it takes the coverage of organizations that are not connected to GovConext or SSOn Rijk.

A1. At the forges of organizations, with read-only mirrors and checks on code.overheid.nl

A2. At the forges of organizations, with mirrors on code.overheid.nl that accept changes and forward them

Someone forks or edits on code.overheid.nl, and code.overheid.nl turns that into a pull request at the origin. This is pattern F in the GovForges note on authority and interaction.

A3. On code.overheid.nl, as the one forge for all of government

B1. Forges are identity providers, and code.overheid.nl brokers between them (hub)

B2. Forges are identity providers and trust each other directly (mesh)

Amsterdam adds Utrecht's forge as an identity provider itself, and so does every forge that wants people from Utrecht.

B3. A local account on every forge someone works on

This is how it works today.

B4. One identity provider for all of government

Everyone signs in everywhere with one government login. GovConext comes closest. By its own count in October 2026 it connects more than 350 government organizations, and it is already a login on code.overheid.nl.

B5. Native forge federation (ForgeFed in Forgejo)

People act on other forges with their home account, through ActivityPub. The GovForges federation landscape describes how far Forgejo and ForgeFed have come.

B6. Organizations vouch through their own identity provider where it is connected to GovConext or SSOn Rijk, and through their forge otherwise, with code.overheid.nl as the hub

See the decision above.

More Information

This ADR answers part of the decision table in the GovForges open architecture questions for code.overheid.nl. It chooses discovery, publication and verification without being the development home. Authority sits at the organization's forge, Git is the only synchronization, and evidence is shared while policy stays local. Work across forges follows pattern B of the note on authority and interaction. code.overheid.nl carries it out in the person's name and with their consent, as pattern E asks. We deviate from the note on identity and trust on one point. That note leaves identities independent per forge, and we put code.overheid.nl between them as a broker (rule 4).

Two things are left open here, as in the notes. One is a conservatory for dependencies and builds, which the note on software sovereignty covers. The other is who may make an archived mirror the new origin.

Still open, each for a later decision: