Skip to content
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

Merged
merged 8 commits into from
Jul 31, 2019

Conversation

ayakayakak
Copy link
Collaborator

概要

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

  • ISSUE_URL

Pivotal TrackerのURL

@ayakayakak ayakayakak self-assigned this Jul 25, 2019
@kahirokunn
Copy link
Owner

めっちゃ良い感じです!
最後にcreatedAtのタイムスタンプだけ守っていただけますでしょうか!

firestore.rules Outdated
&& isUserInRoom(roomId)

match /messages/{messageId} {
allow read, create: if isAuthenticated()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readはisSentFromCorrectIdいらないと思います!

Copy link
Collaborator Author

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()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すいません、/accounts/{account}にはやっぱ何も生やさない事にしたので、read writeどちらもできないようにいただけたらと。。。(´;ω;`)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すいません、何も生やさないっていうのはどういう意味でしょうか・・?
その中のunreadMessages(unreadMessageSegmentsに変わった?)も何もallowしないほうがいいですか?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/accounts/{account}はunreadMessagesのサブコレクションを持つだけのドキュメントになるってことです!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほど!!わかりましたありがとうございます!

@ayakayakak
Copy link
Collaborator Author

createdAtを守るっていうのはこのやり方で大丈夫ですか?
https://firebase.google.com/docs/reference/rules/rules.firestore.Request.html?hl=ja#time

@kahirokunn
Copy link
Owner

そういうことです!

@ayakayakak ayakayakak merged commit 5e277bc into master Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants