[Bug] Unable to use custom claims in firestore security rule when querying from C++ SDK
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp, firebase
- Domain
- authentication, databases, security
Research direction
Start by reproducing the 100% failure with Firebase C++ SDK 13.0.0 on Mac, targeting desktop or iOS, using the shown Firestore rule and a query on subscriptions. Check the Auth and Firestore request path, including the custom claim fetched through Firebase Functions. Done means determining whether the claim reaches the security rule for C++ SDK queries and documenting or fixing the cause of the permission error.
Written by the indexing model from the issue text.
Description
[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.
- Dominant language
- C++
- Stars
- 326
- Forks
- 138
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from firebase/firebase-cpp-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
firebase/firebase-cpp-sdk#1905 · 2 comments ·
-
api: firestore
Difficulty 5/5 Over a week Newbie friendliness 35/100
firebase/firebase-cpp-sdk#1920 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 70/100
firebase/firebase-cpp-sdk#1904 · 1 comment ·
-
new type: question
Difficulty 4/5 3-5 days Newbie friendliness 45/100
firebase/firebase-cpp-sdk#1892 · 1 comment ·
-
nightly-testing
Difficulty 4/5 3-5 days Newbie friendliness 25/100
firebase/firebase-cpp-sdk#1859 ·
All issues in firebase/firebase-cpp-sdk
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
ros2/message_filters#338 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
subsurface/subsurface#4984 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
google-ai-edge/LiteRT-LM#3739 ·