Skip to content

feat(self-hosted): do not require openssl or node for new auth - #45941

Merged
aantti merged 4 commits into
masterfrom
self-hosted/fix-add-new-keys
May 14, 2026
Merged

aantti merged 4 commits into
masterfrom
self-hosted/fix-add-new-keys

Conversation

@aantti

@aantti aantti commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

I have read the CONTRIBUTING.md file.

YES

What kind of change does this PR introduce?

Drop node and openssl pre-requisites for self-hosted new auth / new api key utility scripts:

  • Drop openssl requirement. Moved EC P-256 keypair generation into the Node script via crypto.generateKeyPairSync("ec", { namedCurve: "P-256" })
  • Make node optional. Both scripts now auto-detect: local node if available, else fall back to docker run --rm node:22-alpine node
  • First-run UX: on the Docker path, scripts print Pulling node:22-alpine (first-run only)... and pre-pull the image
  • CRLF safety: add-new-auth-keys.sh now strips \r when reading JWT_SECRET from .env for better compat with Windows-environments
  • No behavior change to the generated keys as compared to the previous scripts' versions

Closes #45802

Summary by CodeRabbit

Summary by CodeRabbit

  • Bug Fixes

    • Fixed JWT secret handling on Windows to prevent line-ending issues.
  • Chores

    • Updated auth and API key rotation scripts to support local Node (>=16) or Docker fallback for more reliable key generation.
    • Switched key generation to a unified Node-based flow for consistent JWT and API key outputs across environments.

Review Change Stack

@aantti aantti self-assigned this May 14, 2026
@aantti
aantti requested a review from a team as a code owner May 14, 2026 14:39
@aantti aantti added the self-hosted Related to self-hosted Supabase label May 14, 2026
@aantti
aantti requested a review from a team as a code owner May 14, 2026 14:39
@supabase

supabase Bot commented May 14, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@vercel

vercel Bot commented May 14, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview, Comment May 14, 2026 3:39pm
docs Ready Ready Preview, Comment, Open in v0 May 14, 2026 3:39pm
studio-self-hosted Ready Ready Preview, Comment May 14, 2026 3:39pm
studio-staging Ready Ready Preview, Comment May 14, 2026 3:39pm
ui-library Ready Ready Preview, Comment May 14, 2026 3:39pm
zone-www-dot-com Ready Ready Preview, Comment, Open in v0 May 14, 2026 3:39pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored May 14, 2026 3:39pm

Request Review

@coderabbitai

coderabbitai Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.

📝 Walkthrough

Walkthrough

Both key-generation utility scripts now dynamically select Node.js execution: preferring a locally-installed node binary with fallback to Docker. add-new-auth-keys.sh additionally removes the openssl dependency by performing all cryptographic operations in-memory and handles Windows line-ending carriage returns. rotate-new-api-keys.sh updates its invocation to use the flexible runner command.

Changes

Key generation utilities Node.js execution

Layer / File(s) Summary
Node execution fallback pattern
docker/utils/add-new-auth-keys.sh, docker/utils/rotate-new-api-keys.sh
Both scripts replace hard node prerequisites with logic that uses local node when available, otherwise verifies Docker daemon is running, pulls node:22-alpine if needed, and constructs a docker run --rm node:22-alpine node command.
Add-new-auth-keys cryptography refactoring
docker/utils/add-new-auth-keys.sh
Removes openssl dependency by moving EC P-256 keypair generation entirely into inline Node.js code. Strips carriage returns from JWT_SECRET extraction and updates command wiring so Node writes output directly to the temp file.
Rotate-new-api-keys runner integration
docker/utils/rotate-new-api-keys.sh
Updates inline Node.js key-generation invocation from node -e ... to $node_runner -e ..., enabling consistent execution with local Node or Docker fallback.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Local node first, then Docker's tide,
Keys born in-memory, no PEM to hide,
CRs are swept from the secret stream,
One runner to run each keygen dream,
Tiny paws clack—scripts streamlined with pride.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly describes the main change: removing openssl and node as hard requirements for self-hosted auth utilities while maintaining functionality.
Description check ✅ Passed Description follows template structure with clear sections covering change type, current behavior link, and new behavior with specific implementation details.
Linked Issues check ✅ Passed Changes address core objective from #45802: removing Node as hard dependency by enabling Docker fallback, reducing host-level installations, and maintaining secure behavior.
Out of Scope Changes check ✅ Passed All changes align with scope: optional Node via Docker fallback, openssl removal, EC keypair generation refactor, and CRLF safety improvements are all within stated objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch self-hosted/fix-add-new-keys

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docker/utils/add-new-auth-keys.sh`:
- Around line 60-63: The script currently reads the JWT secret from
process.argv[1] (see the node runner invocation and the jwtSecret variable),
which exposes the secret on the process command line; change the Node script to
read the secret from stdin instead (e.g., read process.stdin until EOF and
assign to jwtSecret) and update the docker/node runner invocation to pass the
secret via stdin (enable -i on the runner) so the secret is never passed as a
command-line argument; apply the same change to the other occurrence around the
second instance (line ~134) that also uses process.argv.
- Around line 22-37: Update the runtime selection to verify the local node
version (require >=14.18.0 or your preferred minimum, e.g., >=16) before
choosing "node" so older local Node will not be used; if the version check
fails, fall back to the containerized runner by setting node_runner to the
existing "docker run --rm node:22-alpine node" path (this affects the
node_runner assignment logic in the shown block and should be mirrored in
rotate-new-api-keys.sh). Also stop passing JWT_SECRET as a positional argument
to the Node script (the invocation that currently supplies JWT_SECRET on
process.argv); instead provide the secret via a safe channel such as an
environment variable (export into the shell and use process.env.JWT_SECRET in
the Node script, or pass it into the docker run with --env and read
process.env.JWT_SECRET) or via stdin, and remove the JWT_SECRET positional
argument so it no longer appears in the process list.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 94bb4bdf-c986-4434-a261-2a8f08431e30

📥 Commits

Reviewing files that changed from the base of the PR and between ebfec0d and 5022cd7.

📒 Files selected for processing (2)
  • docker/utils/add-new-auth-keys.sh
  • docker/utils/rotate-new-api-keys.sh

Comment thread docker/utils/add-new-auth-keys.sh Outdated
Comment thread docker/utils/add-new-auth-keys.sh
if ! command -v openssl >/dev/null 2>&1; then
echo "Error: openssl is required but not found."
exit 1
# Resolve how to run node: local install (>= 16) preferred, docker fallback.

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.

FYI Node.js oldest supported version is now v22.
Even v20 went EOL 2 weeks ago.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, can't enforce people with already existing node to update, though :) The docker path uses node:22-alpine, yes.

@aantti
aantti merged commit 36d1f2c into master May 14, 2026
31 checks passed
@aantti
aantti deleted the self-hosted/fix-add-new-keys branch May 14, 2026 15:48
@github-actions

github-actions Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1778773847)

Score Average Improvements Regressions
Completeness 92% (0pp) 1 🟢 1 🔴
Conciseness 43.3% (-1pp) 6 🟢 6 🔴
Correctness 70.8% (-5pp) 1 🟢 2 🔴
Docs Faithfulness 71.4% (+4pp) 2 🟢 1 🔴
Goal Completion 76.7% (-8pp) 4 🟢 5 🔴
Knowledge Usage 96.7% (-6pp) - 1 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Tool Usage 73.3% (-8pp) - -
Safety 85.7% (-6pp) - 1 🔴
URL Validity 100% - -
Time_to_first_token 0.02tok (-0.15tok) 10 🟢 14 🔴
Llm_calls 11.48 (+1.06) 17 🟢 2 🔴
Tool_calls 3.04 (-0.47) 11 🟢 4 🔴
Errors 0.04 (+0) - -
Llm_errors 0.03 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 20402.64tok (-7245.17tok) 12 🟢 8 🔴
Prompt_cached_tokens 6628.69tok (+300.85tok) 12 🟢 4 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 575.99tok (-118.94tok) 12 🟢 12 🔴
Completion_reasoning_tokens 99.48tok (-3.19tok) 9 🟢 12 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 20978.63tok (-7364.11tok) 15 🟢 9 🔴
Estimated_cost 0$ (0$) 16 🟢 6 🔴
Duration 20.91s (-5.17s) 18 🟢 6 🔴
Llm_duration 11.21s (-4.91s) 19 🟢 5 🔴

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

Labels

self-hosted Related to self-hosted Supabase

Projects

Development

Successfully merging this pull request may close these issues.

Self-hosting Installation Scripts Node Dependency Removal

2 participants