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
290
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.6k
Other Decks in Technology
See All in Technology
全部AI、全員Cursor、ドキュメント駆動開発 〜DevinやGeminiも添えて〜
rinchsan
2
500
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
3
980
関数型プログラミングで 「脳がバグる」を乗り越える
manabeai
2
220
Contributing to Rails? Start with the Gems You Already Use
yahonda
2
120
Four Keysから始める信頼性の改善 - SRE NEXT 2025
ozakikota
0
140
AWS CDKの仕組み / how-aws-cdk-works
gotok365
10
750
Delegating the chores of authenticating users to Keycloak
ahus1
0
170
How Do I Contact HP Printer Support? [Full 2025 Guide for U.S. Businesses]
harrry1211
0
130
ゼロからはじめる採用広報
yutadayo
3
1k
Reach American Airlines®️ Instantly: 19 Calling Methods for Fast Support in the USA
flyamerican
1
180
オーティファイ会社紹介資料 / Autify Company Deck
autifyhq
10
130k
VGGT: Visual Geometry Grounded Transformer
peisuke
1
560
Featured
See All Featured
Navigating Team Friction
lara
187
15k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Code Review Best Practice
trishagee
69
19k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
510
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Raft: Consensus for Rubyists
vanstee
140
7k
Optimizing for Happiness
mojombo
379
70k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
Thoughts on Productivity
jonyablonski
69
4.7k
BBQ
matthewcrist
89
9.7k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.4k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
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 དྷ݄̎ճ։࠵ʂੋඇ༡ͼʹདྷ͍ͯͩ͘͞ʂ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂʂ