-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firestoreのセキュリティルール追加 #3
Conversation
めっちゃ良い感じです! |
firestore.rules
Outdated
&& isUserInRoom(roomId) | ||
|
||
match /messages/{messageId} { | ||
allow read, create: if isAuthenticated() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readはisSentFromCorrectIdいらないと思います!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readとcreateで分けようと思います!
} | ||
|
||
match /accounts/{account} { | ||
allow read, write: if isAuthenticated() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
すいません、/accounts/{account}にはやっぱ何も生やさない事にしたので、read writeどちらもできないようにいただけたらと。。。(´;ω;`)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
すいません、何も生やさないっていうのはどういう意味でしょうか・・?
その中のunreadMessages(unreadMessageSegmentsに変わった?)も何もallowしないほうがいいですか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/accounts/{account}はunreadMessagesのサブコレクションを持つだけのドキュメントになるってことです!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なるほど!!わかりましたありがとうございます!
createdAtを守るっていうのはこのやり方で大丈夫ですか? |
そういうことです! |
firestoreのruleを実際の構造に合わせて修正
概要
firestoreのセキュリティルールを追加しました。
補足
最新のcommon-messengerの
src/firebase/collectionSchema.ts
のfirestoreの設計に合わせて実装してあるので、今のfirestoreには使えないです。一旦↓のコメントの部分を実装しました。
https://www.pivotaltracker.com/story/show/167423193/comments/204945961
残りは別ストーリで実装予定です。
https://www.pivotaltracker.com/story/show/167483102
このPRに関連するissue
Pivotal TrackerのURL
https://www.pivotaltracker.com/story/show/167423193