SlideShare ist ein Scribd-Unternehmen logo
1 von 49
Downloaden Sie, um offline zu lesen
© AKAMAI - EDGE 2016
Creating a Secure and Optimal Site
with Service Workers and Other Front-end Techniques
© AKAMAI - EDGE 2016
Source: Cisco VNI, 2015
Scale
Performance
© AKAMAI - EDGE 2016
DDoS
Financial Fraud
Data Harvest
SEO Poisoning
Spamming
Security
Scale
© AKAMAI - EDGE 2016
3rd Party Popularity
Average number of embedded page
objects from Alexa’s Top 100
1st party resources: 48
3rd party resources: 62
© AKAMAI - EDGE 2016
<iframe> & Content-Security-Policy
© AKAMAI - EDGE 2016
What Are Sites Using Now?
From Alexa’s Top 100 domains
65% of sites use <iframe>
2% of sites use Content-Security-Policy header
© AKAMAI - EDGE 2016
Why? ….. 3rd Party Vulnerabilities
• Single-Point-of-Failure
• Compromised content
© AKAMAI - EDGE 2016
Headlines 2015-2016
Vendor Related Breaches:
• Walmart Canada looks into possible credit card data breach
• CVS probes card breach at online photo unit
• Expedia, Travelocity, Hotels.com warn customers of phishing scam
Ad Network Related Breaches:
• Hackers hit Google AdWords and Adsense networks
• DoubleClick ad fraud campaign lures victims with promise of adult videos
• 1 million machines hacked for AdSense revenue in Click Fraud attacks
© AKAMAI - EDGE 2016
<script src="http://3rdparty.com/object.js"></script>
© AKAMAI - EDGE 2016
How can <iframe> or Content-Security-Policy
help?
© AKAMAI - EDGE 2016
<script> vs <iframe>
<script type="text/javascript">
var myIframe=document.createElement("IFRAME");
myIframe.src="about:blank";
myIframe.addEventListener('load',
function (e) {
var myElement=document.createElement("SCRIPT");
myElement.type="text/javascript";
myElement.src=" http://3rdparty.com/object.js";
myIframe.contentDocument.body.appendChild(myElement);
}, false);
document.body.appendChild(myIframe);
</script>
Security: Limited access to site content Performance: No Single-Point-of-Failure
© AKAMAI - EDGE 2016
<script> with Content-Security-Policy
<script src="http://3rdparty.example.com/object.js"></script>
Content-Security-Policy: default-src 'self' ; img-src 'self'
https://*.google.com ; script-src 'self' http://www.google-
analytics.com 'unsafe-inline’ http://*gstatic.com ; style-src 'self'
https://fonts.googleapis.com ; font-src 'self'
https://themes.googleusercontent.com ; frame-src 'self'
http://3rdparty.com
Prevent Single-Point-Of-Failure with unknown 3rd parties
© AKAMAI - EDGE 2016
Performance Comparison: Single-Point-of-Failure
© AKAMAI - EDGE 2016
How Can We Enhance
Security?
© AKAMAI - EDGE 2016
<iframe>: sandbox
Original HTML
<script src="http://3rdparty.com/object.js"></script>
Modified HTML
<iframe src="http://3rdparty.com/object.html" sandbox></iframe>
<iframe src="http://3rdparty.com/object.html" sandbox="allow-
scripts"></iframe>
allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups
allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-
navigation
© AKAMAI - EDGE 2016
Content-Security-Policy: sandbox
Content-Security-Policy:
default-src 'self' ;
img-src 'self' https://*.google.com ;
script-src 'self' http://www.google-analytics.com 'unsafe-
inline’ http://*gstatic.com ;
style-src 'self' https://fonts.googleapis.com ;
font-src 'self' https://themes.googleusercontent.com ;
frame-src 'self' http://3rdparty.com
sandbox ‘allow-scripts’;
allow-forms allow-modals allow-orientation-lock allow-
pointer-lock allow-popups allow-popups-to-escape-sandbox
allow-same-origin allow-scripts allow-top-navigation
© AKAMAI - EDGE 2016
Inline Code Considerations
Original HTML: Sample Analytics Code
<script type="text/javascript">
var _comscore = _comscore || [];
_comscore.push({ c1: "2", c2: "3005660" });
(function () {
var s = document.createElement("script"), el =
document.getElementsByTagName("script")[0]; s.async = true;
s.src = (document.location.protocol ==
"https://sb.scorecardresearch.com/beacon.js";
el.push.parentNode.insertBefore(s, el );
})();
</script>
© AKAMAI - EDGE 2016
<iframe>: srcdoc
Modified HTML: Sample Analytics Code
<iframe srcdoc=
'<script> var _comscore = _comscore || [];
_comscore.push({ c1: "2", c2: "3005660" });
(function () {
var s = document.createElement("script"), el =
document.getElementsByTagName("script")[0]; s.async = true;
s.src = (document.location.protocol == "https:" ? "https://sb" :
"http://b" ) + ".scorecardresearch.com/beacon.js";
el.push.parentNode.insertBefore(s, el );
})();</script>'
sandbox= "allow-scripts"
</iframe>
© AKAMAI - EDGE 2016
User Session Considerations
Result
• Referer:
https://firstparty.com/sabrina.burney.3?ut=3856&pt=1209&name=sabrinaburney
• Information Leakage
Navigate
Login
Load 3rd party resource
© AKAMAI - EDGE 2016
<iframe>: referrerpolicy
Original HTML
<script src="http://3rdparty.com/object.js"></script>
Modified HTML
<iframe src="http://3rdparty.com/object.js" referrerpolicy="no-
referrer"></iframe>
no-referrer no-referrer-when-downgrade origin origin-when-
cross-origin unsafe-url
© AKAMAI - EDGE 2016
Content-Security-Policy: referrer
Content-Security-Policy:
default-src 'self' ;
img-src 'self' https://*.google.com ;
script-src 'self' http://www.google-analytics.com 'unsafe-
inline’ http://*gstatic.com ;
style-src 'self' https://fonts.googleapis.com ;
font-src 'self' https://themes.googleusercontent.com ;
frame-src 'self' http://3rdparty.com ;
referrer origin ;
no-referrer no-referrer-when-downgrade origin origin-when-
cross-origin unsafe-url
© AKAMAI - EDGE 2016
<iframe> & CSP: Secure and Optimal for
3rd Party Content
© AKAMAI - EDGE 2016
How Can Akamai Help?
• Add Content-Security-Policy headers through Property Manager
• Front End Optimization techniques that leverage iframes
© AKAMAI - EDGE 2016
Service Workers
© AKAMAI - EDGE 2016
What is a Service Worker?
Browser Network
Service Worker
• Event Driven Architecture
• Installation Events (install, activate) vs. Functional Events (fetch, push,
sync)
• It’s just JavaScript!
• Shared Worker that sits at the Browser
© AKAMAI - EDGE 2016
Service Worker Gotchas!
HTTPs
Not supported on all browsers
Browser can terminate Service Worker at
any time
No DOM Access
No sync xhr/local storage supported
No Global State
No Credentials/Non CORS fails By Default
Fetch events limited to scope and no fetch
events for iframes, service workers,
requests triggered within service workers
© AKAMAI - EDGE 2016
Service Workers: 3rd Party Content Control
© AKAMAI - EDGE 2016
Client Reputation
• Typically, Client Reputation Strategies are Backend
• Leverage Service Workers to control third party content based on specified
criteria to improve performance and security
Browser Network
Page Service Worker
Intercept Incoming Resource Requests
Block Network Requests based on list/thresholds for metrics
Expand to an Adaptive Reputation Strategy…
© AKAMAI - EDGE 2016
Service Worker Reputation Implementation: Register
Register Event
<head>
<script>
if ('serviceworker' in navigator) {
navigator.serviceWorker.register('./sb-service-worker.js').then(
function(registration) {
console.log('ServiceWorker registration successful:', registration.scope);
}).catch(function(err) {
console.log('ServiceWorker registration failed: ' , err);
});
}
</script>
</head>
© AKAMAI - EDGE 2016
Service Worker Reputation Implementation: Initialize
Install Event
self.addEventListener('install', function(event) {
self.skipWaiting();
});
Activate Event
self.addEventListener('activate', function(event) {
if (self.clients && clients.claim) {
clients.claim();
}
var policyRequest = new Request('thirdparty_urls.txt');
fetch(policyRequest).then(function(response) {
return response.text().then(function(text) {
thirdparty_urls_result=text.toString();
});
});
});
© AKAMAI - EDGE 2016
Service Worker Reputation Implementation: The Fetch
Pseudocode
self.onfetch = function(event) {
event.respondWith(
// Retrieve list of acceptable third party domains from remote txt database
if request URL has domain that matches ones in list
Retrieve current counter value
if (counter > threshold)
-Serve object from cache
-Serve alternate response
else if (counter <= threshold)
-Time resource delivery
-Update counter if object is delayed
-Add object to cache
else request URL not under scope, serve request as is
);
};
© AKAMAI - EDGE 2016
Service Worker Reputation Implementation: Fetch Details (cont)
Fetch Event
self.addEventListener('fetch', function(event) {
if (hostname.test(thirdparty_urls_result)) {
getCounter(…, rspFcn);
var rspFcn = function (event){
//If counter exceeded, retrieve from cache or serve 408
if (counter_flag > 0) {
caches.open('sabrina_cache').then(function(cache) {
var cachedResponse = cache.match(event.request.url).then(function(response) {
if (response) {
console.log("Found response in cache");
return response;
}
else {
console.log("Response not found in cache");
return (new Response('', {status: 408,statusText: 'Request timed out.'}));
}
}).catch(function() {
return (new Response('', {status: 408,statusText: 'Request timed out due to error.'}));
});
event.respondWith(cachedResponse);
});
}
© AKAMAI - EDGE 2016
Service Worker Reputation Implementation: Fetch Details (cont)
else {
Promise.race([timeout(delay), fetch(event.request.url, {mode: 'no-cors'})]).then(function(value){
if (value=="timeout"){
console.log("Timeout threshold reached, update counter");
updateCounter(…); //Use promise to update counter after asset download
}
else {
//If counter not exceeded (normal request), then add to cache
console.log("Timeout threshold not reached, retrieve request without updating counter");
caches.open('sabrina_cache').then(function(cache) {
console.log("Adding to cache");
cache.add(event.request.url);
}).catch(function(error) {
console.error("Error" + error);
throw error;
});
}
});}
};}
else {
//If current asset is not under scope for solution, serve resource as is
event.respondWith(fetch(event.request));
}});
© AKAMAI - EDGE 2016
Real Work Application: Sample Scenario
• Resource in Scope
<script src="https://resources.projectwikiwiki.com/serviceworkers/js/jquery.js"></script>
• Counter Threshold
Allow resource to be slow 3 times in a 5 minute period before taking alternate action
• Timeout Threshold
Update counter if resource takes longer than 5 seconds to download in browser
• Rolling Penalty Window
Configure solution to maintain counter value for a 5 minute period. Continuous resource delays will reset the
penalty window.
• Alternate action for slow response
Serve locally cached version of object -or- serve 408 error response
© AKAMAI - EDGE 2016
On First Load
thirdparty_urls.txt
ajax.googleapis.com
resources.projectwikiwiki.com
convertmyimage.com
static.tumblr.com
hitleap.com
Conditions:
• Service Worker registered
• Service Worker activate event triggered
© AKAMAI - EDGE 2016
On Next Load: Add to Cache
<script
src="https://resources.projectwikiwiki.com
/serviceworkers/js/jquery.js"></script>
Time < 5 seconds
Counter < 3
Conditions:
• Timeout threshold not exceeded
• Counter threshold not exceeded
© AKAMAI - EDGE 2016
On Next Load: Timeout Exceeded
Time > 5 seconds
Counter < 3
Conditions:
• Timeout threshold exceeded
• Counter threshold not exceeded
© AKAMAI - EDGE 2016
On Next Load: Counter Exceeded
Load locally cached version of resource
…Page loads much faster
© AKAMAI - EDGE 2016
On Next Load: Counter Exceeded
…Serve alternate error response defined in Service Worker
Resource not available in cache
© AKAMAI - EDGE 2016
Immediate Results: 5 minute period
• Improved DOMContentLoaded
time
• Improved end user
experience
• Avoid continuous Single-
Point-of-Failure
Counter exceeded
© AKAMAI - EDGE 2016
How Can Akamai Help?
Register Service Worker
• Edge Akamaizer on base page
• Host SW.js on Netstorage
Install/Activate Service Worker
• Host thirdparty_urls.txt on
Netstorage
Datastore Capabilities
• Maintain counter value per
scoped resource
Configuration Capabilities
• Define penalty window time
• Define counter threshold
Service Worker Alternate Action
• Block network requests based on
predefined list of domains
• Serve alternate static content
• Serve content from local browser
cache if available
• Simply monitor third party
performance
© AKAMAI - EDGE 2016
Service Workers: Analytics Monitoring
© AKAMAI - EDGE 2016
Third Party Analytics Monitoring
© AKAMAI - EDGE 2016
What do third party analytics tools have to do with
Service Workers?
© AKAMAI - EDGE 2016
Offline Analytics
© AKAMAI - EDGE 2016
Tracking Metrics with Service Workers
navigator.connect to track metrics both online and offline
self.addEventListener('activate', function(event) {
event.waitUntil(
navigator.services.connect('https://thirdparty.com/services/analytics',
{name: 'analytics'}));
});
self.addEventListener('fetch', function(event) {
navigator.services.match({name: 'analytics'}).then(
port.postMessage('log fetch'));
});
…Where does performance and security come in?
• Less client side JavaScript logic
• After Service Worker is installed, no need for browser to re-parse analytics reporting code
• Reduce risk of script injection (no DOM access)
• Asynchronous metric reporting (non blocking)
• Avoid SPOF
• User Agent can terminate the Service Worker at ANY time
© AKAMAI - EDGE 2016
Why don’t popular analytics tools leverage
Service Workers?
© AKAMAI - EDGE 2016
Other Service Worker Applications
• Input Validation
• Geo Content Control with the Geofencing API
• Load Balancing
• Switching off between multiple server URLs
• Dependency Injector
• Distinguishing production versus staging or production versus a fallback
© AKAMAI - EDGE 2016
A Performance Solution Can Be A Security Solution!
• Bridge the gap
• First Party Attackers & Third Party Attackers
• Explore Service Worker Applications
Questions?
@soniaburney @sabrina_burney

Weitere ähnliche Inhalte

Was ist angesagt?

Edge 2016 can webpagetest be trusted
Edge 2016 can webpagetest be trustedEdge 2016 can webpagetest be trusted
Edge 2016 can webpagetest be trustedakamaidevrel
 
Edge 2016 solving everyday problems with next generation mapping
Edge 2016 solving everyday problems with next generation mappingEdge 2016 solving everyday problems with next generation mapping
Edge 2016 solving everyday problems with next generation mappingakamaidevrel
 
Edge 2014: A Modern Approach to Performance Monitoring
Edge 2014: A Modern Approach to Performance MonitoringEdge 2014: A Modern Approach to Performance Monitoring
Edge 2014: A Modern Approach to Performance MonitoringAkamai Technologies
 
Edge 2014: Million Browser Botnet - Live Demonstration
Edge 2014: Million Browser Botnet - Live DemonstrationEdge 2014: Million Browser Botnet - Live Demonstration
Edge 2014: Million Browser Botnet - Live DemonstrationAkamai Technologies
 
Edge 2014: Bypass Surgery - Akamai's Heartbleed Response Case Study
Edge 2014: Bypass Surgery - Akamai's Heartbleed Response Case StudyEdge 2014: Bypass Surgery - Akamai's Heartbleed Response Case Study
Edge 2014: Bypass Surgery - Akamai's Heartbleed Response Case StudyAkamai Technologies
 
Measuring What Matters - Fluent Conf 2018
Measuring What Matters - Fluent Conf 2018Measuring What Matters - Fluent Conf 2018
Measuring What Matters - Fluent Conf 2018Cliff Crocker
 
Chicago Tech Day Jan 2015: Foundry - HTTP2
Chicago Tech Day Jan 2015: Foundry - HTTP2Chicago Tech Day Jan 2015: Foundry - HTTP2
Chicago Tech Day Jan 2015: Foundry - HTTP2Akamai Technologies
 
ウェブサイト最適化101 - 正しく測ろうあなたのサイト -
ウェブサイト最適化101 - 正しく測ろうあなたのサイト -ウェブサイト最適化101 - 正しく測ろうあなたのサイト -
ウェブサイト最適化101 - 正しく測ろうあなたのサイト -Taisuke Yamada
 
Measuring what matters
Measuring what mattersMeasuring what matters
Measuring what mattersCliff Crocker
 
Velocity spa faster_092116
Velocity spa faster_092116Velocity spa faster_092116
Velocity spa faster_092116Manuel Alvarez
 
A Modern Approach to Performance Monitoring
A Modern Approach to Performance MonitoringA Modern Approach to Performance Monitoring
A Modern Approach to Performance MonitoringCliff Crocker
 
Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)Guy Podjarny
 
Chicago Tech Day Jan 2015: Hidden Features
Chicago Tech Day Jan 2015: Hidden FeaturesChicago Tech Day Jan 2015: Hidden Features
Chicago Tech Day Jan 2015: Hidden FeaturesAkamai Technologies
 
Progressive Web Apps. What, why and how
Progressive Web Apps. What, why and howProgressive Web Apps. What, why and how
Progressive Web Apps. What, why and howRiza Fahmi
 
App-solute Testing: Making App Testing with Akamai Easy
App-solute Testing: Making App Testing with Akamai EasyApp-solute Testing: Making App Testing with Akamai Easy
App-solute Testing: Making App Testing with Akamai EasyAkamai Developers & Admins
 
Edge 2014: Increasing Control with Property Manager with eBay
Edge 2014: Increasing Control with Property Manager with eBayEdge 2014: Increasing Control with Property Manager with eBay
Edge 2014: Increasing Control with Property Manager with eBayAkamai Technologies
 
[DevDay2018] Introduction to Cloud Computing and AWS platform - By: Bach Huy...
[DevDay2018] Introduction to Cloud Computing and AWS platform  - By: Bach Huy...[DevDay2018] Introduction to Cloud Computing and AWS platform  - By: Bach Huy...
[DevDay2018] Introduction to Cloud Computing and AWS platform - By: Bach Huy...DevDay.org
 
Raiders of the Fast Start: Frontend Performance Archaeology - Performance.now...
Raiders of the Fast Start: Frontend Performance Archaeology - Performance.now...Raiders of the Fast Start: Frontend Performance Archaeology - Performance.now...
Raiders of the Fast Start: Frontend Performance Archaeology - Performance.now...Katie Sylor-Miller
 
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018Andy Davies
 

Was ist angesagt? (20)

Edge 2016 can webpagetest be trusted
Edge 2016 can webpagetest be trustedEdge 2016 can webpagetest be trusted
Edge 2016 can webpagetest be trusted
 
Edge 2016 solving everyday problems with next generation mapping
Edge 2016 solving everyday problems with next generation mappingEdge 2016 solving everyday problems with next generation mapping
Edge 2016 solving everyday problems with next generation mapping
 
Edge 2014: A Modern Approach to Performance Monitoring
Edge 2014: A Modern Approach to Performance MonitoringEdge 2014: A Modern Approach to Performance Monitoring
Edge 2014: A Modern Approach to Performance Monitoring
 
Edge 2014: Million Browser Botnet - Live Demonstration
Edge 2014: Million Browser Botnet - Live DemonstrationEdge 2014: Million Browser Botnet - Live Demonstration
Edge 2014: Million Browser Botnet - Live Demonstration
 
Edge 2014: Bypass Surgery - Akamai's Heartbleed Response Case Study
Edge 2014: Bypass Surgery - Akamai's Heartbleed Response Case StudyEdge 2014: Bypass Surgery - Akamai's Heartbleed Response Case Study
Edge 2014: Bypass Surgery - Akamai's Heartbleed Response Case Study
 
Measuring What Matters - Fluent Conf 2018
Measuring What Matters - Fluent Conf 2018Measuring What Matters - Fluent Conf 2018
Measuring What Matters - Fluent Conf 2018
 
Chicago Tech Day Jan 2015: Foundry - HTTP2
Chicago Tech Day Jan 2015: Foundry - HTTP2Chicago Tech Day Jan 2015: Foundry - HTTP2
Chicago Tech Day Jan 2015: Foundry - HTTP2
 
ウェブサイト最適化101 - 正しく測ろうあなたのサイト -
ウェブサイト最適化101 - 正しく測ろうあなたのサイト -ウェブサイト最適化101 - 正しく測ろうあなたのサイト -
ウェブサイト最適化101 - 正しく測ろうあなたのサイト -
 
Measuring what matters
Measuring what mattersMeasuring what matters
Measuring what matters
 
Velocity spa faster_092116
Velocity spa faster_092116Velocity spa faster_092116
Velocity spa faster_092116
 
A Modern Approach to Performance Monitoring
A Modern Approach to Performance MonitoringA Modern Approach to Performance Monitoring
A Modern Approach to Performance Monitoring
 
Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)Third party-performance (Airbnb Nerds, Nov 2013)
Third party-performance (Airbnb Nerds, Nov 2013)
 
Chicago Tech Day Jan 2015: Hidden Features
Chicago Tech Day Jan 2015: Hidden FeaturesChicago Tech Day Jan 2015: Hidden Features
Chicago Tech Day Jan 2015: Hidden Features
 
Hacking Web Performance
Hacking Web Performance Hacking Web Performance
Hacking Web Performance
 
Progressive Web Apps. What, why and how
Progressive Web Apps. What, why and howProgressive Web Apps. What, why and how
Progressive Web Apps. What, why and how
 
App-solute Testing: Making App Testing with Akamai Easy
App-solute Testing: Making App Testing with Akamai EasyApp-solute Testing: Making App Testing with Akamai Easy
App-solute Testing: Making App Testing with Akamai Easy
 
Edge 2014: Increasing Control with Property Manager with eBay
Edge 2014: Increasing Control with Property Manager with eBayEdge 2014: Increasing Control with Property Manager with eBay
Edge 2014: Increasing Control with Property Manager with eBay
 
[DevDay2018] Introduction to Cloud Computing and AWS platform - By: Bach Huy...
[DevDay2018] Introduction to Cloud Computing and AWS platform  - By: Bach Huy...[DevDay2018] Introduction to Cloud Computing and AWS platform  - By: Bach Huy...
[DevDay2018] Introduction to Cloud Computing and AWS platform - By: Bach Huy...
 
Raiders of the Fast Start: Frontend Performance Archaeology - Performance.now...
Raiders of the Fast Start: Frontend Performance Archaeology - Performance.now...Raiders of the Fast Start: Frontend Performance Archaeology - Performance.now...
Raiders of the Fast Start: Frontend Performance Archaeology - Performance.now...
 
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018
 

Ähnlich wie Edge 2016 service workers and other front end techniques

UI5 with Akamai - Introduction to the Content Delivery Network
UI5 with Akamai - Introduction to the Content Delivery NetworkUI5 with Akamai - Introduction to the Content Delivery Network
UI5 with Akamai - Introduction to the Content Delivery NetworkGokul Anand E, PMP®
 
Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Guy Podjarny
 
High Velocity DevOps: Four Ways to Leverage CloudFront in Faster DevOps Workf...
High Velocity DevOps: Four Ways to Leverage CloudFront in Faster DevOps Workf...High Velocity DevOps: Four Ways to Leverage CloudFront in Faster DevOps Workf...
High Velocity DevOps: Four Ways to Leverage CloudFront in Faster DevOps Workf...Amazon Web Services
 
Cloud Delivery: The Path from Simple to Sophisticated
Cloud Delivery: The Path from Simple to SophisticatedCloud Delivery: The Path from Simple to Sophisticated
Cloud Delivery: The Path from Simple to SophisticatedAkamai Developers & Admins
 
Proven Methodologies for Accelerating Your Cloud Journey (ENT308-S) - AWS re:...
Proven Methodologies for Accelerating Your Cloud Journey (ENT308-S) - AWS re:...Proven Methodologies for Accelerating Your Cloud Journey (ENT308-S) - AWS re:...
Proven Methodologies for Accelerating Your Cloud Journey (ENT308-S) - AWS re:...Amazon Web Services
 
How GoDaddy protects ecommerce and domains with AWS KMS and encryption - SDD4...
How GoDaddy protects ecommerce and domains with AWS KMS and encryption - SDD4...How GoDaddy protects ecommerce and domains with AWS KMS and encryption - SDD4...
How GoDaddy protects ecommerce and domains with AWS KMS and encryption - SDD4...Amazon Web Services
 
DEM07 Best Practices for Monitoring Amazon ECS Containers Launched with Fargate
DEM07 Best Practices for Monitoring Amazon ECS Containers Launched with FargateDEM07 Best Practices for Monitoring Amazon ECS Containers Launched with Fargate
DEM07 Best Practices for Monitoring Amazon ECS Containers Launched with FargateAmazon Web Services
 
Taking Serverless to the Edge - SRV330 - Chicago AWS Summit
Taking Serverless to the Edge - SRV330 - Chicago AWS SummitTaking Serverless to the Edge - SRV330 - Chicago AWS Summit
Taking Serverless to the Edge - SRV330 - Chicago AWS SummitAmazon Web Services
 
Configs, Configs, Everywhere! (Actually, Let's Simplify All Those Configs)
Configs, Configs, Everywhere! (Actually, Let's Simplify All Those Configs)Configs, Configs, Everywhere! (Actually, Let's Simplify All Those Configs)
Configs, Configs, Everywhere! (Actually, Let's Simplify All Those Configs)Akamai Developers & Admins
 
Taking Serverless to the Edge - AWS Online Tech Talks
Taking Serverless to the Edge - AWS Online Tech TalksTaking Serverless to the Edge - AWS Online Tech Talks
Taking Serverless to the Edge - AWS Online Tech TalksAmazon Web Services
 
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...Amazon Web Services
 
Third Party Performance
Third Party PerformanceThird Party Performance
Third Party PerformanceGuy Podjarny
 
Infrastructure Security: Your Minimum Security Baseline
Infrastructure Security: Your Minimum Security BaselineInfrastructure Security: Your Minimum Security Baseline
Infrastructure Security: Your Minimum Security BaselineAmazon Web Services
 
Security in Amazon Elasticsearch Service (ANT392) - AWS re:Invent 2018
Security in Amazon Elasticsearch Service (ANT392) - AWS re:Invent 2018Security in Amazon Elasticsearch Service (ANT392) - AWS re:Invent 2018
Security in Amazon Elasticsearch Service (ANT392) - AWS re:Invent 2018Amazon Web Services
 
Amazon GuardDuty Threat Detection and Remediation
Amazon GuardDuty Threat Detection and RemediationAmazon GuardDuty Threat Detection and Remediation
Amazon GuardDuty Threat Detection and RemediationAmazon Web Services
 
AWS Security Week: Infrastructure Security- Your Minimum Security Baseline
AWS Security Week: Infrastructure Security- Your Minimum Security BaselineAWS Security Week: Infrastructure Security- Your Minimum Security Baseline
AWS Security Week: Infrastructure Security- Your Minimum Security BaselineAmazon Web Services
 
Running Serverless at The Edge (CTD302) - AWS re:Invent 2018
Running Serverless at The Edge (CTD302) - AWS re:Invent 2018Running Serverless at The Edge (CTD302) - AWS re:Invent 2018
Running Serverless at The Edge (CTD302) - AWS re:Invent 2018Amazon Web Services
 
Optimizing Lambda@Edge for Performance and Cost Efficiency (CTD405-R2) - AWS ...
Optimizing Lambda@Edge for Performance and Cost Efficiency (CTD405-R2) - AWS ...Optimizing Lambda@Edge for Performance and Cost Efficiency (CTD405-R2) - AWS ...
Optimizing Lambda@Edge for Performance and Cost Efficiency (CTD405-R2) - AWS ...Amazon Web Services
 

Ähnlich wie Edge 2016 service workers and other front end techniques (20)

UI5 with Akamai - Introduction to the Content Delivery Network
UI5 with Akamai - Introduction to the Content Delivery NetworkUI5 with Akamai - Introduction to the Content Delivery Network
UI5 with Akamai - Introduction to the Content Delivery Network
 
Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)
 
High Velocity DevOps: Four Ways to Leverage CloudFront in Faster DevOps Workf...
High Velocity DevOps: Four Ways to Leverage CloudFront in Faster DevOps Workf...High Velocity DevOps: Four Ways to Leverage CloudFront in Faster DevOps Workf...
High Velocity DevOps: Four Ways to Leverage CloudFront in Faster DevOps Workf...
 
Cloud Delivery: The Path from Simple to Sophisticated
Cloud Delivery: The Path from Simple to SophisticatedCloud Delivery: The Path from Simple to Sophisticated
Cloud Delivery: The Path from Simple to Sophisticated
 
Proven Methodologies for Accelerating Your Cloud Journey (ENT308-S) - AWS re:...
Proven Methodologies for Accelerating Your Cloud Journey (ENT308-S) - AWS re:...Proven Methodologies for Accelerating Your Cloud Journey (ENT308-S) - AWS re:...
Proven Methodologies for Accelerating Your Cloud Journey (ENT308-S) - AWS re:...
 
Taking serverless to the edge
Taking serverless to the edgeTaking serverless to the edge
Taking serverless to the edge
 
How GoDaddy protects ecommerce and domains with AWS KMS and encryption - SDD4...
How GoDaddy protects ecommerce and domains with AWS KMS and encryption - SDD4...How GoDaddy protects ecommerce and domains with AWS KMS and encryption - SDD4...
How GoDaddy protects ecommerce and domains with AWS KMS and encryption - SDD4...
 
DEM07 Best Practices for Monitoring Amazon ECS Containers Launched with Fargate
DEM07 Best Practices for Monitoring Amazon ECS Containers Launched with FargateDEM07 Best Practices for Monitoring Amazon ECS Containers Launched with Fargate
DEM07 Best Practices for Monitoring Amazon ECS Containers Launched with Fargate
 
Taking Serverless to the Edge - SRV330 - Chicago AWS Summit
Taking Serverless to the Edge - SRV330 - Chicago AWS SummitTaking Serverless to the Edge - SRV330 - Chicago AWS Summit
Taking Serverless to the Edge - SRV330 - Chicago AWS Summit
 
Taking Serverless to the Edge
Taking Serverless to the Edge Taking Serverless to the Edge
Taking Serverless to the Edge
 
Configs, Configs, Everywhere! (Actually, Let's Simplify All Those Configs)
Configs, Configs, Everywhere! (Actually, Let's Simplify All Those Configs)Configs, Configs, Everywhere! (Actually, Let's Simplify All Those Configs)
Configs, Configs, Everywhere! (Actually, Let's Simplify All Those Configs)
 
Taking Serverless to the Edge - AWS Online Tech Talks
Taking Serverless to the Edge - AWS Online Tech TalksTaking Serverless to the Edge - AWS Online Tech Talks
Taking Serverless to the Edge - AWS Online Tech Talks
 
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...
Build Modern Applications that Align with Twelve-Factor Methods (API303) - AW...
 
Third Party Performance
Third Party PerformanceThird Party Performance
Third Party Performance
 
Infrastructure Security: Your Minimum Security Baseline
Infrastructure Security: Your Minimum Security BaselineInfrastructure Security: Your Minimum Security Baseline
Infrastructure Security: Your Minimum Security Baseline
 
Security in Amazon Elasticsearch Service (ANT392) - AWS re:Invent 2018
Security in Amazon Elasticsearch Service (ANT392) - AWS re:Invent 2018Security in Amazon Elasticsearch Service (ANT392) - AWS re:Invent 2018
Security in Amazon Elasticsearch Service (ANT392) - AWS re:Invent 2018
 
Amazon GuardDuty Threat Detection and Remediation
Amazon GuardDuty Threat Detection and RemediationAmazon GuardDuty Threat Detection and Remediation
Amazon GuardDuty Threat Detection and Remediation
 
AWS Security Week: Infrastructure Security- Your Minimum Security Baseline
AWS Security Week: Infrastructure Security- Your Minimum Security BaselineAWS Security Week: Infrastructure Security- Your Minimum Security Baseline
AWS Security Week: Infrastructure Security- Your Minimum Security Baseline
 
Running Serverless at The Edge (CTD302) - AWS re:Invent 2018
Running Serverless at The Edge (CTD302) - AWS re:Invent 2018Running Serverless at The Edge (CTD302) - AWS re:Invent 2018
Running Serverless at The Edge (CTD302) - AWS re:Invent 2018
 
Optimizing Lambda@Edge for Performance and Cost Efficiency (CTD405-R2) - AWS ...
Optimizing Lambda@Edge for Performance and Cost Efficiency (CTD405-R2) - AWS ...Optimizing Lambda@Edge for Performance and Cost Efficiency (CTD405-R2) - AWS ...
Optimizing Lambda@Edge for Performance and Cost Efficiency (CTD405-R2) - AWS ...
 

Kürzlich hochgeladen

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Kürzlich hochgeladen (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Edge 2016 service workers and other front end techniques

  • 1. © AKAMAI - EDGE 2016 Creating a Secure and Optimal Site with Service Workers and Other Front-end Techniques
  • 2. © AKAMAI - EDGE 2016 Source: Cisco VNI, 2015 Scale Performance
  • 3. © AKAMAI - EDGE 2016 DDoS Financial Fraud Data Harvest SEO Poisoning Spamming Security Scale
  • 4. © AKAMAI - EDGE 2016 3rd Party Popularity Average number of embedded page objects from Alexa’s Top 100 1st party resources: 48 3rd party resources: 62
  • 5. © AKAMAI - EDGE 2016 <iframe> & Content-Security-Policy
  • 6. © AKAMAI - EDGE 2016 What Are Sites Using Now? From Alexa’s Top 100 domains 65% of sites use <iframe> 2% of sites use Content-Security-Policy header
  • 7. © AKAMAI - EDGE 2016 Why? ….. 3rd Party Vulnerabilities • Single-Point-of-Failure • Compromised content
  • 8. © AKAMAI - EDGE 2016 Headlines 2015-2016 Vendor Related Breaches: • Walmart Canada looks into possible credit card data breach • CVS probes card breach at online photo unit • Expedia, Travelocity, Hotels.com warn customers of phishing scam Ad Network Related Breaches: • Hackers hit Google AdWords and Adsense networks • DoubleClick ad fraud campaign lures victims with promise of adult videos • 1 million machines hacked for AdSense revenue in Click Fraud attacks
  • 9. © AKAMAI - EDGE 2016 <script src="http://3rdparty.com/object.js"></script>
  • 10. © AKAMAI - EDGE 2016 How can <iframe> or Content-Security-Policy help?
  • 11. © AKAMAI - EDGE 2016 <script> vs <iframe> <script type="text/javascript"> var myIframe=document.createElement("IFRAME"); myIframe.src="about:blank"; myIframe.addEventListener('load', function (e) { var myElement=document.createElement("SCRIPT"); myElement.type="text/javascript"; myElement.src=" http://3rdparty.com/object.js"; myIframe.contentDocument.body.appendChild(myElement); }, false); document.body.appendChild(myIframe); </script> Security: Limited access to site content Performance: No Single-Point-of-Failure
  • 12. © AKAMAI - EDGE 2016 <script> with Content-Security-Policy <script src="http://3rdparty.example.com/object.js"></script> Content-Security-Policy: default-src 'self' ; img-src 'self' https://*.google.com ; script-src 'self' http://www.google- analytics.com 'unsafe-inline’ http://*gstatic.com ; style-src 'self' https://fonts.googleapis.com ; font-src 'self' https://themes.googleusercontent.com ; frame-src 'self' http://3rdparty.com Prevent Single-Point-Of-Failure with unknown 3rd parties
  • 13. © AKAMAI - EDGE 2016 Performance Comparison: Single-Point-of-Failure
  • 14. © AKAMAI - EDGE 2016 How Can We Enhance Security?
  • 15. © AKAMAI - EDGE 2016 <iframe>: sandbox Original HTML <script src="http://3rdparty.com/object.js"></script> Modified HTML <iframe src="http://3rdparty.com/object.html" sandbox></iframe> <iframe src="http://3rdparty.com/object.html" sandbox="allow- scripts"></iframe> allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top- navigation
  • 16. © AKAMAI - EDGE 2016 Content-Security-Policy: sandbox Content-Security-Policy: default-src 'self' ; img-src 'self' https://*.google.com ; script-src 'self' http://www.google-analytics.com 'unsafe- inline’ http://*gstatic.com ; style-src 'self' https://fonts.googleapis.com ; font-src 'self' https://themes.googleusercontent.com ; frame-src 'self' http://3rdparty.com sandbox ‘allow-scripts’; allow-forms allow-modals allow-orientation-lock allow- pointer-lock allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation
  • 17. © AKAMAI - EDGE 2016 Inline Code Considerations Original HTML: Sample Analytics Code <script type="text/javascript"> var _comscore = _comscore || []; _comscore.push({ c1: "2", c2: "3005660" }); (function () { var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true; s.src = (document.location.protocol == "https://sb.scorecardresearch.com/beacon.js"; el.push.parentNode.insertBefore(s, el ); })(); </script>
  • 18. © AKAMAI - EDGE 2016 <iframe>: srcdoc Modified HTML: Sample Analytics Code <iframe srcdoc= '<script> var _comscore = _comscore || []; _comscore.push({ c1: "2", c2: "3005660" }); (function () { var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true; s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b" ) + ".scorecardresearch.com/beacon.js"; el.push.parentNode.insertBefore(s, el ); })();</script>' sandbox= "allow-scripts" </iframe>
  • 19. © AKAMAI - EDGE 2016 User Session Considerations Result • Referer: https://firstparty.com/sabrina.burney.3?ut=3856&pt=1209&name=sabrinaburney • Information Leakage Navigate Login Load 3rd party resource
  • 20. © AKAMAI - EDGE 2016 <iframe>: referrerpolicy Original HTML <script src="http://3rdparty.com/object.js"></script> Modified HTML <iframe src="http://3rdparty.com/object.js" referrerpolicy="no- referrer"></iframe> no-referrer no-referrer-when-downgrade origin origin-when- cross-origin unsafe-url
  • 21. © AKAMAI - EDGE 2016 Content-Security-Policy: referrer Content-Security-Policy: default-src 'self' ; img-src 'self' https://*.google.com ; script-src 'self' http://www.google-analytics.com 'unsafe- inline’ http://*gstatic.com ; style-src 'self' https://fonts.googleapis.com ; font-src 'self' https://themes.googleusercontent.com ; frame-src 'self' http://3rdparty.com ; referrer origin ; no-referrer no-referrer-when-downgrade origin origin-when- cross-origin unsafe-url
  • 22. © AKAMAI - EDGE 2016 <iframe> & CSP: Secure and Optimal for 3rd Party Content
  • 23. © AKAMAI - EDGE 2016 How Can Akamai Help? • Add Content-Security-Policy headers through Property Manager • Front End Optimization techniques that leverage iframes
  • 24. © AKAMAI - EDGE 2016 Service Workers
  • 25. © AKAMAI - EDGE 2016 What is a Service Worker? Browser Network Service Worker • Event Driven Architecture • Installation Events (install, activate) vs. Functional Events (fetch, push, sync) • It’s just JavaScript! • Shared Worker that sits at the Browser
  • 26. © AKAMAI - EDGE 2016 Service Worker Gotchas! HTTPs Not supported on all browsers Browser can terminate Service Worker at any time No DOM Access No sync xhr/local storage supported No Global State No Credentials/Non CORS fails By Default Fetch events limited to scope and no fetch events for iframes, service workers, requests triggered within service workers
  • 27. © AKAMAI - EDGE 2016 Service Workers: 3rd Party Content Control
  • 28. © AKAMAI - EDGE 2016 Client Reputation • Typically, Client Reputation Strategies are Backend • Leverage Service Workers to control third party content based on specified criteria to improve performance and security Browser Network Page Service Worker Intercept Incoming Resource Requests Block Network Requests based on list/thresholds for metrics Expand to an Adaptive Reputation Strategy…
  • 29. © AKAMAI - EDGE 2016 Service Worker Reputation Implementation: Register Register Event <head> <script> if ('serviceworker' in navigator) { navigator.serviceWorker.register('./sb-service-worker.js').then( function(registration) { console.log('ServiceWorker registration successful:', registration.scope); }).catch(function(err) { console.log('ServiceWorker registration failed: ' , err); }); } </script> </head>
  • 30. © AKAMAI - EDGE 2016 Service Worker Reputation Implementation: Initialize Install Event self.addEventListener('install', function(event) { self.skipWaiting(); }); Activate Event self.addEventListener('activate', function(event) { if (self.clients && clients.claim) { clients.claim(); } var policyRequest = new Request('thirdparty_urls.txt'); fetch(policyRequest).then(function(response) { return response.text().then(function(text) { thirdparty_urls_result=text.toString(); }); }); });
  • 31. © AKAMAI - EDGE 2016 Service Worker Reputation Implementation: The Fetch Pseudocode self.onfetch = function(event) { event.respondWith( // Retrieve list of acceptable third party domains from remote txt database if request URL has domain that matches ones in list Retrieve current counter value if (counter > threshold) -Serve object from cache -Serve alternate response else if (counter <= threshold) -Time resource delivery -Update counter if object is delayed -Add object to cache else request URL not under scope, serve request as is ); };
  • 32. © AKAMAI - EDGE 2016 Service Worker Reputation Implementation: Fetch Details (cont) Fetch Event self.addEventListener('fetch', function(event) { if (hostname.test(thirdparty_urls_result)) { getCounter(…, rspFcn); var rspFcn = function (event){ //If counter exceeded, retrieve from cache or serve 408 if (counter_flag > 0) { caches.open('sabrina_cache').then(function(cache) { var cachedResponse = cache.match(event.request.url).then(function(response) { if (response) { console.log("Found response in cache"); return response; } else { console.log("Response not found in cache"); return (new Response('', {status: 408,statusText: 'Request timed out.'})); } }).catch(function() { return (new Response('', {status: 408,statusText: 'Request timed out due to error.'})); }); event.respondWith(cachedResponse); }); }
  • 33. © AKAMAI - EDGE 2016 Service Worker Reputation Implementation: Fetch Details (cont) else { Promise.race([timeout(delay), fetch(event.request.url, {mode: 'no-cors'})]).then(function(value){ if (value=="timeout"){ console.log("Timeout threshold reached, update counter"); updateCounter(…); //Use promise to update counter after asset download } else { //If counter not exceeded (normal request), then add to cache console.log("Timeout threshold not reached, retrieve request without updating counter"); caches.open('sabrina_cache').then(function(cache) { console.log("Adding to cache"); cache.add(event.request.url); }).catch(function(error) { console.error("Error" + error); throw error; }); } });} };} else { //If current asset is not under scope for solution, serve resource as is event.respondWith(fetch(event.request)); }});
  • 34. © AKAMAI - EDGE 2016 Real Work Application: Sample Scenario • Resource in Scope <script src="https://resources.projectwikiwiki.com/serviceworkers/js/jquery.js"></script> • Counter Threshold Allow resource to be slow 3 times in a 5 minute period before taking alternate action • Timeout Threshold Update counter if resource takes longer than 5 seconds to download in browser • Rolling Penalty Window Configure solution to maintain counter value for a 5 minute period. Continuous resource delays will reset the penalty window. • Alternate action for slow response Serve locally cached version of object -or- serve 408 error response
  • 35. © AKAMAI - EDGE 2016 On First Load thirdparty_urls.txt ajax.googleapis.com resources.projectwikiwiki.com convertmyimage.com static.tumblr.com hitleap.com Conditions: • Service Worker registered • Service Worker activate event triggered
  • 36. © AKAMAI - EDGE 2016 On Next Load: Add to Cache <script src="https://resources.projectwikiwiki.com /serviceworkers/js/jquery.js"></script> Time < 5 seconds Counter < 3 Conditions: • Timeout threshold not exceeded • Counter threshold not exceeded
  • 37. © AKAMAI - EDGE 2016 On Next Load: Timeout Exceeded Time > 5 seconds Counter < 3 Conditions: • Timeout threshold exceeded • Counter threshold not exceeded
  • 38. © AKAMAI - EDGE 2016 On Next Load: Counter Exceeded Load locally cached version of resource …Page loads much faster
  • 39. © AKAMAI - EDGE 2016 On Next Load: Counter Exceeded …Serve alternate error response defined in Service Worker Resource not available in cache
  • 40. © AKAMAI - EDGE 2016 Immediate Results: 5 minute period • Improved DOMContentLoaded time • Improved end user experience • Avoid continuous Single- Point-of-Failure Counter exceeded
  • 41. © AKAMAI - EDGE 2016 How Can Akamai Help? Register Service Worker • Edge Akamaizer on base page • Host SW.js on Netstorage Install/Activate Service Worker • Host thirdparty_urls.txt on Netstorage Datastore Capabilities • Maintain counter value per scoped resource Configuration Capabilities • Define penalty window time • Define counter threshold Service Worker Alternate Action • Block network requests based on predefined list of domains • Serve alternate static content • Serve content from local browser cache if available • Simply monitor third party performance
  • 42. © AKAMAI - EDGE 2016 Service Workers: Analytics Monitoring
  • 43. © AKAMAI - EDGE 2016 Third Party Analytics Monitoring
  • 44. © AKAMAI - EDGE 2016 What do third party analytics tools have to do with Service Workers?
  • 45. © AKAMAI - EDGE 2016 Offline Analytics
  • 46. © AKAMAI - EDGE 2016 Tracking Metrics with Service Workers navigator.connect to track metrics both online and offline self.addEventListener('activate', function(event) { event.waitUntil( navigator.services.connect('https://thirdparty.com/services/analytics', {name: 'analytics'})); }); self.addEventListener('fetch', function(event) { navigator.services.match({name: 'analytics'}).then( port.postMessage('log fetch')); }); …Where does performance and security come in? • Less client side JavaScript logic • After Service Worker is installed, no need for browser to re-parse analytics reporting code • Reduce risk of script injection (no DOM access) • Asynchronous metric reporting (non blocking) • Avoid SPOF • User Agent can terminate the Service Worker at ANY time
  • 47. © AKAMAI - EDGE 2016 Why don’t popular analytics tools leverage Service Workers?
  • 48. © AKAMAI - EDGE 2016 Other Service Worker Applications • Input Validation • Geo Content Control with the Geofencing API • Load Balancing • Switching off between multiple server URLs • Dependency Injector • Distinguishing production versus staging or production versus a fallback
  • 49. © AKAMAI - EDGE 2016 A Performance Solution Can Be A Security Solution! • Bridge the gap • First Party Attackers & Third Party Attackers • Explore Service Worker Applications Questions? @soniaburney @sabrina_burney