際際滷

際際滷Share a Scribd company logo
Making our web apps safely hackable
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
Making our web apps safely hackable
Making our web apps safely hackable
3 C A PA B I L I T I E S

 Access to REST APIs
 Event notifications
 UI extensibility
Making our web apps safely hackable
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
Making our web apps safely hackable
Making our web apps safely hackable
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 doesnt cascade to IFrames  theres hack (detect and pass in

parent styles to IFrame)

 Relative links open in the IFrame  theres a fix (use the <base> tag)
 Dynamic resizing is an art  over/underflow detection sort of works
Making our web apps safely hackable
Making our web apps safely hackable
Making our web apps safely hackable
GRACIASAND PLEASE

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

Recommended

Herramientas Webquest
Herramientas Webquest
Maria Garcia
Owasp eee 2015 csrf
Owasp eee 2015 csrf
Aurelijus Stanislovaitis
The Wisdom Of Clouds
The Wisdom Of Clouds
Mike Bell
Roysville
Roysville
retamplifier
Multiple Reality Mashup: Teleconferencing in Second Life
Multiple Reality Mashup: Teleconferencing in Second Life
ccosmato
Mobile internet and local government
Mobile internet and local government
simonwakeman
Mothers in all colours
Mothers in all colours
blackangel
Historia3.3 3
Historia3.3 3
katixa
PEK Spring Picnic 2007
PEK Spring Picnic 2007
Chris Johnson
Assignment Fireworks
Assignment Fireworks
Robert DeRobertis
Amy&Per Erik
Amy&Per Erik
vinion
Deforestation
Deforestation
kimoneill
Importance Of Being Driven
Importance Of Being Driven
Antonio Terreno
Publizitate eta HHPP sarrera: 4. gaia
Publizitate eta HHPP sarrera: 4. gaia
katixa
Something About The Web
Something About The Web
Chiara Antonacci
El Pollo Loco
El Pollo Loco
burnsc62
Secure web messaging in HTML5
Secure web messaging in HTML5
Krishna T
Breaking The Cross Domain Barrier
Breaking The Cross Domain Barrier
Alex Sexton
Building a js widget
Building a js widget
Tudor Barbu
Html web messaging
Html web messaging
AbhishekMondal42
Message in a Bottle
Message in a Bottle
Zohar Arad
HTML5 Web Messaging
HTML5 Web Messaging
Mike Taylor
Javascript cross domain communication
Javascript cross domain communication
ChenKuo Chen
20120802 timisoara
20120802 timisoara
Richard Rodger
JSFoo Chennai 2012
JSFoo Chennai 2012
Krishna T
Stay Out Please
Stay Out Please
efim13
Going Beyond Cross Domain Boundaries (jQuery Bulgaria)
Going Beyond Cross Domain Boundaries (jQuery Bulgaria)
Ivo Andreev
20120306 dublin js
20120306 dublin js
Richard Rodger
Building businesspost.ie using Node.js
Building businesspost.ie using Node.js
Richard Rodger

More Related Content

Viewers also liked (9)

Historia3.3 3
Historia3.3 3
katixa
PEK Spring Picnic 2007
PEK Spring Picnic 2007
Chris Johnson
Assignment Fireworks
Assignment Fireworks
Robert DeRobertis
Amy&Per Erik
Amy&Per Erik
vinion
Deforestation
Deforestation
kimoneill
Importance Of Being Driven
Importance Of Being Driven
Antonio Terreno
Publizitate eta HHPP sarrera: 4. gaia
Publizitate eta HHPP sarrera: 4. gaia
katixa
Something About The Web
Something About The Web
Chiara Antonacci
El Pollo Loco
El Pollo Loco
burnsc62
Historia3.3 3
Historia3.3 3
katixa
PEK Spring Picnic 2007
PEK Spring Picnic 2007
Chris Johnson
Amy&Per Erik
Amy&Per Erik
vinion
Deforestation
Deforestation
kimoneill
Importance Of Being Driven
Importance Of Being Driven
Antonio Terreno
Publizitate eta HHPP sarrera: 4. gaia
Publizitate eta HHPP sarrera: 4. gaia
katixa
Something About The Web
Something About The Web
Chiara Antonacci
El Pollo Loco
El Pollo Loco
burnsc62

Similar to Making our web apps safely hackable (20)

Secure web messaging in HTML5
Secure web messaging in HTML5
Krishna T
Breaking The Cross Domain Barrier
Breaking The Cross Domain Barrier
Alex Sexton
Building a js widget
Building a js widget
Tudor Barbu
Html web messaging
Html web messaging
AbhishekMondal42
Message in a Bottle
Message in a Bottle
Zohar Arad
HTML5 Web Messaging
HTML5 Web Messaging
Mike Taylor
Javascript cross domain communication
Javascript cross domain communication
ChenKuo Chen
20120802 timisoara
20120802 timisoara
Richard Rodger
JSFoo Chennai 2012
JSFoo Chennai 2012
Krishna T
Stay Out Please
Stay Out Please
efim13
Going Beyond Cross Domain Boundaries (jQuery Bulgaria)
Going Beyond Cross Domain Boundaries (jQuery Bulgaria)
Ivo Andreev
20120306 dublin js
20120306 dublin js
Richard Rodger
Building businesspost.ie using Node.js
Building businesspost.ie using Node.js
Richard Rodger
Pushing the Web: Interesting things to Know
Pushing the Web: Interesting things to Know
n|u - The Open Security Community
Stuck in the Middle with You: Exploring the Connections Between Your App and ...
Stuck in the Middle with You: Exploring the Connections Between Your App and ...
Justin Weiss
Socket.io
Socket.io
Timothy Fitz
Web_Development_with_Node_Express.pdf
Web_Development_with_Node_Express.pdf
Marco Antonio Martinez Andrade
Taming client-server communication
Taming client-server communication
scothis
Modern iframe programming
Modern iframe programming
benvinegar
XCS110_All_際際滷s.pdf
XCS110_All_際際滷s.pdf
ssuser01066a
Secure web messaging in HTML5
Secure web messaging in HTML5
Krishna T
Breaking The Cross Domain Barrier
Breaking The Cross Domain Barrier
Alex Sexton
Building a js widget
Building a js widget
Tudor Barbu
Message in a Bottle
Message in a Bottle
Zohar Arad
HTML5 Web Messaging
HTML5 Web Messaging
Mike Taylor
Javascript cross domain communication
Javascript cross domain communication
ChenKuo Chen
JSFoo Chennai 2012
JSFoo Chennai 2012
Krishna T
Stay Out Please
Stay Out Please
efim13
Going Beyond Cross Domain Boundaries (jQuery Bulgaria)
Going Beyond Cross Domain Boundaries (jQuery Bulgaria)
Ivo Andreev
Building businesspost.ie using Node.js
Building businesspost.ie using Node.js
Richard Rodger
Stuck in the Middle with You: Exploring the Connections Between Your App and ...
Stuck in the Middle with You: Exploring the Connections Between Your App and ...
Justin Weiss
Taming client-server communication
Taming client-server communication
scothis
Modern iframe programming
Modern iframe programming
benvinegar
XCS110_All_際際滷s.pdf
XCS110_All_際際滷s.pdf
ssuser01066a

Recently uploaded (20)

WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019

Making our web apps safely hackable

  • 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
  • 8. 3 C A PA B I L I T I E S Access to REST APIs Event notifications UI extensibility
  • 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
  • 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 doesnt cascade to IFrames theres hack (detect and pass in parent styles to IFrame) Relative links open in the IFrame theres a fix (use the <base> tag) Dynamic resizing is an art over/underflow detection sort of works
  • 28. GRACIASAND PLEASE Follow me at @rmanalan Dont forget to take those Atlassian drink glasses home with you Come talk to me about an awesome job at an awesome company