Skip to content

[api-docs]: mark bypass-2FA GATs as forbidden for account/governance writes#70

Open
shmam wants to merge 4 commits into
mainfrom
bypass-2fa-token-docs
Open

[api-docs]: mark bypass-2FA GATs as forbidden for account/governance writes#70
shmam wants to merge 4 commits into
mainfrom
bypass-2fa-token-docs

Conversation

@shmam

@shmam shmam commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Documents that Granular Access Tokens created with bypass_2fa: true can no longer perform account-identity or org/team/package governance write operations. Direct publish (PUT /{escapedPackageName}) remains functional for such tokens.

Changes

  • api/shared-components.yaml — new reusable Forbidden2FABypassGAT (403) response component.
  • api/base.yaml — expand the Authentication & Authorization section to describe the bypass-2FA GAT capability boundary and enumerate the affected endpoints; update the npmAccessToken / granularAccessToken security scheme descriptions.
  • api/registry.npmjs.com/token.yaml — expand the bypass_2fa request/response field descriptions to enumerate the reduced capability surface.
  • Add a requirement note and 403 response to each affected endpoint documented in this repo:
    • POST /-/npm/v1/tokens
    • DELETE /-/npm/v1/tokens/token/{token}
    • POST /-/package/{package}/access
    • PUT /-/team/{orgName}/{teamName}/package
    • DELETE /-/team/{orgName}/{teamName}/package
    • PUT /-/org/{orgName}/user
    • DELETE /-/org/{orgName}/user
    • PUT /-/org/{orgName}/team
    • DELETE /-/org/{orgName}/{teamName}
    • PUT /-/org/{orgName}/{teamName}/user
    • DELETE /-/org/{orgName}/{teamName}/user
    • POST /-/package/{package}/trust (extends existing 403 with a bypass_2fa_gat example)
    • DELETE /-/package/{package}/trust/{config-uuid} (same)

Refs github/npm#15356 (parent: github/npm#15226).

Granular Access Tokens created with bypass_2fa: true can no longer
perform account-identity or org/team/package governance write
operations. Direct publish remains allowed (removal tracked in #15256).

Changes:
- Add shared Forbidden2FABypassGAT (403) response component and
  expand the Authentication section to describe the capability
  boundary and list affected operations.
- Update the bypass_2fa field description on POST /-/npm/v1/tokens
  and its response schemas to enumerate the reduced surface.
- Add a requirement note and 403 response to each affected endpoint:
  - POST   /-/npm/v1/tokens
  - DELETE /-/npm/v1/tokens/token/{token}
  - POST   /-/package/{package}/access
  - PUT    /-/team/{orgName}/{teamName}/package
  - DELETE /-/team/{orgName}/{teamName}/package
  - PUT    /-/org/{orgName}/user
  - DELETE /-/org/{orgName}/user
  - PUT    /-/org/{orgName}/team
  - DELETE /-/org/{orgName}/{teamName}
  - PUT    /-/org/{orgName}/{teamName}/user
  - DELETE /-/org/{orgName}/{teamName}/user
  - POST   /-/package/{package}/trust
  - DELETE /-/package/{package}/trust/{config-uuid}

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5b64e0a1-d9ff-4710-af56-5c47499cfb28
@shmam
shmam requested a review from a team as a code owner July 17, 2026 17:58
@shmam
shmam temporarily deployed to github-pages July 17, 2026 17:58 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview deployed!

You can view the preview of your changes here: https://npm-71689ab9a5-61146453.drafts.github.io/

This preview will be updated automatically when you push new commits to this PR.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5b64e0a1-d9ff-4710-af56-5c47499cfb28
@shmam
shmam temporarily deployed to github-pages July 20, 2026 21:09 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview deployed!

You can view the preview of your changes here: https://npm-71689ab9a5-61146453.drafts.github.io/

This preview will be updated automatically when you push new commits to this PR.

@shmam
shmam temporarily deployed to github-pages July 20, 2026 21:13 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview deployed!

You can view the preview of your changes here: https://npm-71689ab9a5-61146453.drafts.github.io/

This preview will be updated automatically when you push new commits to this PR.

Comment thread api/registry.npmjs.com/trust.yaml Outdated
Comment thread api/registry.npmjs.com/trust.yaml Outdated
Comment thread api/shared-components.yaml Outdated
Comment thread api/base.yaml Outdated

@nishantms nishantms left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second pass

Comment thread api/registry.npmjs.com/token.yaml
Comment thread api/shared-components.yaml
@shmam shmam changed the title docs: mark bypass-2FA GATs as forbidden for account/governance writes [api-docs]: mark bypass-2FA GATs as forbidden for account/governance writes Jul 22, 2026
- Add npmAccessToken and granularAccessToken to security blocks on
  endpoints that added a bypass-2FA GAT 403, so the 403 is reachable
  under the spec (token create/delete, access/team-package grant/revoke
  and set-access, org member add/remove, team create/delete and
  member add/remove).
- Trust 403: allow both 'error' and 'message' body shapes and switch
  the bypass_2fa_gat example to 'error' to match the auth-layer
  denial shape used by the shared Forbidden2FABypassGAT component.
  Update DELETE trust 403 description to include bypass-2FA GAT case
  for parity with POST.
- Shared Forbidden2FABypassGAT: trim trailing space and make the
  description specific.
- base.yaml: reference the access endpoint with {escapedPackageName}
  to match access.yaml.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5b64e0a1-d9ff-4710-af56-5c47499cfb28
@github-actions

Copy link
Copy Markdown

🚀 Preview deployed!

You can view the preview of your changes here: https://npm-71689ab9a5-61146453.drafts.github.io/

This preview will be updated automatically when you push new commits to this PR.

@shmam
shmam requested a review from nishantms July 22, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants