Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Scoped tokens: supabase link needs API Key Secrets even though db push only needs the DB password

Đang mở
#7,165 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
authentication, cli

Hướng nghiên cứu

The failing call is GET /v1/projects/<ref>/api-keys, made during supabase link after the project lookup succeeds; start by finding where link requests API keys and whether a 403 there aborts the command. Reproduce with a project-scoped token that lacks API Key Secrets, then run the link command with --debug to confirm the failing request. Done means link completes without the secret keys, or a 403 names the missing permission in missing_permissions as the docs describe.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

🐛 Bug supabase/cli
Affected area

Auth

Supabase CLI version

2.108.0

Operating system

Ubuntu 24.04 (GitHub Actions ubuntu-latest); also reproduced on Windows 11

Installation method

None

Command
SUPABASE_ACCESS_TOKEN=<project-scoped PAT> supabase link --project-ref <ref> --debug
Actual output
Using access token from env var...
Supabase CLI 2.120.0
HTTP GET: https://api.supabase.com/v1/projects/<ref>
HTTP GET: https://api.supabase.com/v1/projects/<ref>/api-keys
Authorization failed for the access token and project ref pair: {"message":"Your account does not have the necessary privileges to access this endpoint. For more details, refer to our documentation https://supabase.com/docs/guides/platform/access-control"}
Expected behavior

supabase link (followed by supabase db push) works with a project-scoped token that has Migrations read-write and project/database read, without needing API Key Secrets. db push uses the database password and never needs the secret service_role key, so link shouldn't fetch secret keys, or should skip them when the token lacks API Key Secrets. If a permission is missing, the 403 should name it in missing_permissions, as the docs say.

Steps to reproduce
  1. Create a scoped personal access token (resource access: one project) with: Migrations read-write; Project Settings, Database, Database Config, Connection Pooling, API Keys read. Created by the organization Owner.
  2. Run: SUPABASE_ACCESS_TOKEN= supabase link --project-ref --debug
  3. It fails on GET /v1/projects//api-keys with "Your account does not have the necessary privileges to access this endpoint".
  4. Add API Key Secrets: read to a new token → link succeeds.
    Workaround: supabase db push --db-url (no link, no token).
Crash report ID

No response

Docker and service versions

Additional context

No response

Ngôn ngữ chính
TypeScript
Star
2.4k
Fork
533
Merge trung bình
22 giờ 20 phút
Pull request đã merge (30 ngày)
370

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của supabase/cli

Tất cả issue của supabase/cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.