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
SQL SECURITY特性の扱いと作ったパッチ
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
tom--bo
August 27, 2024
100
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SQL SECURITY特性の扱いと作ったパッチ
tom--bo
August 27, 2024
More Decks by tom--bo
See All by tom--bo
DDLが取得するMDLの調査(私的)まとめ
tombo
3
170
安全なDDLの実行を目指して 〜(その1)取得するMDLの把握〜
tombo
0
180
MyRaft論文紹介
tombo
3
990
2PC between Binlog and InnoDB
tombo
1
360
WIP: 2PC between binlog and InnoDB
tombo
1
270
Dive into InnoDB from redo logs
tombo
3
1.9k
MySQLアンカンファレンス01_mysqlredo
tombo
1
1.1k
MySQLアンカンファレンス 開催概要
tombo
0
330
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Faster Mobile Websites
deanohume
310
31k
Side Projects
sachag
455
43k
A Modern Web Designer's Workflow
chriscoyier
698
190k
How to make the Groovebox
asonas
2
2.2k
Music & Morning Musume
bryan
47
7.2k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
360
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
390
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
HDC tutorial
michielstock
2
710
Transcript
SQL SECURITY特性の扱い と 作ったパッチ MySQLアンカンファレンス 第6回 @tom__bo
SQL SECURITY句とは • VIEW, STORED FUNCTION/PROCEDUREなどを作成するときに 設定できるセキュリティコンテキスト • ex) CREATE
SQL SECURITY INVOKER VIEW V1 AS SELECT * FROM t1; • 設定できる値 • “DEFINER “ : オブジェクトの定義者のアカウント権限で実行 • “INVOKER “ : オブジェクトの呼び出し元のアカウント権限で実行 • デフォルトは”DEFINER”
ありがちなオペレーションミス • ユーザu1でVIEW作成 • 管理者ユーザでu1の削除 (SUPER or SET_USER_ID権限を持つ)
ありがちなオペレーションミス • VIEWを参照するとエラー • (補足: SET_USER_ID権限がないユーザからは消せない(8.0.22以降))
考えられる対策例 1. SET_USER_ID権限を適切に管理する • ユーザ削除にSUPER or SET_USER_ID権限をもつユーザを使わない 2. ユーザの削除前にDEFINERに指定されていないか確認 3.
DEFINERを絶対削除しない固定ユーザにする 4. 常にSQL SECURITY INVOKER で定義する SQL SECURITYのデフォルトを INVOKERにする設定とか作れない? 見てみますー (変数追加と数行の追加でできた)
作ったパッチ • default_sql_security_invoker = ONにするとデフォルトでSQL SECURITY INVOKERでオブジェクトが作成される
DEFAULTをINVOKERにするパッチ(プロトタイプ) • システム変数の定義(set sessionも可能な定義方法)
DEFAULTをINVOKERにするパッチ(プロトタイプ) • 作成時の条件分岐追加
疑問と感想 • 運用上SQL SECURITY 特性をどう管理されてます? • 1変数を追加するほどのことではない? • ちゃんと権限管理してないのが悪い気が... •
trigger, eventにはsql security特性がない DEFINER相当になるので、同じ方法は取れない
None