fix(cli): confine auth email content_path to project root (CLI-2320) - #6489
Merged
Coly010 merged 2 commits intoSep 7, 2026
Conversation
…oot (CLI-2320) content_path resolution for auth.email.template.*/auth.email.notification.* previously allowed relative .. traversal and absolute paths outside the project root, so a config push could read and upload an arbitrary local file. Resolution now rejects anything outside the discovered project root before the file is read.
Contributor
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@4ecb369efc53e08a29515727cde2a1eb55778fc9Preview package for commit |
Contributor
There was a problem hiding this comment.
🤖 AI Review
Six deduplicated findings were adjudicated from 6 Claude and 2 Codex findings. Four are confirmed, including the jointly identified symlink escape and false rejection of valid in-root paths. Two documentation findings are refuted because metadata-only stat calls do not read file contents and the documented notification fallback selects an in-root final path.
Findings
| Severity | Location | Category | Sources | Claim |
|---|---|---|---|---|
| 🔴 CRITICAL | apps/cli/src/commands/config/push/push.auth-email-content.ts:69 |
security |
claude+codex | The containment check can be bypassed with an in-project symlink, allowing an outside file to be read and uploaded. |
| 🟡 MINOR | apps/cli/src/commands/config/push/push.auth-email-content.ts:38 |
correctness |
claude+codex | The containment predicate rejects valid in-root paths whose first component merely begins with two dots. |
| 🟡 MINOR | apps/cli/src/commands/config/push/push.auth-email-content.ts:63 |
consistency |
claude | Containment is implemented only in config push, while validation and supabase start still accept and consume out-of-root content_path values. |
| ⚪ NIT | apps/cli/src/commands/config/push/push.auth-email-content.ts:72 |
error-handling |
claude | The containment error omits the rejected resolved path, making the failure harder to diagnose. |
Refuted findings (kept for transparency, not posted as review comments)
apps/cli/src/commands/config/push/push.auth-email-content.ts:63(documentation): The statement that an out-of-root notification path is never read is inaccurate because the legacy resolver stats it before containment is checked.
Refuted: statSync reads filesystem metadata, not the file's contents. The documentation says containment occurs before the file is read, and readFileSync is indeed reachable only after the containment check succeeds.apps/cli/src/commands/config/push/SIDE_EFFECTS.md:354(documentation): The documentation incorrectly promises that every notification path initially resolving outside the root aborts, because the legacy fallback can redirect it to an in-root file.
Refuted: The documentation already states that notifications use the legacy fallback. In the cited../secrets.htmlcase, the fallback's final selected path is inside the project root, so it satisfies the documented final-path containment rule rather than contradicting it.
Stats
Claude findings: 6 · Codex findings: 2 · Confirmed: 4 · Refuted: 2 · Uncertain: 0
Models: claude-opus-5 + gpt-5.6-sol · Trigger: auto · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
The containment check normalized paths with path.resolve, which is purely lexical and never follows symlinks, so an in-root symlink pointing outside the project root could still bypass it and get its target's bytes read and uploaded. Both the project root and the candidate path are now resolved with realpathSync before the containment comparison (falling back to lexical resolution only when the target doesn't exist yet, since there's no symlink to dereference in that case). Also fixes a boundary bug in the containment predicate: it rejected any relative result starting with "..", which wrongly rejected a legitimate in-root path like "..templates/invite.html"; it now only rejects a genuine ".." traversal, matching the existing pattern in shared/functions/deploy.ts's isContainedPath. The abort message now includes the rejected resolved path for diagnosability.
jgoux
approved these changes
Sep 7, 2026
Coly010
deleted the
columferry/cli-2320-config-push-contain-auth-email-content_path-resolution-to
branch
September 7, 2026 11:04
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.
Summary
config pushresolvesauth.email.template.*.content_pathandauth.email.notification.*.content_pathfrom disk before uploading theirbytes as part of the auth config write. Resolution previously joined a
relative path onto the project root (or passed an absolute path through
unchanged) with no containment check, so a crafted
content_pathcouldresolve outside the project.
content_pathis now confined to the projectroot: any resolved path — a relative
..escape or an absolute pathelsewhere on disk — aborts before the file is read, using the existing
Invalid config for auth.email.<kind>.<name>.content_path: <reason>errorshape.
Linear: CLI-2320 (surfaced by CLI-2313's security review; intentionally kept
out of that PR).
What changed
push.auth-email-content.ts— newresolveContainedContentPathnormalizesthe candidate path with
path.resolveand rejects anything outside thediscovered project root before
readTemplateContentruns;legacyLoadAuthEmailContent's template and notification loops both routethrough it. The existing notification legacy-fallback behavior
(
supabase/-relative lookup) is preserved as long as the resolved resultstays inside the root.
push.auth-email-content.unit.test.ts— new coverage: absolute path outsideroot (template + notification), relative
..escape (template +notification), and a boundary case for a path resolving to exactly the
project root.
SIDE_EFFECTS.md— documents the containment rule in Files Read, Notes, andthe exit-code table.