Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Firebaseはロックに使おう / Netadashi Meetup#8 Firebase
Search
w2-yamaguchi
January 18, 2019
Technology
1
270
Firebaseはロックに使おう / Netadashi Meetup#8 Firebase
Netadashi Meetup#8 LT資料
2019.01.18 @みなとみらい
w2-yamaguchi
January 18, 2019
Tweet
Share
More Decks by w2-yamaguchi
See All by w2-yamaguchi
AWSを活用して社内ISUCONを開催したはなし
watarukun
5
2.5k
Other Decks in Technology
See All in Technology
pg_bigmをRustで実装する(第50回PostgreSQLアンカンファレンス@オンライン 発表資料)
shinyakato_
0
120
コンテナセキュリティのためのLandlock入門
nullpo_head
2
330
ガバナンスを支える新サービス / New Services to Support Governance
sejima1105
0
210
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
27
24k
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
680
10個のフィルタをAXI4-Streamでつなげてみた
marsee101
0
180
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
20
5.8k
マイクロサービスにおける容易なトランザクション管理に向けて
scalar
0
190
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
200
[JAWS-UG新潟#20] re:Invent2024 -CloudOperationsアップデートについて-
shintaro_fukatsu
0
120
Yahoo! ズバトクにおけるフロントエンド開発
lycorptech_jp
PRO
0
110
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
140
Featured
See All Featured
The Invisible Side of Design
smashingmag
299
50k
Why Our Code Smells
bkeepers
PRO
335
57k
Faster Mobile Websites
deanohume
305
30k
Fireside Chat
paigeccino
34
3.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
A Philosophy of Restraint
colly
203
16k
Bash Introduction
62gerente
609
210k
How STYLIGHT went responsive
nonsquared
96
5.2k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Optimizing for Happiness
mojombo
376
70k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Transcript
FirebaseʮϩοΫʯʹ͓͏ 2019/1/18, Netadashi Meetup#8 w2-yamaguchi
ࣗݾհ • w2-yamaguchi • 2015ೖࣾ • େखอݥձ͚ࣾͷγεςϜ։ൃʹैࣄ • Firebase Japan
User Group ӡӦ 2 ayubuki
ͳ͢͜ͱ! • FirebaseΛ͏্Ͱ͓͍ͬͯͯཉ͍͜͠ͱ • ܒతͳͳ͠ 3 ͳ͞ͳ͍͜ͱ" • ٕज़తͳࡉ͔͍ͳ͠
FirebaseͷαʔϏε͜Μͳʹ͍ͬͺ͍ʂ 4 Crashlytics Performance Monitoring Test Lab Cloud Firestore ML
Kit Cloud Functions Authentication Hosting Cloud Storage Realtime Database In-App Message Google Analytics Prediction A/B Testing Cloud Messaging Remote Config Dynamic Links App Indexing Build better apps Improve app quality Grow your business ※2019/1/15ʹެࣜϓϩμΫτϖʔδʢhttps://firebase.google.comʣΑΓൈਮ
FirebaseͷαʔϏε͜Μͳʹ͍ͬͺ͍ʂ 5 Crashlytics Performance Monitoring Test Lab Cloud Firestore ML
Kit Cloud Functions Authentication Hosting Cloud Storage Realtime Database In-App Message Google Analytics Prediction A/B Testing Cloud Messaging Remote Config Dynamic Links App Indexing Build better apps Improve app quality Grow your business ※2019/1/15ʹެࣜϓϩμΫτϖʔδʢhttps://firebase.google.comʣΑΓൈਮ ࠓ͜͜Λ͠·͢ʂ
Cloud FirestoreΛͬͨ͜ͱ͕͋Δਓ 6
Cloud Firestoreͷಛ • ॊೈੑ • ߴػೳͳΫΤϦॲཧ • ϦΞϧλΠϜɹΞοϓσʔτ • ΦϑϥΠϯαϙʔτ
• ֦ுੑͷ͋Δઃܭ 7 ※ެࣜυΩϡϝϯτʢhttps://firebase.google.com/docs/firestoreʣΑΓൈਮ
Cloud Firestoreͷߏ • Cloud Firestore NoSQLσʔλϕʔε • PCͷϑΝΠϧγεςϜͷΑ͏ͳߏΛ࣋ͭ͜ͱ͕Ͱ͖Δ 8 {
"users": { ”user001": { "name": ”user001", "email": ”
[email protected]
" }, ”user002": { "name": ”user002", "email": "
[email protected]
" } } } collection document data
֤ΫϥΠΞϯτ͔ΒಡΈॻ͖Ͱ͖Δ • WebɺAndroidɺiOSɺUnity͔ΒɺಡΈॻ͖͢Δ͜ͱ͕ Ͱ͖Δ 9 SDK
Cloud FirestoreͷηΩϡϦςΟػߏ • υΩϡϝϯτ୯Ґʹಠࣗͷݴޠ*1ͰΫϥΠΞϯτ͔ΒͷΦϖ Ϩʔγϣϯ*2Λ੍ޚ͢Δ 10 service cloud.firestore { match
/databases/{database}/documents { match /<some_path>/ { allow read, write: if <some_condition>; } } } Basics Details Authorization read get ୯ҰυΩϡϝϯτͷಡΈࠐΈݖݶ list ΫΤϦ͓ΑͼίϨΫγϣϯͷಡΈࠐΈݖݶ write create ଘࡏ͠ͳ͍υΩϡϝϯτͷ࡞ݖݶ update ଘࡏ͢ΔυΩϡϝϯτͷߋ৽ݖݶ delete ଘࡏ͢ΔυΩϡϝϯτͷআݖݶ *1 ಠࣗݴޠʹΑΔϧʔϧͷهड़ *2 ੍ޚͰ͖ΔΦϖϨʔγϣϯ
Cloud Firestoreͷਏ͍ͱ͜Ζ • ηΩϡϦςΟϧʔϧ͕ΊΜͲ͍͘͞ • ΫΤϦ͕ශऑʢࠓ͞ͳ͍ʣ 11
Γ͕ͪͰ͢ΑͶɻɻɻʁ 12
69%ͷਓ͕ςετϞʔυͰ࢝ΊͯΔ ʣݸਓௐ 13 ςετϞʔυ ϩοΫϞʔυ Twitter্ͷΞϯέʔτʹΑΔௐࠪ݁Ռʢճਓɿ55໊ʣ https://twitter.com/ayubuki/status/1085164645441187840
合計1億件以上の個人情報がFirebaseの脆 弱性によって公開状態に ݪจʣ62% of Enterprises Exposed to Sensitive Data Loss
via Firebase Vulnerability - Appthority 14 https://gigazine.net/news/20180625-firebase-vulnerability-data-loss/ https://www.appthority.com/company/press/press-releases/62-of-enterprises-exposed-to-sensitive-data-loss-via-firebase-vulnerability/
合計1億件以上の個人情報がFirebaseの脆 弱性によって公開状態に ݪจʣ62% of Enterprises Exposed to Sensitive Data Loss
via Firebase Vulnerability - Appthority 15 https://gigazine.net/news/20180625-firebase-vulnerability-data-loss/ https://www.appthority.com/company/press/press-releases/62-of-enterprises-exposed-to-sensitive-data-loss-via-firebase-vulnerability/ ʜηΩϡϦςΟձࣾͷ"QQUIPSJUZʹΑΔͱɺ͜ͷ੬ऑੑ Firebaseσʔλϕʔεͷೝূ͕దʹߦΘΕ͍ͯͳ͍ ͱ͖ʹݦࡏԽ͢Δͷɻୈ࢛ظʹݟ͔ͭͬͨɺ ΞϓϦ։ൃऀʹΑΔσʔλ֨ೲͷอޢ͕ෆશͳͱ͖ ʹใ͕࿐ग़ͯ͠͠·͏ʮ)PTQJUBM(PXOʯͱݺΕΔ੬ऑੑ ͷมछͰ͋Δͱߟ͑ΒΕ͍ͯ·͢ɻใΛ࿙Β͍ͯ͠Δʮ੬ऑ ͳΞϓϦʯΛ๊͑Δاۀগͳ͘ͱར༻ऀͷˋʹ্ΔͱΈ ΒΕͯʜʢൈਮʣ
ͭ·Γ͜͏͍͏͜ͱ ʣࢲݟ 16 service cloud.firestore { match /databases/{database}/documents { match
/{document=**} { allow read, write; } } } service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if request.auth.uid != null; } } } ୭ͰಡΈॻ͖Ͱ͖ΔʢʹςετϞʔυͰ։࢝ʣ ೝূࡁΈϢʔβʔಡΈॻ͖Ͱ͖Δ
ͬͯ΄͍͜͠ͱʂ ʬϒϥοΫϦετܕରࡦʭ Φʔϓϯঢ়ଶʢςετϞʔυʣ͔ΒͲ͏ߜ͍͔ͬͯ͘ߟ͑Δ ʬϗϫΠτϦετܕରࡦʭ Ϋϩʔζঢ়ଶʢϩοΫϞʔυʣ͔ΒͲ͏؇Ί͍͔ͯ͘ߟ͑Δ 17
Tipsʣ υΩϡϝϯτʹύʔϛογϣϯΛ༩ υΩϡϝϯτʹެ։ใ͔Ͳ͏͔அ͢ΔύʔϛογϣϯΛ ࣋ͨͤΔ 18 service cloud.firestore { match /databases/{database}/documents
{ match /items/{itemID} { allow read: if resource.data.isPublic == true || request.auth.uid == resource.data.uid; allow write: if request.auth.uid == resource.data.uid; } } } items item001 title: pizza isPublic: true item002 title: pasta isPublic: false ެ։ใͷΈ શһ͕ࢀরՄೳ
19 Tipsʣެ։ใͱൿಗใͷ ϧʔτϨϕϧͷίϨΫγϣϯͰެ։ใͱൿಗใΛ͚Δ service cloud.firestore { match /databases/{database}/documents { match
/users/{userID} { allow read: if request.auth.uid != null; allow write: if request.auth.uid == resource.data.uid; } match /_users/{userID} { allow read, write: if request.auth.uid == resource.data.uid; } } } users _users user001 name: Bob twitter: bobbob uid: AEvO…T3hG birth: 1992/06/14 mail: bob@example uid: AEvO…T3hG ϢʔβࣗͷΈ ࢀরɺߋ৽Մೳ user001
20
FirebaseʮϩοΫʯʹ͓͏ʂ 21 Firestore
Firebase Japan User GroupͷΠϕϯτ 2/6 Firebase Meetup #10 @mercari -GDEͷ2ਓ͕TestLabͱFirestoreʹ͍ͭͯޠΓ·͢ʂ
2/18 Firebase Meetup #11 @navitime 22 ࠂ https://firebase-community.connpass.com དྷ݄̎ճ։࠵ʂੋඇ༡ͼʹདྷ͍ͯͩ͘͞ʂ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂʂ