【发布时间】:2021-01-08 09:10:30
【问题描述】:
allow list: if request.query.limit <= 15;
与复合查询一起使用时,此规则会被忽略。
firestore().collection('orders').where('customerId', '==', uid)
.where('orderStatusCode', 'in', [1, 2, 3])
.limit(100)
.get()....
安全规则:
match /orders/{order} {
allow list: if request.query.limit <= 15;
allow read: if request.auth.uid == resource.data.customerId;
allow create: if request.auth != null;
allow update: if request.auth.uid == resource.data.customerId;
allow delete: if false;
}
【问题讨论】:
-
你能发布一个忽略规则的示例查询吗?此外,拥有完整的安全规则可能有助于调试此问题。
-
这里有什么问题?你有
limit <= 15,你的查询是limit(10),所以你应该得到数据。您没有获取数据吗? -
知道了。谢谢你。我现在就写一个答案。
-
@dshukertjr 即使在查询中将限制设置为 100,我也会获取数据。
-
我已经更新了答案
标签: firebase google-cloud-firestore firebase-security