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

[Bug] Unable to use custom claims in firestore security rule when querying from C++ SDK

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

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
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp, firebase

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện lỗi 100% với Firebase C++ SDK 13.0.0 trên Mac, nhắm đến desktop hoặc iOS, sử dụng rule Firestore được hiển thị và một truy vấn trên subscriptions. Kiểm tra đường đi của request Auth và Firestore, bao gồm custom claim được lấy thông qua Firebase Functions. Hoàn tất khi xác định được claim có đến security rule đối với các query của C++ SDK hay không, đồng thời ghi lại hoặc khắc phục nguyên nhân của permission error.

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

Mô tả

api: auth new type: question
[REQUIRED] Please fill in the following fields:
  • Pre-built SDK from the website
  • Firebase C++ SDK version: 13.0.0
  • Problematic Firebase Component: Auth and Firestore
  • Other Firebase Components in use: Functions, Storage
  • Platform you are using the C++ SDK on: Mac
  • Platform you are targeting: Desktop and iOS
[REQUIRED] Please describe the issue here:

I get Missing or insufficient permissions when querying firestore collection that has a security rule that looks like:

match /subscriptions/{subscriptionId} {
    allow read: if request.auth != null && request.auth.token.legacy_id == resource.data.user_id; 
} 

I am using the C++ SDK, which doesn't give direct access to the auth custom claims, but I am able to fetch custom claims via a Firebase function, and see the values correctly in the client after those are fetched.

If I write a security rule that depends on those claims, it fails. Does writing a rule that uses request.auth.token.legacy_id work when the request comes from the C++ SDK?

Steps to reproduce:

What's the issue repro rate? 100%

It appears that using a custom claim (say, a numeric secondary ID) and requiring that to match a field on a document doesn't work when the query is run from the C++ SDK.

Ngôn ngữ chính
C++
Star
326
Fork
138
Merge trung bình
2 ngày 16 giờ
Pull request đã merge (30 ngày)
3

Hướng dẫn đóng góp

Mở 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 firebase/firebase-cpp-sdk

Tất cả issue của firebase/firebase-cpp-sdk

Issue tương tự

Thêm issue về C++

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.