Skip to content

Conversation

@Raubzeug
Copy link
Contributor

@Raubzeug Raubzeug commented Dec 3, 2025

Greptile Overview

Greptile Summary

This PR attempts to migrate the npm publication workflow from secrets-based authentication to OIDC-based "Trusted Publishing". The changes add the required permissions (id-token: write, contents: write, packages: write) for OIDC token generation.

  • Added permissions block with necessary OIDC and GitHub token permissions
  • Replaced secrets.NODE_AUTH_TOKEN with empty string values

Critical Issue: Setting NODE_AUTH_TOKEN: '' and NPM_TOKEN: '' to empty strings will likely break npm authentication. For OIDC trusted publishing to work, these environment variables should be removed entirely, allowing setup-node action to handle OIDC token generation automatically.

Confidence Score: 1/5

  • This PR may break npm publishing due to incorrect OIDC token handling configuration
  • Low confidence because setting NODE_AUTH_TOKEN to empty string will likely prevent successful npm publishing. The OIDC trusted publishing setup requires these env vars to be absent, not empty.
  • .github/workflows/publication.yml - the NODE_AUTH_TOKEN configuration needs to be corrected

Important Files Changed

File Analysis

Filename Score Overview
.github/workflows/publication.yml 1/5 Updated workflow to use OIDC-based trusted publishing for npm, but setting NODE_AUTH_TOKEN to empty string may break authentication since OIDC still needs token handling by setup-node.

Sequence Diagram

sequenceDiagram
    participant GH as GitHub Actions
    participant SN as setup-node Action
    participant NPM as npm Registry
    participant OIDC as GitHub OIDC Provider

    GH->>SN: Configure node with registry-url
    Note over GH: id-token: write permission granted
    GH->>NPM: npm publish
    Note over NPM: NODE_AUTH_TOKEN='' (empty)
    NPM-->>GH: ❌ Authentication Failed
    Note right of NPM: Empty token prevents<br/>both secret-based and<br/>OIDC authentication
Loading

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
378 373 0 3 2
Test Changes Summary ⏭️2

⏭️ Skipped Tests (2)

  1. Scroll to row, get shareable link, navigate to URL and verify row is scrolled into view (tenant/diagnostics/tabs/queries.test.ts)
  2. Copy result button copies to clipboard (tenant/queryEditor/queryEditor.test.ts)

Bundle Size: ✅

Current: 62.33 MB | Main: 62.33 MB
Diff: 0.00 KB (0.00%)

✅ Bundle size unchanged.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • 📊 indicates links to detailed reports.
  • 🔺 indicates increase, 🔽 decrease, and ✅ no change in bundle size.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the publication workflow to use npm's OIDC trusted publisher authentication instead of token-based authentication. This change improves security by eliminating the need to store long-lived npm tokens as secrets and enables automated provenance generation for published packages.

Key changes:

  • Added workflow-level permissions for id-token, contents, and packages to enable OIDC authentication
  • Replaced the NODE_AUTH_TOKEN secret with empty string values for both NODE_AUTH_TOKEN and NPM_TOKEN

Comment on lines 25 to +27
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
NODE_AUTH_TOKEN: ''
NPM_TOKEN: ''
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

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

When using npm's trusted publisher (OIDC), empty strings should not be set for authentication tokens. These environment variables should either be omitted entirely or removed from the workflow. Setting them to empty strings serves no purpose and may cause confusion.

Remove these lines:

env:
  NODE_AUTH_TOKEN: ''
  NPM_TOKEN: ''

Copilot uses AI. Check for mistakes.
node-version: 22
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm publish
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

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

When using npm's trusted publisher with OIDC authentication, the npm publish command should include the --provenance flag to generate build provenance attestations. This is a key security benefit of trusted publishers.

Add the provenance flag:

- run: npm publish --provenance

This ensures that the published package includes provenance information that verifies the package was built by this specific GitHub Actions workflow.

Suggested change
- run: npm publish
- run: npm publish --provenance

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +11
packages: write

Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

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

The packages: write permission is not needed for publishing to npm. This permission is for GitHub Packages (ghcr.io), not npm registry. For npm publishing with trusted publisher, only id-token: write and contents: write (for release upload) are necessary.

Consider removing the unnecessary permission:

permissions:
  contents: write
  id-token: write
Suggested change
packages: write

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +26 to +27
NODE_AUTH_TOKEN: ''
NPM_TOKEN: ''
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Setting NODE_AUTH_TOKEN and NPM_TOKEN to empty strings will break npm authentication. For OIDC-based trusted publishing, these environment variables should be removed entirely rather than set to empty strings. The setup-node action with id-token: write permission will handle OIDC token generation automatically, but only if NODE_AUTH_TOKEN isn't explicitly overridden.

Remove these lines and let setup-node handle authentication:

Suggested change
NODE_AUTH_TOKEN: ''
NPM_TOKEN: ''
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/publication.yml
Line: 26:27

Comment:
**logic:** Setting `NODE_AUTH_TOKEN` and `NPM_TOKEN` to empty strings will break npm authentication. For OIDC-based trusted publishing, these environment variables should be **removed entirely** rather than set to empty strings. The `setup-node` action with `id-token: write` permission will handle OIDC token generation automatically, but only if `NODE_AUTH_TOKEN` isn't explicitly overridden.

Remove these lines and let `setup-node` handle authentication:

```suggestion
```

How can I resolve this? If you propose a fix, please make it concise.

@Raubzeug Raubzeug added this pull request to the merge queue Dec 3, 2025
Merged via the queue into main with commit d1a6ade Dec 3, 2025
13 checks passed
@Raubzeug Raubzeug deleted the release branch December 3, 2025 07:09
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.

3 participants