SlideShare une entreprise Scribd logo
1  sur  28
Télécharger pour lire hors ligne
A shit load of 3rd party
Javascript widgets
…and a shit load of + security risks
+ page weight
+ maintenance
RICH MANALANG / @RMANALAN / ATLASSIAN

Making our web apps
<safely> hackable
Hackable => Extensible
3 C A PA B I L I T I E S

• Access to REST APIs
• Event notifications
• UI extensibility
A SHIP IN PORT IS
S A F E , B U T T H AT ' S
N O T W H AT S H I P S A R E
B U I LT F O R .
— GRACE HOPPER
C O N T R A C T B E T W E E N H O S T A N D 3 R D PA R T Y

• Ability for 3rd party to resize itself based on content size
• Ability for 3rd party to make requests with the host
• Ability for 3rd party to send and listen to events on the host
w i n d o w. p o s t M e s s a g e ( )
// Parent => IFrame
!

// Parent
var someIframe = document.getElementById('some-iframe');
someIframe.contentWindow.postMessage('yo', '*');
!
!

// IFrame
window.addEventListener('message', function (e) {
alert(e.data); // yo dude!
}, false);
w i n d o w. p o s t M e s s a g e ( )

// IFrame => Parent
!

// Parent
window.addEventListener('message', function (e) {
alert(e.data); // hey!
}, false);
!
!

// IFrame
window.postMessage('hey', '*');
w i n d o w. p o s t M e s s a g e ( )

• Prone to resource contention
• Solution: use channel messaging
postMessage + MessageChannel is raw
O T H E R A LT E R N AT I V E S …
• postMessage is IE 8+ only (partial support)
• easyXDM
• porthole
• Oasis.js
• Conductor.js
• Open web way to safely embed 3rd party code
• Sandboxing can be through an IFrame or a Web Worker
• Capability-based security
• Abstractions for services, consumers, events, and requests
• Async via Promises
• Wiretapping
// Host (parent http://example.com)

// Sandbox (IFrame http://xyz.com/iframe.html)

!
// Service to expose to sandboxes
var PingService = Oasis.Service.extend({
initialize: function() {
this.send('ping');
},
!
events: {
pong: function() {
alert("Got a pong!");
}
}
});
!
// Creates the sandbox
oasis.createSandbox('http://xyz.com/iframe.html', {
capabilities: [‘ping’],
// adapter: oasis.adapters.webworker, // no UI
services: {
ping: PingService
}
});

!
// Consumer that handles the ping capability
var PingConsumer = Oasis.Consumer.extend({
events: {
ping: function() {
this.send('pong');
}
}
});
!
// Connect to the host
Oasis.connect({
consumers: {
ping: PingConsumer // request ping capability
}
});
C o n d u c t o r. j s

• A framework for building sandboxed apps
• Gives 3rd parties a well-defined framework for building extensions
• Built on top of Oasis.js
C o n d u c t o r. j s

// Card (http://xyz.com/awesome-card.js)

!

// Load dependencies
Conductor.require('lib/jquery.js');
Conductor.require('lib/handlebars.js');

!

var template = '<div>{{message}}</div>';

!

// Define card
Conductor.card({

!

// Host (parent http://example.com)
!
// Bootstrap a new conductor instance
var conductor = new Conductor( options );
!
// Load a card
conductor.load('http://xyz.com/awesome-card.js');
!
// Add to the DOM
conductor.appendTo($('#target'));

!

!

!

// Oasis style capabilities.
consumers: {
pong: Conductor.Oasis.Consumer.extend({
requests: {
// handle requests from the host
// or other cards
},
events: {
// handle events from the host
// or other cards
}
})
},
activate: function() {
// initialize your card here...
},
compileTemplates: function(){
template = Handlebars.compile(template);
},

render: function() {
$('body').html(template({ message: "Wassup?" }));
}
});
Wa t c h @ t o m d a l e t a l k a b o u t O a s i s / C o n d u c t o r

http://j.mp/conductorjs
IMPERFECT

• CSS on host doesn’t cascade to IFrames — there’s hack (detect and pass in

parent styles to IFrame)

• Relative links open in the IFrame — there’s a “fix” (use the <base> tag)
• Dynamic resizing is an art — over/underflow detection sort of works
GRACIAS…AND PLEASE…

• Follow me at @rmanalan
• Don’t forget to take those Atlassian drink glasses home with you
• Come talk to me about an awesome job at an awesome company

Contenu connexe

En vedette

PEK Spring Picnic 2007
PEK Spring Picnic 2007PEK Spring Picnic 2007
PEK Spring Picnic 2007
Chris Johnson
 
Deforestation
DeforestationDeforestation
Deforestation
kimoneill
 
El Pollo Loco
El Pollo LocoEl Pollo Loco
El Pollo Loco
burnsc62
 

En vedette (9)

Historia3.3 3
Historia3.3 3Historia3.3 3
Historia3.3 3
 
PEK Spring Picnic 2007
PEK Spring Picnic 2007PEK Spring Picnic 2007
PEK Spring Picnic 2007
 
Assignment Fireworks
Assignment FireworksAssignment Fireworks
Assignment Fireworks
 
Amy&Per Erik
Amy&Per ErikAmy&Per Erik
Amy&Per Erik
 
Deforestation
DeforestationDeforestation
Deforestation
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being Driven
 
Publizitate eta HHPP sarrera: 4. gaia
Publizitate eta HHPP sarrera: 4. gaiaPublizitate eta HHPP sarrera: 4. gaia
Publizitate eta HHPP sarrera: 4. gaia
 
Something About The Web
Something About The WebSomething About The Web
Something About The Web
 
El Pollo Loco
El Pollo LocoEl Pollo Loco
El Pollo Loco
 

Similaire à Making our web apps safely hackable

Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5
DefconRussia
 
Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)
Krzysztof Kotowicz
 
Application Security
Application SecurityApplication Security
Application Security
nirola
 
[HEWEBAR 2012] Adaptive Images in Responsive Web Design
[HEWEBAR 2012] Adaptive Images in Responsive Web Design[HEWEBAR 2012] Adaptive Images in Responsive Web Design
[HEWEBAR 2012] Adaptive Images in Responsive Web Design
Christopher Schmitt
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecurities
amiable_indian
 
Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)
danwrong
 

Similaire à Making our web apps safely hackable (20)

Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5
 
Mobile Device APIs
Mobile Device APIsMobile Device APIs
Mobile Device APIs
 
HTML5 Web Messaging
HTML5 Web MessagingHTML5 Web Messaging
HTML5 Web Messaging
 
Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)Hacking HTML5 offensive course (Zeronights edition)
Hacking HTML5 offensive course (Zeronights edition)
 
Creating an Effective Mobile API
Creating an Effective Mobile API Creating an Effective Mobile API
Creating an Effective Mobile API
 
Transforming WebSockets
Transforming WebSocketsTransforming WebSockets
Transforming WebSockets
 
Browser Horror Stories
Browser Horror StoriesBrowser Horror Stories
Browser Horror Stories
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
JavaScript Security: Mastering Cross Domain Communications in complex JS appl...
 
HTML5 on Mobile
HTML5 on MobileHTML5 on Mobile
HTML5 on Mobile
 
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoTWebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
 
Scout xss csrf_security_presentation_chicago
Scout xss csrf_security_presentation_chicagoScout xss csrf_security_presentation_chicago
Scout xss csrf_security_presentation_chicago
 
Application Security
Application SecurityApplication Security
Application Security
 
Pushing the Web: Interesting things to Know
Pushing the Web: Interesting things to KnowPushing the Web: Interesting things to Know
Pushing the Web: Interesting things to Know
 
[HEWEBAR 2012] Adaptive Images in Responsive Web Design
[HEWEBAR 2012] Adaptive Images in Responsive Web Design[HEWEBAR 2012] Adaptive Images in Responsive Web Design
[HEWEBAR 2012] Adaptive Images in Responsive Web Design
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devices
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecurities
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)Building @Anywhere (for TXJS)
Building @Anywhere (for TXJS)
 
Opening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the IslandsOpening up the Social Web - Standards that are bridging the Islands
Opening up the Social Web - Standards that are bridging the Islands
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Making our web apps safely hackable

  • 1.
  • 2. A shit load of 3rd party Javascript widgets
  • 3. …and a shit load of + security risks + page weight + maintenance
  • 4. RICH MANALANG / @RMANALAN / ATLASSIAN Making our web apps <safely> hackable
  • 6.
  • 7.
  • 8. 3 C A PA B I L I T I E S • Access to REST APIs • Event notifications • UI extensibility
  • 9.
  • 10. A SHIP IN PORT IS S A F E , B U T T H AT ' S N O T W H AT S H I P S A R E B U I LT F O R . — GRACE HOPPER
  • 11. C O N T R A C T B E T W E E N H O S T A N D 3 R D PA R T Y • Ability for 3rd party to resize itself based on content size • Ability for 3rd party to make requests with the host • Ability for 3rd party to send and listen to events on the host
  • 12. w i n d o w. p o s t M e s s a g e ( ) // Parent => IFrame ! // Parent var someIframe = document.getElementById('some-iframe'); someIframe.contentWindow.postMessage('yo', '*'); ! ! // IFrame window.addEventListener('message', function (e) { alert(e.data); // yo dude! }, false);
  • 13. w i n d o w. p o s t M e s s a g e ( ) // IFrame => Parent ! // Parent window.addEventListener('message', function (e) { alert(e.data); // hey! }, false); ! ! // IFrame window.postMessage('hey', '*');
  • 14. w i n d o w. p o s t M e s s a g e ( ) • Prone to resource contention • Solution: use channel messaging
  • 16. O T H E R A LT E R N AT I V E S … • postMessage is IE 8+ only (partial support) • easyXDM • porthole • Oasis.js • Conductor.js
  • 17. • Open web way to safely embed 3rd party code • Sandboxing can be through an IFrame or a Web Worker • Capability-based security • Abstractions for services, consumers, events, and requests • Async via Promises • Wiretapping
  • 18. // Host (parent http://example.com) // Sandbox (IFrame http://xyz.com/iframe.html) ! // Service to expose to sandboxes var PingService = Oasis.Service.extend({ initialize: function() { this.send('ping'); }, ! events: { pong: function() { alert("Got a pong!"); } } }); ! // Creates the sandbox oasis.createSandbox('http://xyz.com/iframe.html', { capabilities: [‘ping’], // adapter: oasis.adapters.webworker, // no UI services: { ping: PingService } }); ! // Consumer that handles the ping capability var PingConsumer = Oasis.Consumer.extend({ events: { ping: function() { this.send('pong'); } } }); ! // Connect to the host Oasis.connect({ consumers: { ping: PingConsumer // request ping capability } });
  • 19. C o n d u c t o r. j s • A framework for building sandboxed apps • Gives 3rd parties a well-defined framework for building extensions • Built on top of Oasis.js
  • 20.
  • 21.
  • 22. C o n d u c t o r. j s // Card (http://xyz.com/awesome-card.js) ! // Load dependencies Conductor.require('lib/jquery.js'); Conductor.require('lib/handlebars.js'); ! var template = '<div>{{message}}</div>'; ! // Define card Conductor.card({ ! // Host (parent http://example.com) ! // Bootstrap a new conductor instance var conductor = new Conductor( options ); ! // Load a card conductor.load('http://xyz.com/awesome-card.js'); ! // Add to the DOM conductor.appendTo($('#target')); ! ! ! // Oasis style capabilities. consumers: { pong: Conductor.Oasis.Consumer.extend({ requests: { // handle requests from the host // or other cards }, events: { // handle events from the host // or other cards } }) }, activate: function() { // initialize your card here... }, compileTemplates: function(){ template = Handlebars.compile(template); }, render: function() { $('body').html(template({ message: "Wassup?" })); } });
  • 23. Wa t c h @ t o m d a l e t a l k a b o u t O a s i s / C o n d u c t o r http://j.mp/conductorjs
  • 24. IMPERFECT • CSS on host doesn’t cascade to IFrames — there’s hack (detect and pass in parent styles to IFrame) • Relative links open in the IFrame — there’s a “fix” (use the <base> tag) • Dynamic resizing is an art — over/underflow detection sort of works
  • 25.
  • 26.
  • 27.
  • 28. GRACIAS…AND PLEASE… • Follow me at @rmanalan • Don’t forget to take those Atlassian drink glasses home with you • Come talk to me about an awesome job at an awesome company