task: PATCH custom_fields returns 1470403 with DPoP user token, works with Bearer

Đang mở
#2,876 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
22/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
Lĩnh vực
api, cli

Hướng nghiên cứu

The bug sits in the DPoP token path of the Go CLI when calling the Lark task v2 PATCH endpoint with update_fields custom_fields. Start from the repro: config set dpop preferred, then task tasks patch with custom_fields. Compare the request against a Bearer run to find where the permission check diverges. Done means a DPoP-bound user token can update a custom field on an existing task and the Bearer path is unchanged.

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

Mô tả

bug domain/auth domain/core domain/task

Summary

With a DPoP-bound user access token, updating a custom field value on an existing task (PATCH /open-apis/task/v2/tasks/:task_guid with update_fields: ["custom_fields"]) always fails with 1470403 ("user lacks permission for the requested resource"). The same request succeeds after re-authorizing with lark-cli config set dpop disabled (Bearer token). Other operations work fine with the DPoP token, including setting custom field values at task creation.

Environment

  • lark-cli 1.0.98 (npm), Windows 11, brand lark
  • DPoP mode preferred, key provider windows-platform-ksp
  • User identity (--as user), the user is the owner of the tasklist and creator/assignee of the task

Steps to reproduce

  1. lark-cli config set dpop preferred, then lark-cli auth login --recommend (token type: DPoP; scopes include task:task:write and task:custom_field:write).
  2. Create a tasklist, then a single-select or text custom field on it (task custom_fields create, resource_type: tasklist).
  3. Create a task in that tasklist.
  4. Update the field value:
lark-cli task tasks patch --as user --params '{"task_guid":"<TASK_GUID>"}' \
  --data '{"task":{"custom_fields":[{"guid":"<FIELD_GUID>","text_value":"x"}]},"update_fields":["custom_fields"]}'

Actual result

"code": 1470403,
"message": "user lacks permission for the requested resource"

Expected result

The value is updated, as it is in the Lark client by the same user, and as it is with a Bearer token.

What we checked (all with the same user and app)

Token Scopes Operation Result
DPoP task, contact, wiki, docs, drive, base, sheets, calendar, vc PATCH custom_fields on existing task 1470403
DPoP --recommend (all) PATCH custom_fields on existing task 1470403
Bearer --recommend (all) PATCH custom_fields on existing task OK
DPoP any of the above PATCH summary on the same task OK
DPoP any of the above PATCH summary + custom_fields together 1470403
DPoP any of the above create task with custom_fields values OK
DPoP any of the above raw lark-cli api PATCH ... 1470403
  • Single-select and text fields behave the same.
  • Adding the user explicitly as editor member, or adding the app as a tasklist member, does not help.
  • The same user can set the value in the Lark client without problems.

So the field permission check on task update seems not to accept DPoP-bound user tokens, while task edit permission and field writes on create do.

Workaround

lark-cli config set dpop disabled and re-authorize (Bearer token).

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.