Skip to content

Conversation

@jog1t
Copy link
Contributor

@jog1t jog1t commented Nov 12, 2025

No description provided.

@vercel
Copy link

vercel bot commented Nov 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
rivet-inspector Ready Ready Preview Comment Nov 12, 2025 5:08pm
rivetkit-serverless Ready Ready Preview Comment Nov 12, 2025 5:08pm
2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
rivet-cloud Ignored Ignored Nov 12, 2025 5:08pm
rivet-site Ignored Ignored Nov 12, 2025 5:08pm

Copy link
Contributor Author

jog1t commented Nov 12, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 12, 2025

More templates

@rivetkit/actor

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/actor@3451

@rivetkit/cloudflare-workers

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/cloudflare-workers@3451

@rivetkit/core

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/core@3451

@rivetkit/db

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/db@3451

@rivetkit/framework-base

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/framework-base@3451

@rivetkit/next-js

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/next-js@3451

@rivetkit/react

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/react@3451

rivetkit

pnpm add https://pkg.pr.new/rivet-dev/rivet/rivetkit@3451

@rivetkit/sql-loader

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sql-loader@3451

@rivetkit/engine-runner

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner@3451

@rivetkit/engine-runner-protocol

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner-protocol@3451

commit: 8cccc54

@claude
Copy link

claude bot commented Nov 12, 2025

Code Review: Fix publishable token usage for Next.js integrations

Summary

This PR correctly switches from using engineAdminTokenQueryOptions() to usePublishableToken() when integrating Next.js with Vercel and Railway. This is an important security improvement that ensures client-side applications receive publishable tokens instead of admin tokens.


Positive Findings

Security Improvement

  • Critical fix: Previously, the code was fetching admin tokens which could expose admin-level credentials in client-side environments. The PR correctly switches to publishable tokens.
  • For cloud deployments, this now calls createPublishableToken API endpoint
  • For engine deployments, it still uses the stored admin token but through a unified interface

Code Quality

  • Good code reuse: Exports and reuses usePublishableToken() helper from connect-vercel-frame.tsx
  • Consistent pattern applied across all three affected files
  • Removes unnecessary loading states in Railway frame since the hook uses useSuspenseQuery
  • Proper use of ts-pattern for type-safe environment branching

Configuration

  • biome.json: Adding generated file ignore pattern is appropriate

Issues and Suggestions

1. Incomplete biome-ignore comment (Minor)

File: frontend/src/app/dialogs/connect-quick-vercel-frame.tsx:1

The ignore comment has a placeholder explanation that should be replaced with the actual reason, similar to connect-vercel-frame.tsx which uses: guarded by build constant

Recommendation: Update the comment to match the more descriptive version.

2. Unused imports (Minor)

File: frontend/src/app/dialogs/connect-quick-vercel-frame.tsx:24-26

The imports useCloudDataProvider and useCloudNamespaceDataProvider appear unused and should be removed.

Recommendation: Remove unused imports to keep the code clean.


Test Coverage

Concern: No tests were added or modified for these changes.

Recommendation: Consider adding tests to verify the correct token type is returned based on APP_TYPE, though given this is primarily a security fix and the lack of existing tests in this directory, manual verification may be sufficient.


Security Considerations

Excellent security improvement! This change ensures:

  1. Client-side code never receives admin-level tokens
  2. Publishable tokens have appropriate scoping for public use
  3. The principle of least privilege is maintained

Verification needed: Please confirm publishable tokens have been tested in both cloud and engine modes with Vercel/Railway deployments.


Performance

No performance concerns. The switch to useSuspenseQuery actually improves UX by preventing loading states.


Overall Assessment

Recommendation: Approve with minor cleanup

This is a valuable security improvement that properly segregates token types. The minor issues are cosmetic and do not block the PR.

Action items before merge (optional but recommended):

  1. Fix the biome-ignore comment explanation
  2. Remove unused imports
  3. Manually test both cloud and engine deployments

Great work on identifying and fixing this security issue!

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