fix(cli): warn but skip remote lookup for a malformed services project ref#5802
Merged
Coly010 merged 2 commits intoJul 7, 2026
Conversation
…t ref Go's `cmd/services.go` validates the linked ref but only warns on failure and still calls listRemoteImages with the malformed value. TS now warns the same way but deliberately does not proceed with the bad ref, since it gets embedded unescaped into the tenant gateway hostname — keeping the existing SSRF hardening instead of matching Go's warn-and-proceed behavior. Fixes CLI-1872
- Match Go's stderr ordering (ref-format warning before config-load warning) - Close a branch-coverage gap: add integration coverage for the valid-ref + logged-in remote-fetch path that this change restructured - Correct resolveOptional's doc comment, which claimed Go skips validation entirely on its soft-load path when Go actually validates and warns, just doesn't fail the command - Note the untrimmed SUPABASE_PROJECT_ID env var and cross-reference the divergence from the Notes section of SIDE_EFFECTS.md for discoverability Filed CLI-1900 to audit other resolveOptional callers (projects list, db dump/query) for the same missing warning, since each needs its own Go-parity verification rather than a blanket fix.
Contributor
Author
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 441342eebc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Contributor
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@441342eebc86b1e5495e9f9181d6d6fea797bb92Preview package for commit |
avallete
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix (Go-parity divergence).
What is the current behavior?
On a malformed linked project ref, Go's
servicescommand validates the ref (flags.LoadProjectRef) but only warns to stderr on failure and still proceeds to call the remote tenant lookup with the bad ref (cmd/services.go,internal/services/services.go:61-62). The TypeScript port silently skipped the remote lookup on a malformed ref with no warning at all, andservices/SIDE_EFFECTS.mdmis-attributed that silent skip to Go.Fixes CLI-1872.
What is the new behavior?
TS now prints the same warning Go would print (
Invalid project ref format. Must be like \abcdefghijklmnopqrst`., reusing the constant already exported fromlegacy-project-ref.service.ts), matching Go's stderr ordering. Unlike Go, TS deliberately does **not** then proceed with the malformed ref — the ref gets embedded unescaped into the tenant gateway hostname infetchLinkedServiceVersions, so proceeding would let a malformed/tampered ref redirect the service-role key to an attacker-controlled host. This is an intentional, documented TS-only divergence (SSRF hardening), not a parity bug — see the updatedSIDE_EFFECTS.mdand the new "Behavioral divergences" section indocs/go-cli-porting-status.md`.Reviewed via a 4-way parallel pass (architect/engineer/security/DX); security and engineer approved outright, architect approved after closing a branch-coverage gap on the exact code this PR restructured, and DX surfaced that the identical Go idiom (
flags.LoadProjectRef's warn-and-continue) is also unhandled inprojects listand a fewresolveOptionalcallers — filed as CLI-1900 for its own dedicated audit, since each caller needs independent verification against its Go counterpart rather than a blanket fix.