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
tom--bo
August 27, 2024
95
1
Share
SQL SECURITY特性の扱いと作ったパッチ
tom--bo
August 27, 2024
More Decks by tom--bo
See All by tom--bo
DDLが取得するMDLの調査(私的)まとめ
tombo
3
160
安全なDDLの実行を目指して 〜(その1)取得するMDLの把握〜
tombo
0
170
MyRaft論文紹介
tombo
3
960
2PC between Binlog and InnoDB
tombo
1
350
WIP: 2PC between binlog and InnoDB
tombo
1
250
Dive into InnoDB from redo logs
tombo
3
1.8k
MySQLアンカンファレンス01_mysqlredo
tombo
1
1.1k
MySQLアンカンファレンス 開催概要
tombo
0
320
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
800
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
120
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
100
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
530
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.8k
The Invisible Side of Design
smashingmag
303
52k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
260
Statistics for Hackers
jakevdp
799
230k
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