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
260
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
アジャイルでの品質の進化 Agile in Motion vol.1/20241118 Hiroyuki Sato
shift_evolve
0
200
心が動くエンジニアリング ── 私が夢中になる理由
16bitidol
0
130
The Role of Developer Relations in AI Product Success.
giftojabu1
0
160
セキュリティ運用って包括的にできていますか?SaaSを使って次のステップへ / Comprehensive Cyber Security Operations for Cloud Services Using SaaS
sakaitakeshi
0
190
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
7
740
Flutterによる 効率的なAndroid・iOS・Webアプリケーション開発の事例
recruitengineers
PRO
0
170
型チェック 速度改善 奮闘記⌛
tocomi
1
260
Mastering Quickfix
daisuzu
2
370
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
13
1.6k
コンパウンド戦略に向けた技術選定とリアーキテクチャ
kworkdev
PRO
0
1.1k
A Tour of Anti-patterns for Functional Programming
guvalif
0
1.5k
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.2k
Featured
See All Featured
Become a Pro
speakerdeck
PRO
25
5k
Six Lessons from altMBA
skipperchong
27
3.5k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Speed Design
sergeychernyshev
25
620
Being A Developer After 40
akosma
87
590k
Scaling GitHub
holman
458
140k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
380
How STYLIGHT went responsive
nonsquared
95
5.2k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
A designer walks into a library…
pauljervisheath
204
24k
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 དྷ݄̎ճ։࠵ʂੋඇ༡ͼʹདྷ͍ͯͩ͘͞ʂ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂʂ