Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Death to cookies - JSConf.UY
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
jfromaniello
March 15, 2014
Programming
200
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Death to cookies - JSConf.UY
jfromaniello
March 15, 2014
Transcript
32 slides
Death to Cookies Long Live Tokens @woloski @jfroma
None
None
Client Database auth persistent connection 1990’s Client Server Life was
easy
Workstation Browser Database auth 2000’s Intranet Web Server Active Directory
kerberos token Life inside corp
Workstation Browser Database Internet Web Server auth C C E-commerce
Browser Database Today’s applications Web Server (Scala) API (Ruby) API
(Node) Phones Tablets Realtime (Sockets) API (Facebook) C M A A A AT
+80K Views
None
Cookie-based auth is a sub- optimal solution for today’s systems
Set-Cookie + CORS = doesn’t play well 1
Cookies are coupled to the web framework ! If you
try to reuse a cookie issued by Java in Node, not easy 2
APIs don’t use cookies, native apps either 3
Cookies lead to CSRF attacks <iframe style="display:none" name="hidden"></iframe> <form
name="csrf" action="http://example.org/account/edit" method="post" target="hidden"> <input type="hidden" name="email" value="
[email protected]
" /> <script>document.csrf.submit();</script> 4
http://tools.ietf.org/html/draft-ietf-oauth-json-web-token
How it works?
Not everything is pink color
art: http://abeon-hosting.com/security-blog/xss-attack-in-action-cookie-stealer/ Tokens XSS
Sanitize and encode everything ! Google Caja https://developers.google.com/caja/
Try token-based authentication in your next project
TOOOOOOOOKEEEENS
Thanks! @woloski @jfroma blog.auth0.com jwt.io
Browser Database Today Web Server (Scala) API (Ruby) API (Node)
Phones Tablets Realtime (Sockets) API (Facebook) JWT JWT JWT JWT JWT AT JWT
None
None
None
JWT JSON Web Tokens eyJ0eXAiOiJKV1QiLC JhbGciOiJIUzI1NiJ9 .eyJ1c2VyX2lkIjoiM TIzNDUiLCJlbWFpbCI 6ImZvb0BiYXIuY29tI
iwiZXhwIjoxMzkyMzI zMzQwLCJpYXQiOjEzO TIzMTYxNDB9 .KQma3tquGF_zKbLdX HV4zNJAupdHJdIk6L2 g6R8kcAY ! ! { "typ":"JWT", "alg":"HS256" } { "user_id": "12345", "email" : "
[email protected]
", "exp": 1392323340, "iat": 1392316140 } HMACSHA256( base64UrlEncode(header) + "." + base64UrlEncode(payload), "secret") ! header payload signature encoded decoded
Token expires, deal with refresh
Confidential info, encrypt it
Social auth
Tokens can get big Don’t over engineer Don’t do fine
grained permissions Define scopes
How to deal with protected images? https://github.com/hueniverse/hawk#single-uri-authorization Create signed requests
(single URI authorization)
More Decks by jfromaniello
See All by jfromaniello
Introducción a Node.js
jfromaniello
2
1.3k
Other Decks in Programming
See All in Programming
Scalaの型でマルチテナントの認可を守る
nextbeatdev
0
180
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
330
Distance field of Julia set
kinakomoti321
0
330
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
150
LLM 101: Exploring LLMs, Starting with Tokens.
dalinaum
0
120
眠らない開発チームの作り方
biwakonbu
0
110
Stage 3でも仕様は変わる。アプリケーション開発者のためのTC39プロセスの読み方
bicstone
1
120
自宅サーバはどこまで再現できるのか - Proxmox VE上のVM環境をIaCとバックアップで戻してみた
youto
0
450
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1.1k
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
210
エラーチャンネルのボールを拾い続けて鍛えるエンジニアの地力 / phpcon-niigata2026
meihei3
1
500
LLM 101
dalinaum
0
540
Featured
See All Featured
How to Ace a Technical Interview
jacobian
280
24k
Test your architecture with Archunit
thirion
2
2.5k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.8k
So, you think you're a good person
axbom
PRO
2
2.3k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
630
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.3k
Making Projects Easy
brettharned
120
6.9k
A Tale of Four Properties
chriscoyier
163
24k
Git: the NoSQL Database
bkeepers
PRO
433
67k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
680