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
Everyone Now Understands AuthZ/AuthN and Encryp...
Search
sylph01
November 26, 2024
1
49
Everyone Now Understands AuthZ/AuthN and Encryption Perfectly and I'm Gonna Lose My Job
11/26/2024 @ Kyoto.rb Meetup
https://kyotorb.connpass.com/event/337169/
sylph01
November 26, 2024
Tweet
Share
More Decks by sylph01
See All by sylph01
End-to-End Encryption Saves Lives. You Can Start Saving Lives With Ruby, Too
sylph01
1
71
End-to-End Encryption Saves Lives. You Can Start Saving Lives With Ruby, Too (JP subtitles)
sylph01
2
260
Introduction to C Extensions
sylph01
3
170
"Actual" Security in Microcontroller Ruby!?
sylph01
0
120
Updates on PicoRuby Networking, HPKE (and maybe more)
sylph01
1
280
Adding Security to Microcontroller Ruby
sylph01
3
3.4k
Secure Messaging at IETF 118
sylph01
0
97
Adventures in the Dungeons of OpenSSL
sylph01
0
580
Community & RubyKaigi Showcase @ Ehime.rb Reboot Meetup
sylph01
0
350
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
34
2.2k
We Have a Design System, Now What?
morganepeng
52
7.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.2k
Making Projects Easy
brettharned
116
6.1k
A Tale of Four Properties
chriscoyier
158
23k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.4k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
41
2.2k
Being A Developer After 40
akosma
91
590k
Building Flexible Design Systems
yeseniaperezcruz
329
38k
Site-Speed That Sticks
csswizardry
5
500
Stop Working from a Prison Cell
hatefulcrawdad
268
20k
Transcript
Everyone Now Understands AuthZ/AuthN and Encryption Perfectly and I'm Gonna
Lose My Job sylph01 @ Kyoto.rb Meetup Kaigi on Rails 2024 Recap, 2024/11/26 1
だれ やせいのプログラマ。認証認可とか暗号と かできます けどKaigi on Rails を経てもうみんなで きるよって話をします RubyKaigi 2025
のローカルオーガナイザー をしています 愛媛県松山市に住んでいます 画像はWeb サイトより 2
3
背景 Kaigi on Rails 2021 で "Build and Learn Rails
Authentication" というトークをしました ログイン・ログアウト、クッキーから の自動再ログイン、パスワードリセッ ト、ロックアウト etc. の自作を通して 認証の動作原理を学ぶ、という内容で す 4
Rails API モードのためのシンプルで効 果的なCSRF 対策 (@corocn) 「なんかとりあえずしーえすあーるえふとーくんとかいうのを発行 しておけばいいんでしょ」っていう状態を脱することができる内容 CSRF って何?→「ぼくはまちちゃん!」で検索だ!
( 一般的には) 悪意のあるサイトが被攻撃者の認証済みセッショ ンを利用してリクエストを実行できてしまうこと セッションCookie が自動的に送られてしまうことを利用 5
Rails API モードのためのシンプルで効 果的なCSRF 対策 (@corocn) API モードにおいてCSRF トークンを受け渡しするのは極めてしんど い
なので Web 標準を使って 対策しよう ("Standardization is King") Origin 検証をしよう SameSite 属性を適切に設定しよう 6
OmniAuth から学ぶOAuth 2.0 (@ykpythemind) 要するに3 年前に話さなかった部分の話。 7
Page 9 - https:/ /speakerdeck.com/ykpythemind/omniauthkaraxue-buoauth2-dot-0-kaigi-on-rails-2024?slide=9 8
Page 17 - https:/ /speakerdeck.com/sylph01/build-and-learn-rails-authentication?slide=17 9
なげえよ Page 17 - https:/ /speakerdeck.com/sylph01/build-and-learn-rails-authentication?slide=17 10
Page 56 - https:/ /speakerdeck.com/ykpythemind/omniauthkaraxue-buoauth2-dot-0-kaigi-on-rails-2024?slide=56 11
このネタ入れてきたの最高 Kaigi on Rails 2020 のときにDNS の話で「浸透」の話入れてきた のと同じ香りがしてよい Page 56
- https:/ /speakerdeck.com/ykpythemind/omniauthkaraxue-buoauth2-dot-0-kaigi-on-rails-2024?slide=56 12
大事なデータを守りたい!ActiveRecord Encryption と、より安全かつ検索可能な暗号化手法の実装例の 紹介 (@free_world21) 「あくてぃぶれこーどえんくりぷしょんってのがあるから暗号化は 楽勝!w」という状態を脱することができる内容 「レコードごとに異なる暗号鍵を使う」っていうのがActiveRecord Encryption ではできない、のでattr_encrypted
gem でそれを実現する カラムごとに違う鍵を使う、っていうのはできるように見える 13
大事なデータを守りたい!ActiveRecord Encryption と、より安全かつ検索可能な暗号化手法の実装例の 紹介 (@free_world21) 決定論的暗号化を使うと検索が可能になる 同じ平文に対して必ず同じ暗号文が得られる 当たり前では? → 初期化ベクタがランダマイズされてるとそ
の限りではない なので決定論的暗号化は多少insecure 「検索可能暗号」っていう技術はあるけど一般での実用化はま だ遠そう 14
https:/ /words.filippo.io/the-ecb-penguin/ "The ECB Penguin" 15
大事なデータを守りたい!ActiveRecord Encryption と、より安全かつ検索可能な暗号化手法の実装例の 紹介 (@free_world21) あと暗号化全般に関して、 「鍵管理は人類には早すぎるよね」っていう 結論になりがち。とてもわかる 16
Identifying User Identity (@moro) これは後でluccafort さんが話すので私からは「えがった… (語彙力) 」で とどめておきます 17
まとめ 全人類が認証認可と暗号化を完全理解してしまった 2024 の発表と2021 のスライドを合わせて読むとカバーしてないと ころもカバーできてさらに完全な理解が得られてしまう(宣伝) s01 氏、失職不可避 18