Skip to content

feat(ci): SDK publish via Trusted Publishing (OIDC) - #283

Closed
mabry1985 wants to merge 2 commits into
mainfrom
feat/sdk-trusted-publishing-2026-05-25
Closed

feat(ci): SDK publish via Trusted Publishing (OIDC)#283
mabry1985 wants to merge 2 commits into
mainfrom
feat/sdk-trusted-publishing-2026-05-25

Conversation

@mabry1985

Copy link
Copy Markdown
Member

Summary

  • Drops `env: NODE_AUTH_TOKEN` from both publish + dry-run steps in `.github/workflows/sdk-release.yml` — npm exchanges the GitHub OIDC token (`id-token: write` already at job level) for a short-lived publish credential. `--provenance` continues to attest the build to this workflow run.
  • `release.yml` (`@protolabsai/proto`) is already on Trusted Publishing; this finishes the migration for `@protolabsai/sdk`.

Roadmap: E5 (split — protoCLI half) from protoWorkstacean `docs/roadmap/2026-06.md`.

⚠️ Required UI step before next sdk-v* tag

The next `sdk-v*` tag push will fail at "Publish to npm" unless the trusted publisher is configured on npm first:

  1. https://www.npmjs.com/package/@protolabsai/sdk/accessTrusted PublishersAddGitHub Actions
    • repository: `protoLabsAI/protoCLI`
    • workflow filename: `sdk-release.yml`
    • environment: (none)
  2. Merge this PR.
  3. `NPM_TOKEN` may be removed from repo/org secrets at leisure (verify no other workflow still uses it first).

Test plan

  • UI prerequisite landed before merge
  • Trigger `workflow_dispatch` with `dry_run: true` after merge — confirm publish step succeeds via OIDC
  • Cut next real sdk-v* tag, confirm `npmjs.com/package/@protolabsai/sdk` shows fresh provenance

🤖 Generated with Claude Code

Automaker added 2 commits May 24, 2026 23:47
Sets up the same supply-chain attestation @protolabsai/protopatch +
@protolabsai/release-tools already use. From the next sdk-release
tag onward, npm publish records a sigstore provenance entry tying
the package to this workflow + git ref, surfaced as a "Provenance"
badge on npmjs.com.

Two changes:

  permissions.id-token: write  enables OIDC for the package signer
  npm publish ... --provenance both the real publish + the dry-run
                               (so the dry-run faithfully matches the
                               real run's signature wiring)

NODE_AUTH_TOKEN copied into the dry-run step too — setup-node sets
NPM_CONFIG_USERCONFIG to a temp .npmrc that expects the env var to be
present on every npm invocation; dropping it from the dry-run caused
benign warnings but worked. Tightening for consistency.

No version bump needed — this is workflow-only.
Removes NODE_AUTH_TOKEN from both publish + dry-run steps in
sdk-release.yml — npm exchanges the GitHub OIDC token (id-token: write
at job level) for a short-lived publish credential. Same token still
drives --provenance.

release.yml already runs on Trusted Publishing for @protolabsai/proto;
this finishes the migration for @protolabsai/sdk.

One-time UI prerequisite (before next sdk-v* tag push):
  npmjs.com/package/@protolabsai/sdk/access →
  Trusted Publishers → Add → GitHub Actions
    repository:        protoLabsAI/protoCLI
    workflow filename: sdk-release.yml
    environment:       (none)

After landing, secrets.NPM_TOKEN may be removed at leisure.
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@mabry1985, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 10 reviews of capacity. Refill in 4 minutes and 40 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more review capacity refills, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 36968be8-b2bc-44b1-abe1-a65ed0211a37

📥 Commits

Reviewing files that changed from the base of the PR and between 34761cb and 4013a81.

📒 Files selected for processing (1)
  • .github/workflows/sdk-release.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/sdk-trusted-publishing-2026-05-25

Comment @coderabbitai help to get the list of available commands and usage tips.

@mabry1985 mabry1985 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

QA Audit — PR #283 | feat(ci): SDK publish via Trusted Publishing (OIDC)

VERDICT: PASS


CI Status

  • No CI checks yet (brand new PR) — not a blocker for workflow-only changes

Diff Review

  • .github/workflows/sdk-release.yml: Drops NODE_AUTH_TOKEN from both publish + dry-run steps; adds job-level id-token: write permission; adds --provenance flag. Clean, well-commented — aligns with the existing pattern in release.yml.

Observations

  • LOW / process: The npm UI trusted-publisher configuration (documented in the PR body + inline comment) is a required pre-condition before the next sdk-v* tag. Merge should be coordinated with that setup.
  • LOW / clawpatch: Tool returned HTTP 500 on this repo — skipped structural analysis. Diff is straightforward enough that this gap is immaterial.

Checks: 2
Passed: 2 (diff correctness, permissions)
Failed: 0
Gaps: 0

— Quinn, QA Engineer

@mabry1985

Copy link
Copy Markdown
Member Author

Submitted COMMENT review on #283.

@mabry1985

Copy link
Copy Markdown
Member Author

Findings from the parallel CLI OIDC attempt (release.yml) — read before relying on this

We just spent a long session trying the identical OIDC trusted-publishing conversion on release.yml (@protolabsai/proto). Net result: OIDC never engagednpm publish went straight to ENEEDAUTH with zero OIDC negotiation, from both a feature branch and main. Same wall as #255. Flagging so this PR doesn't ship believing it's fixed.

What we proved is NOT the problem (workflow side is correct)

A diagnostic step on the CLI run confirmed, at publish time:

ACTIONS_ID_TOKEN_REQUEST_URL set?   yes      ← id-token: write is effective
ACTIONS_ID_TOKEN_REQUEST_TOKEN set? yes
NODE_AUTH_TOKEN set?                NO
npm version:                        11.15.0  ← OIDC-capable (>= 11.5.1)
npm config registry:                https://registry.npmjs.org

Trusted publisher was configured correctly on the npm side (GitHub Actions / protolabsai / protocli / release.yml / publish action allowed / no environment). Despite all of that, npm did not attempt the exchange.

Gotcha this PR still has

This diff keeps actions/setup-node's registry-url:. That writes a temp .npmrc with //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} + always-auth=true and surfaces a placeholder NODE_AUTH_TOKEN=XXXXX-XXXXX-…. In our first CLI attempt (kept registry-url, same as here) that placeholder was used and the publish failed E404 (not OIDC). Removing registry-url got us past the placeholder — but then OIDC still didn't engage (ENEEDAUTH). So neither shape worked. If you keep registry-url here, expect the E404 placeholder path.

The actual blocker (npm account/org side)

The smoking gun: every CI credential failed for the CLI — token-with-disallow-tokens (E404), OIDC (ENEEDAUTH), and token-after-setting-flip (E404) — but an interactive npm publish with OTP succeeds every time (that's how 0.40–0.45 shipped). An interactive session carries full org membership + 2FA; CI credentials don't. That points at an org/package publishing policy that rejects non-interactive credentials, not at workflow YAML.

Two npm-side things still unverified that would each explain it:

  1. Package "Publishing access" change actually saved ("Update Package Settings" clicked + persisted — it silently reverts otherwise; this is gotcha feat(telemetry): comprehensive Langfuse tracing across all providers #1 in sdk-release: npm publish fails through both OIDC and static-token paths #255).
  2. The granular token / trusted publisher actually authorizes — for OIDC specifically, the registry-side exchange returns no negotiation at all, which suggests the trusted-publisher match or org policy is silently rejecting.

Recommendation

Before merging #283, dry-run it (the workflow has a dry_run input) and confirm the OIDC exchange actually happens — don't assume --provenance + id-token is sufficient; we proved it isn't, by itself. If it ENEEDAUTHs, this is an npm-support / org-admin issue (same as #255), and the reliable path remains interactive publish until npm engagement is sorted.

Happy to share the full run logs (CLI runs 26386349271 with the OIDC env diagnostic, 26387203428 from main). cc #255.

@mabry1985

Copy link
Copy Markdown
Member Author

Superseded by #290. We proved OIDC's workflow side was fully correct for the CLI but npm never engaged the exchange (ENEEDAUTH, no negotiation) — same wall as #255. Rather than carry the same non-functional OIDC shape here, #290 standardizes both CLI + SDK on token auth, which has verifiable/fixable blockers (package 'Publishing access' must allow bypass-2fa tokens + NPM_TOKEN scoped to @protoLabsAI org). See #290 for the npm-side runbook.

@mabry1985 mabry1985 closed this May 25, 2026
@mabry1985
mabry1985 deleted the feat/sdk-trusted-publishing-2026-05-25 branch May 25, 2026 07:44
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.

1 participant