auth login --scope 单独补授权会覆盖已有用户授权,与 lark-shared 文档「scope 会累积」不符

Đang mở
#2,877 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
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, shell
Lĩnh vực
cli, documentation

Hướng nghiên cứu

The behaviour is in the auth login --scope path of the CLI, so start from the login command and how it merges the requested scopes with the token already stored. The documented expectation is in skills/lark-shared/references/lark-shared-identity-and-permissions.md around line 65. Reproducing needs a Lark account with a broad grant, so the first useful step is to check whether the stored scope set is replaced rather than merged. Done means either login keeps existing scopes or the doc's 'accumulates' wording is corrected.

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

Mô tả

domain/auth domain/core domain/doc enhancement

环境

  • lark-cli 1.0.84(macOS)
  • Lark 国际版,企业自建应用,用户身份已用 --domain all 授权过(约 200 个 scope)

复现

  1. lark-cli auth status --json --verify:用户身份正常,im:chat.members:read 等 scope 都在,+chat-members-list --as user 可用。
  2. 某命令报缺 contact:user.employee_id:readonly,按 lark-shared 速查表「指定单个 scope 授权」执行:
    lark-cli auth login --scope "contact:user.employee_id:readonly" --no-wait --json,浏览器同意后 lark-cli auth login --device-code <code> --json。
  3. 返回 "granted": ["contact:user.employee_id:readonly", "auth:user.id:read", "offline_access"],"already_granted": []。
  4. 再看 auth status:scope 只剩这 3 个;+chat-members-list --as user 改报 missing required scope(s): im:chat.members:read。

期望

skills/lark-shared/references/lark-shared-identity-and-permissions.md 第 65 行写的是:

多次 login 的 scope 会累积(增量授权)。

期望第 2 步之后原有 scope 保留、新增 1 个。实际是整套被替换。

规避

同一次 login 里带上原范围:lark-cli auth login --domain all --scope "<缺的 scope>",授权后恢复为全部 scope(实测 201 个)。

建议

  • 若「累积」是预期行为:修 CLI,login 时与已有 token 的 scope 合并;
  • 若「替换」是预期行为:改文档,删掉「会累积」,并把速查表和「权限不足处理」里推荐的单独 --scope 写法改成带上原范围,提醒用 auth status 核对。

1.0.85~1.0.98 的发布说明里没看到相关修复;升级到 1.0.98 后,lark-cli skills read lark-shared/references/lark-shared-identity-and-permissions.md 第 65 行仍是「会累积」。覆盖行为本身只在 1.0.84 上观察到,没在 1.0.98 上重复。

Ngôn ngữ chính
Go
Star
18.2k
Fork
1.4k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
18

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

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

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 larksuite/cli

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

Issue tương tự

Thêm issue về Go

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.