GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Don't default NPM_AUTH_TOKEN to support NPM OIDC · Issue #1440 · actions/setup-node

Don't default NPM_AUTH_TOKEN to support NPM OIDC #1440

New issue
Copy link
New issue
Copy link
Closed
Closed
Don't default NPM_AUTH_TOKEN to support NPM OIDC#1440
Copy link
Assignees
v-gowridurgad
Labels
feature requestNew feature or request to improve the current logic

Description

@mannycarrera4
mannycarrera4
opened on Nov 24, 2025
Issue body actions

Description:
A lot of packages are switching to OIDC to validate packages when publishing. It took a lot of debugging, but we had to reset the auth token to empty string intentionally in our CI, but it wasn't clear what was setting it.

Any chance we can the default setting to support NPM OIDC?

Reacted by Mikkel ALMONTE--RINGAUD, Michał Sęk, Frank, Jason Weinzierl, Simon Farshid, Aaron Sachs, Robin Bühler, Mike Hardy, Myles Scolnick, Jean-David Moisan and 13 more

Activity

Next
  1. mannycarrera4
    added
    feature requestNew feature or request to improve the current logic
    needs triage
    on Nov 24, 2025
  2. vexcited commented on Nov 24, 2025

    @vexcited
    vexcited
    on Nov 24, 2025
    More actions

    As a workaround, we can do this for now...

    - uses: actions/setup-node@v5
      with:
        node-version: 24
        registry-url: "https://registry.npmjs.org"
    
    - run: |
        NODE_AUTH_TOKEN="" npm publish

    Overwriting the NODE_AUTH_TOKEN env when running the command works like a charm.

    Reacted by 小弟调调, Mohd Hamza Shaikh and zhzhang
    Reacted by Mohd Hamza Shaikh and Johannes Lindgren
  3. frankpengau commented on Nov 25, 2025

    @frankpengau
    frankpengau
    on Nov 25, 2025
    More actions

    FYI for those following along, specifically this part of the code:

    setup-node/src/authutil.ts

    Lines 54 to 58 in 633bb92

    // Export empty node_auth_token if didn't exist so npm doesn't complain about not being able to find it
    core.exportVariable(
    'NODE_AUTH_TOKEN',
    process.env.NODE_AUTH_TOKEN || 'XXXXX-XXXXX-XXXXX-XXXXX'
    );

    ^ Although do note, that there is a comment about it prior to the line around issues of the variable not being set. Maybe worth evaulating whether if that is still indeed the case?

  4. v-gowridurgad
    removed
    needs triage
    on Nov 25, 2025
  5. v-gowridurgad commented on Nov 25, 2025

    @v-gowridurgad
    v-gowridurgad
    on Nov 25, 2025
    Contributor
    More actions

    Hello @mannycarrera4,
    Thank you for this feature request. We will investigate it and get back to you as soon as we have some feedback.

    Reacted by Mikkel ALMONTE--RINGAUD
  6. asachs01
    added 3 commits that reference this issue on Nov 26, 2025

    fix: clear NODE_AUTH_TOKEN to enable npm OIDC trusted publishing

    0e535bd

    fix: use inline NODE_AUTH_TOKEN override for npm OIDC

    16b8b7f

    fix: remove .npmrc authToken line to enable npm OIDC trusted publishing

    022ead2
  7. AKB0700 commented on Nov 27, 2025

    @AKB0700
    AKB0700
    on Nov 27, 2025
    More actions

    感謝建議 — 我已整理並補強成具體的變更提案,包含相容性與測試安排,供大家討論與實作參考:

    建議變更總覽

    • 預設行為:移除自動將 NODE_AUTH_TOKEN 設為預設假值的做法。只有在使用者明確提供 NODE_AUTH_TOKEN 時才會匯出該環境變數。
    • 測試:新增單元測試與 CI 測試場景,覆蓋「未設定 NODE_AUTH_TOKEN」以及 NPM OIDC 發佈的情境。
    • 備援說明:在 README / CHANGELOG 中新增升級指南,說明使用者若仍需舊流程,應如何在工作流程中顯式清空或提供 NODE_AUTH_TOKEN。
    • 可選開關:提供向後相容選項,如 with: respect-node-auth-token: true/false,或在程式中特別檢測 NODE_AUTH_TOKEN === '',讓使用者能明確控制行為。

    實作細節建議

    1. 核心行為變更
    • 將目前在 export NODE_AUTH_TOKEN 時的預設假值移除,改為:
      • 若 process.env.NODE_AUTH_TOKEN 存在(非 undefined),則匯出該值(包含空字串 '',以便使用者刻意清空)。
      • 若不存在,則不匯出該環境變數,避免向註冊表傳遞假 token。
    • 範例程式邏輯:
      • if (Object.prototype.hasOwnProperty.call(process.env, 'NODE_AUTH_TOKEN')) { export NODE_AUTH_TOKEN = process.env.NODE_AUTH_TOKEN } else { 不匯出 }
    1. 向後相容與開關
    • 新增輸入參數,例如 with: respect-node-auth-token: true/false(預設 false 表示採用新安全行為),或相反視專案偏好。
    • 另外支援透過明確空字串來表達「刻意清空」的情境(NODE_AUTH_TOKEN === ''),此情況應被視為有效輸入而導出空字串,以符合現有 CI workaround(如 NODE_AUTH_TOKEN="" npm publish)。
    1. 測試計畫
    • 單元測試:覆蓋以下情況
      • process.env.NODE_AUTH_TOKEN 未定義 → 不匯出變數
      • process.env.NODE_AUTH_TOKEN === '' → 匯出空字串
      • process.env.NODE_AUTH_TOKEN 有值 → 匯出該值
      • respect-node-auth-token 選項在 true/false 時的行為
    • 整合/CI 測試:建立模擬 NPM OIDC 發佈流程的 CI scenario(可在專門的 CI matrix 或模擬測試中執行),確保在不匯出預設 token 的情況下,OIDC 發佈可正常運作,且舊流程仍可透過選項或顯式環境變數達成。
    1. 文件與升級指南
    • README / CHANGELOG 更新要點:
      • 說明此行為變更的原因(支援 NPM OIDC,避免假 token 干擾)。
      • 提供範例轉換說明:
        • 若依賴舊行為,請在 workflow 中明確設定 NODE_AUTH_TOKEN(或透過 with 選項開啟相容模式)。
        • 若要刻意清空 token(workaround),請在 publish 步驟前設定 NODE_AUTH_TOKEN=""。
      • 範例片段與常見 FAQ(例如:「為什麼需要清空?」、「如何在 OIDC 環境下發佈?」)。

    需求與注意事項

    • 變更需小心以免破壞現有使用者的 pipeline,因此建議先以選項方式提供,並在下一個 major/minor 版本再改預設(視 repo 發行政策)。
    • 請保留原始註解與 commit 跟蹤(例如你引用的那段 authutil.ts 註解),並在 commit message 中說明原因與風險評估。

    如果你同意這個方向,我可以:

    • 開一個 PR 草案,包含程式碼變更、單元測試、README/CHANGELOG 更新範本與 CI 測試範例。
    • 或先提交一個較小的 PR 只做行為改動與單元測試,再用後續 PR 加上選項與文件說明。

    請告訴你偏好的步驟(直接 PR 草案或分階段提交),我就開始準備。

    Reacted by Mikkel ALMONTE--RINGAUD, Sukka, bezze, Kyle Shores and Chad Wilson
  8. asachs01
    added 2 commits that reference this issue on Nov 27, 2025

    fix: clear NODE_AUTH_TOKEN for OIDC trusted publishing

    e8385f5

    fix: use inline NODE_AUTH_TOKEN clearing for npm publish

    8d006e9
  9. openscript
    added 2 commits that reference this issue on Dec 5, 2025

    chore: override npm token

    d22d179

    chore: override npm token

    61fcdd0
  10. Daghis
    added a commit that references this issue on Dec 6, 2025

    fix(publish): clear NODE_AUTH_TOKEN for npm OIDC trusted publishing

    5a339a4
  11. 116 remaining items

  12. GyeongHoKim
    added a commit that references this issue on Aug 26, 2026

    ci: update GitHub Actions and drop NODE_AUTH_TOKEN workaround

    db02786
  13. TeamQQ
    added a commit that references this issue on Aug 27, 2026

    ci(release): fully automate releases with semantic-release

    a224ffe
  14. tom-at-align
    added a commit that references this issue on Sep 2, 2026

    fix(ci): force NODE_AUTH_TOKEN empty to stop setup-node's dummy value (…

    3d63750
  15. qkaibo
    added a commit that references this issue on Sep 7, 2026

    fix(ci): engage npm Trusted Publishing OIDC properly (abhigyanpatwari…

    93681d1
  16. chenmiao8563
    added a commit that references this issue on Sep 13, 2026

    ci(release): give npm a version that can do trusted publishing

    8f3b9a4
  17. FireOpalus
    added a commit that references this issue on Sep 17, 2026

    ci: 修好 npm trusted publishing(去掉 setup-node 的假凭据,并断言 npm >= 11.5.1)

    a28cf1a
  18. opensquad-ai
    added a commit that references this issue on Sep 28, 2026

    ci(npm): let the OIDC exchange actually run by clearing setup-node's …

    3835947
  19. wukrit
    added a commit that references this issue on Sep 28, 2026

    ci(release): clear NPM_AUTH_TOKEN so npm uses the OIDC flow

    7b7798f
  20. dmytri
    added a commit that references this issue on Oct 2, 2026

    ci: fix trusted publishing — setup-node@v6, node 24, unset NODE_AUTH_…

    d61e4d3
  21. mickorz
    added 3 commits that reference this issue on Oct 3, 2026

    fix(ci): drop registry-url from npmjs setup-node - it sabotages OIDC …

    4b264c6

    fix(ci): setup-node v6 (official trusted-publishing shape) + placehol…

    6341b26

    fix(ci): setup-node v7 - removes the placeholder NODE_AUTH_TOKEN inje…

    a050ad3
  22. subhajitlucky
    added 2 commits that reference this issue on Oct 8, 2026

    ci(publish): drop setup-node registry-url so npm reaches the OIDC exc…

    7ca3afc

    ci(publish): drop setup-node registry-url so npm reaches the OIDC exc…

    2d1aca0
  23. yyh-001
    added a commit that references this issue on Nov 15, 2026

    ci: 移除 setup-node registry-url,修复 trusted publishing 发布 E404

    7d7e5ed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @v-gowridurgad
    v-gowridurgad

Labels

feature requestNew feature or request to improve the current logic

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.