Back to glossary

Two-Person Integrity (TPI)

Two-person integrity (TPI) is a control requiring two distinct authorized people to approve a critical action, so no one person or credential can act alone.

Also known as Two-person rule, Two-person control, Dual authorization, Two-party review, Four-eyes principle

Two-person integrity (TPI) is a control that requires two different authorized people, each able to spot an incorrect or malicious action, to approve it before it takes effect. Also called the two-person rule or dual authorization, it ensures no single person, stolen account, or token can act alone. In software supply chains, the critical action is publishing a release.

The most important fact about two-person integrity in open source is where it is missing. Most projects require a second reviewer to merge code, then let one person, one bot, or one CI token publish the release. On npm, every owner of a package holds the same single access level, so adding a second maintainer gives an attacker two accounts to target rather than two approvals to collect. As of November 2026, npm offers no way to require two different people to approve a version before it goes live. Our position: two-person integrity belongs on the last irreversible step, the publish, and it has to count people, not credentials.

What is two-person integrity?

#

Two-person integrity is a rule that no single individual can perform a designated critical action alone. The term comes from US nuclear and cryptographic security. The Committee on National Security Systems glossary, CNSSI 4009, applies it to cryptographic keying material and requires at least two authorized persons, "each capable of detecting incorrect or unauthorized security procedures with respect to the task being performed." Finance calls the same idea the four-eyes principle.

That definition carries three requirements, and software implementations usually drop at least one:

  1. Two distinct people. Two passwords, two devices, or a person plus a token do not count. The control depends on identities that an attacker has to compromise separately.
  2. Each one able to catch the error. An approver who cannot see what they are approving, or who approves by habit, adds a second signature, not a second check.
  3. No lone path. If one person can go around the gate, through an admin override or a second publishing route, the control does not exist.

NIST SP 800-53 Rev. 5 calls the idea dual authorization: control AC-3(2) covers privileged commands and CM-5(4) covers system changes. CM-5(4) requires that changes "cannot occur unless two qualified individuals approve and implement such changes," and recommends rotating the duty to reduce collusion. Google applies the rule to its own production systems. Its Binary Authorization for Borg helps ensure that "personnel cannot modify source code, run binaries, or configure jobs without peer review."

Two-person integrity is narrower than separation of duties. Separation of duties gives different steps to different people. Two-person integrity puts two people on the same step. Both extend the least privilege principle: nobody holds enough authority to cause harm alone.

Why do we need two-person integrity?

#

We need two-person integrity because it is the only common release control that still works after an attacker obtains a valid credential. Multi-factor authentication, trusted publishing, and provenance all answer one question: is this the right principal? None of them asks whether a second, independent person agrees.

The npm incidents of the past 14 months show why that gap matters. Each attack needed exactly one thing.

  • One phished human. In the Qix compromise on September 8, 2025, a fake 2FA-reset email gave the attacker one maintainer's account. The packages it controlled generally receive 2 to 3 billion downloads per week.
  • One hijacked session. In the axios compromise on March 31, 2026, the lead maintainer of a package with about 100 million weekly downloads was targeted with social engineering, and the attacker took over his sessions. Because the attacker acted with the maintainer's own permissions, 2FA and OIDC-based publishing could not have stopped the release.
  • One stolen token. In the TanStack compromise in May 2026, nobody was phished. Attacker code running in a workflow's test and cleanup phase extracted an OIDC token from the runner and published 84 malicious package artifacts through the project's trusted-publisher binding.

Under two-person integrity at the publish step, each of those releases would have needed a second, independent person to say yes. That is the entire value of the control: it turns "compromise one thing" into "compromise two unrelated people at the same time."

Independence is the part teams get wrong. Two accounts behind the same SSO, two approvals from the same laptop, or a maintainer and a release bot whose token sits in the same CI secrets are not two people. In the bee-js compromise on November 9, 2026, the attacker held both a maintainer's GitHub account and the project's release-automation identity. That is maintainer account takeover in its most direct form: a second credential in the same attacker's hands satisfies any rule that counts credentials.

Where does the second person sit in a software release?

#

In most open source projects, the second person sits at the merge and nowhere after it. A release moves through six steps: commit, review and merge, tag or release, build, publish, and install. Branch protection puts code review on the merge. Consumers do not install merged commits, though. They install the tarball that came out of the publish step, and a second reviewer on the merge says nothing about how that tarball was made.

Figure 1. Where the second person sits in a typical open source release

  1. 1. Commit1 author
  2. 2. Review and merge2 people: branch protection
  3. 3. Tag or release1 maintainer or botbee-js bypass: an unsigned commit that never went through a pull request was tagged v13.3.0 and released. Step 2 never saw it.
  4. 4. Buildautomated in CI
  5. 5. Publish1 maintainer, bot, or tokenxz utils: part of the backdoor existed only in the release tarball, never in the reviewed git history.
  6. 6. Installwhat consumers run

Solid heavy border: step with a second person. Dashed box: an attack that went around it.

Figure 1 lists the six release steps in order. In a typical GitHub project, only the review-and-merge step has a second person, enforced by branch protection. The commit has one author. The tag-or-release step and the publish step usually have one actor, either a maintainer, a bot, or a CI token. The build is automated. Two real attacks went around the reviewed step. In bee-js, a commit that never went through a pull request was tagged v13.3.0 and published. In xz utils, part of the backdoor existed only in the release tarball and never in the reviewed git history.

The bee-js release shows the first gap. bee-js normally releases through release-please, which opens a release pull request for a human to review and merge. The attacker pushed an unsigned commit, de2f74e, that "does not belong to any branch and was never submitted through a pull request," then created GitHub release v13.3.0 pointing at it. The publish workflow accepted release events with its test jobs skipped, and its environment had no required reviewers or tag policy. The deployment went from creation to success in 73 seconds. npm removed @ethersphere/bee-js@13.3.0 about 75 minutes after it went live.

The bee-js provenance was genuine. Its signing certificate correctly named the workflow, the v13.3.0 tag, and commit de2f74e, in exactly the shape of the legitimate 13.2.0 attestation. As our analysis of the attack put it, package provenance "proves where a package was built, not that the source was reviewed."

The xz utils backdoor shows the second gap. Andres Freund's disclosure on March 29, 2024 noted that "one portion of the backdoor is solely in the distributed tarballs" for versions 5.6.0 and 5.6.1. Reviewers reading the git history could not have seen that part. The attacker was also a co-maintainer, so the second person who mattered was whoever compared the release tarball to the source, and no process required anyone to.

SLSA codifies the merge half of the problem. SLSA v1.2, released on November 24, 2025, makes "Two-party review" Level 4 of its new Source Track: "Changes in protected branches MUST be agreed to by two or more trusted persons prior to submission." The spec closes several bypasses. Review applies to the final revision, and moving reviewed content into a new context requires review again. It does not govern what a registry accepts after the merge. Two-person integrity has to bind to the artifact consumers install, and every path to the registry has to pass through it.

How does npm staged publishing compare to two-person integrity?

#

npm staged publishing adds a human approval between upload and availability, but any single maintainer can give it. It splits a release across two credentials and two moments in time. It does not split it across two people.

Staged publishing became generally available on May 22, 2026, in npm CLI 11.15.0. The CLI's own description is precise about what it does:

Bash
$ npm --version
11.21.2
$ npm stage --help
Stage packages for publishing, deferring proof-of-presence (2FA) to a later point in time

Usage:
npm stage
npm stage publish <package-spec>
npm stage list [<package-spec>]
npm stage view <stage-id>
npm stage approve <stage-id>
npm stage reject <stage-id>
npm stage download <stage-id>

npm stage publish needs no 2FA, so CI can run it. npm stage approve requires a 2FA challenge, and OIDC tokens from trusted publishing cannot approve. That closes the TanStack path: a token minted by attacker code inside a runner can put a version in the queue, but it cannot release it. On September 18, 2026, npm added stage-only tokens for token-based automation. Since npm v12, npm has been deprecating tokens that bypass 2FA, and it expects to remove their direct publishing around January 2027.

The registry records who approved each staged release. Here is the record for pnpm 12.18.0, with email addresses removed:

Bash
$ curl -s https://registry.npmjs.org/pnpm/12.18.0 | jq '._npmUser | del(.email, .approver.email)'
{
  "name": "GitHub Actions",
  "approver": {
    "name": "zkochan"
  },
  "trustedPublisher": {
    "id": "github",
    "oidcConfigId": "ab8ea4e6-5e14-45ea-9aad-652283679069"
  }
}

pnpm 11.5 already reads that approver field and ranks it above trusted publishing and provenance as a trust signal.

The approver is one person, though. npm maintainer Leo Balter stated the rule when staged publishing shipped: "Any maintainer with publish access to a package can approve a staged version of that package." He added that npm is "not introducing new permission levels with this feature" (GitHub community discussion). npm documents no approval threshold and no rule that the approver differ from whoever staged the release. In the same thread, maintainers asked for exactly that, including "having multiple users sign off."

axios shows both the gain and the limit. After the March compromise, axios moved its releases to a publish workflow that runs in a GitHub environment named npm-publish and calls npm stage publish --provenance. Every axios release since 1.17.0, published on June 3, 2026, records jasonsaayman as the approver, and the package lists one npm maintainer. A compromised CI run can no longer ship axios. An attacker in control of the maintainer's machine who can answer a 2FA prompt still can, and that was the March attack path. Staged publishing is the strongest release control npm offers, and it is still a one-person control.

We measured how far staged approval has spread. On November 9, 2026, we pulled the latest-version metadata for 52 widely used npm packages that we picked by hand, so treat it as a snapshot rather than a random sample. 27 of the 52 publish through trusted publishing. 8 use staged approval. 15 list a single maintainer, and for those 15 a release needs exactly one person by construction. Here is the check for eight of them:

Bash
for p in react express axios zod postcss pnpm chalk ws; do
  curl -s "https://registry.npmjs.org/$p/latest" | jq -r --arg p "$p" \
    '[$p, .version, (.maintainers | length),
      (if ._npmUser.trustedPublisher then "oidc" else "-" end),
      (._npmUser.approver.name // "-")] | @tsv'
done
Plain text
react	19.3.1	2	oidc	-
express	5.3.0	5	oidc	ulisesgascon
axios	1.21.1	1	oidc	jasonsaayman
zod	4.6.7	1	oidc	colinhacks
postcss	8.5.32	1	oidc	ai
pnpm	12.18.0	2	oidc	zkochan
chalk	6.0.1	1	-	-
ws	8.22.2	1	-	-

A second npm maintainer adds an OR, not an AND

#

On npm, adding a second maintainer makes a package easier to compromise, not harder. The documentation for npm owner says it directly: "there is only one level of access. Either you can modify a package, or you can't." Every owner can publish, approve staged versions, and add or remove other owners. Two owners give an attacker two independent routes to a release.

Figure 2. The same two maintainers, combined with OR and with AND

npm today: either owner can publish

One takeover is enough. The release ships.

P(release) = 1 − 0.95² = 9.75%

Two-person integrity: both must approve

One takeover is not enough. Nothing ships.

P(release) = 0.05² = 0.25%

Illustrative: each account has an independent 5% yearly takeover chance.

Figure 2 compares the same two maintainers, Alice and Bob, under two policies, assuming Alice's account has been taken over. On the left is npm's model today: either account alone can publish, so the compromised account ships a release. If each account independently has a 5% yearly chance of takeover, the chance that at least one falls is 1 − 0.95², or 9.75%. On the right is two-person integrity: a release needs both, so the compromised account ships nothing. The chance that both fall is 0.05², or 0.25%.

The 5% is illustrative, not a measurement, but the ratio is the point. The same two people produce a 39-fold difference in risk depending on whether the platform combines them with OR or with AND. This is also why our guidance on maintainer account takeover tells projects to prune dormant publishers. Both statements hold at once: on today's npm, extra owners add attack surface, so the second person has to live somewhere that enforces AND, such as a GitHub environment gate, rather than on the npm owner list.

Ownership changes are the other one-person action. Any single owner can run npm owner add, and the new owner gets full authority immediately. The xz takeover was a slow version of the same handover. Socket's Unstable ownership alert flags it from the consumer side, when a new collaborator starts publishing versions. That alert does not fire when an existing owner's account is hijacked, as with axios. For that case the signal has to come from the code itself: Socket's scanner flagged the malicious plain-crypto-js@4.2.1 dependency about six minutes after it was published, before either malicious axios version appeared.

How to enforce two-person integrity on a release today

#

The closest thing to two-person integrity on current GitHub Actions and npm tooling puts an environment gate in front of the only credential that can publish. Each layer closes one path and leaves others open.

  1. Protect the merge. Use a branch ruleset with at least one required approval and "Require approval of the most recent reviewable push," which GitHub defines as approval "by someone other than the person who pushed it." Dismiss stale approvals and turn off admin bypass.
  2. Protect the release trigger. Restrict who can create tags and releases with rulesets, and make the publish workflow check that the released commit is on the protected branch. bee-js had neither check.
  3. Gate the publish job. Run it in a GitHub environment with required reviewers, "prevent self-review" enabled, a deployment policy that admits only release tags, and administrator bypass disabled. Give the build job no publishing credential at all.
  4. Bind trusted publishing to the gate. Configure npm trusted publishing with the workflow filename and the environment name, and allow it only npm stage publish. npm then accepts OIDC tokens only from runs whose claims match that configuration, so a token minted in an ungated job, as in TanStack, does not match.
  5. Approve with a phishing-resistant key. Approve staged versions with a hardware security key, not a TOTP code that a fake login page can relay in real time.

Steps 3 and 4 look like this. The team ID is an example.

Bash
# Environment: required reviewer team, no self-approval, tag-only deploys
gh api -X PUT repos/OWNER/REPO/environments/npm-release --input - <<'EOF'
{
  "prevent_self_review": true,
  "reviewers": [{ "type": "Team", "id": 1234567 }],
  "deployment_branch_policy": {
    "protected_branches": false,
    "custom_branch_policies": true
  }
}
EOF
gh api -X POST repos/OWNER/REPO/environments/npm-release/deployment-branch-policies \
  -f name='v*' -f type=tag
YAML
name: release
on:
  push:
    tags: ['v*']
permissions:
  contents: read
jobs:
  build:                     # runs project code, holds no publishing credential
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
        with:
          node-version: 24.x
      - run: npm ci --ignore-scripts
      - run: npm test
      - run: npm pack
      - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
        with:
          name: tarball
          path: '*.tgz'
  publish:                   # waits for a second person, runs no project code
    needs: build
    runs-on: ubuntu-latest
    environment: npm-release
    permissions:
      id-token: write
    steps:
      - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
        with:
          name: tarball
      - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
        with:
          node-version: 24.x
          registry-url: 'https://registry.npmjs.org'
      - run: npm install -g npm@^11.15.0
      - run: npm stage publish ./*.tgz --provenance

No single control available today gives you two-person integrity end to end. Here is what each one stops in the three 2026 incidents above.

ControlSecond person?TanStack: token stolen in CIaxios: maintainer hijackedbee-js: unreviewed release pathVerdict
2FA on publishNoNo: the OIDC path never promptsNo: attacker had the maintainer's sessionsNo: the workflow publishedNecessary hygiene, not two-person integrity
Trusted publishing (OIDC)NoNo: this was the attack pathNo: 1.14.0 shipped via OIDC, 1.14.1 was published directlyNo: the legitimate workflow publishedRemoves long-lived tokens only
ProvenanceNoNo: attestations were validOnly as a signal: the malicious versions broke the OIDC patternNo: the attestation was genuineSays where it was built, not who agreed
npm staged publishingOne human plus CIYes: OIDC tokens cannot approveNo, if the attacker can answer 2FAYes, unless the attacker also holds an npm maintainer with 2FABest control npm has; still one person
Two-party code review (SLSA Source L4)Yes, at mergeNo: token stolen at runtimeNo: publish skipped the repoNo: the commit never reached a pull requestNecessary, but on the wrong step alone
Environment gate with prevent self-reviewYes, at publishYes, if trusted publishing is bound to the environmentNo: npm still accepts a direct owner publishYes, unless the attacker also holds a reviewer accountClosest to two-person integrity today

Our verdict: run all of them, and treat the environment gate as the two-person control. The others authenticate a principal. Only the gate requires a second one.

That gate still leaves real gaps:

  • Any npm owner can still publish from a laptop. npm's stage-only setting applies to a trusted publisher, and npm's documentation describes no package-wide switch that forces every publish, including an interactive one with 2FA, through the queue. No project can close this gap on its own.
  • GitHub requires only one approval. Its docs say "only one of the required reviewers needs to approve the job," from a list of up to six. With prevent self-review on, that is exactly two people: whoever triggered the job and one reviewer.
  • Bots count as people unless you stop them. If a release bot can trigger the workflow, an attacker who steals its token becomes the first person and needs only one more account. Treat a bot's token as a publishing credential.
  • Collusion and rubber-stamping. A reviewer who approves a tag without reading the diff since the last release satisfies the rule and defeats it.
  • Latency and solo maintainers. A security fix now waits for a second person, and a project with one maintainer cannot use any of this.

What registries should build

#

Registries should make two-person integrity a package setting, not a workflow convention. We think npm, and every registry that copies its permission model, needs four things:

  1. An approve-only role that can release staged versions but cannot upload, approve its own uploads, or change owners.
  2. A per-package approval threshold, such as two of three, with the rule that approvers differ from the uploader.
  3. A package-wide stage-only switch that covers interactive publishes, not just trusted publishers.
  4. The same threshold on ownership changes, because npm owner add is a release in disguise.

Each approval should be recorded in the packument, the way approver is today, so that install-time tools can require two distinct approvers before they accept a version.

None of that helps the 15 single-maintainer packages in our snapshot, or the long tail behind them. For a package one person maintains, the second person can only sit on the consumer side: someone, or something, that inspects each artifact before it installs. Until registries ship real two-person approval, that is where most of the ecosystem's second person will have to come from.