SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
$ S C E
A N G U L A R J S
J o s h S c h u m a c h e r
@ j o s h s c h u m a c h e r
h t t p s : / / p l u s . g o o g l e . c o m / + J o s h S c h u m a c h e r s
H a s O ff e r s
S T R I C T C O N T E X T U A L E S C A P I N G
– N O O N E E V E R
“We can trust our users and the input they provide.”
A N G U L A R 1 . 0 . 8
• ng-bind
• ng-bind-html
• ng-bind-html-unsafe
<script>
function snippetController($scope) {
$scope.snippet =
'<p style="color:blue">n an htmln' +
' <em onmouseover="this.textContent='PWN3D!'">click here</em>' +
' snippetn</p>';
}
</script>
!
<div ng-controller="snippetController" class="container">
<form>
<h1>User Input</h1>
<textarea class="form-control" rows="4" ng-model="snippet"></textarea>
</form>
!
<h2>ng-bind</h2>
<pre ng-bind="snippet"></pre>
!
!
<h2>ng-bind-html</h2>
<div ng-bind-html="snippet"></div>
!
!
<h2>ng-bind-html-unsafe</h2>
<div ng-bind-html-unsafe="snippet"></div>
!
</div>
Demo…
G O O D B Y E
N G - B I N D - H T M L - U N S A F E
A N G U L A R 1 . 2
• ng-bind
• ng-bind-html
• ng-bind-html-unsafe
<script>
function snippetController($scope) {
$scope.snippet =
'<p style="color:blue">n an htmln' +
' <em onmouseover="this.textContent='PWN3D!'">click here</em>' +
' snippetn</p>';
}
</script>
!
<div ng-controller="snippetController" class="container">
<form>
<h1>User Input</h1>
<textarea class="form-control" rows="4" ng-model="snippet"></textarea>
</form>
!
<h2>ng-bind</h2>
<pre ng-bind="snippet"></pre>
!
!
<h2>ng-bind-html</h2>
<div ng-bind-html="snippet"></div>
!
</div>
Y O U ’ R E N O T T H AT L U C K Y
Error: [$sce:unsafe] http://errors.angularjs.org/1.2.14/$sce/unsafe
at Error (native)
at http://code.angularjs.org/1.2.14/angular.min.js:6:450
at e (http://code.angularjs.org/1.2.14/angular.min.js:110:34)
at getTrusted (http://code.angularjs.org/1.2.14/angular.min.js:111:327)
at Object.e.(anonymous function) [as getTrustedHtml] 

(http://code.angularjs.org/1.2.14/angular.min.js:113:71)
at Object.fn (http://code.angularjs.org/1.2.14/angular.min.js:182:71)
at h.$digest (http://code.angularjs.org/1.2.14/angular.min.js:102:370)
at h.$apply (http://code.angularjs.org/1.2.14/angular.min.js:105:173)
at http://code.angularjs.org/1.2.14/angular.min.js:18:23
at Object.d [as invoke]
(http://code.angularjs.org/1.2.14/angular.min.js:30:452)
L O N G L I V E n g S A N I T I Z E
var app = angular.module('myApp', ['ngSanitize']);
<script src="http://code.angularjs.org/1.2.14/angular-sanitize.min.js"></script>
Demo…
var ngBindHtmlDirective = ['$sce', function($sce) {
return function(scope, element, attr) {
scope.$watch(attr.ngBindHtml, function ngBindHtmlWatchAction(value) {
element.html($sce.getTrustedHtml(value) || '');
});
};
}];
Bread and Butter
<div ng-bind-html="snippet"></div>
$sce.getTrustedHtml(value);
→ $sceDelegate.getTrusted($sce.HTML, value)
→ $sceDelegate.getTrusted($sce.URL, value)
→ $sceDelegate.getTrusted($sce.RESOURCE_URL, value)
→ $sceDelegate.getTrusted($sce.JS, value)
→ $sceDelegate.getTrusted($sce.CSS, value)
var ngBindHtmlDirective = ['$sce', function($sce) {
return function(scope, element, attr) {
scope.$watch(attr.ngBindHtml, function ngBindHtmlWatchAction(value) {
element.html($sce.getTrustedHtml(value) || '');
});
};
}];
return value.$$unwrapTrustedValue();
if (type === SCE_CONTEXTS.HTML) {
return htmlSanitizer(value);
}
{$sceDelegate.
getTrusted()
S O W H Y WA S N ’ T I L U C K Y B E F O R E ?
var htmlSanitizer = function htmlSanitizer(html) {
throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
};
!
if ($injector.has('$sanitize')) {
htmlSanitizer = $injector.get('$sanitize');
}
$sceDelegateProvider
return value.$$unwrapTrustedValue(); ?????
var app = angular.module('myApp');
!
app.controller('snippetController', function($scope, $sce) {
$scope.$watch('snippet', function(value) {
$scope.snippetHarmful = $sce.trustAsHtml(value);
});
});
function TrustedValueHolderType(trustedValue) {
this.$$unwrapTrustedValue = function() {
return trustedValue;
};
};
Demo…
Context Notes
$sce.HTML HTML that is safe to render in application.
$sce.CSS CSS that is safe to render in application.
[currently unused by AngularJS core]
$sce.URL
URLs that are safe to follow as links.
<a href= and <img src= don’t use $sce
[currently unused by AngularJS core]
$sce.RESOURCE_URL
URLs whose contents are safe to include in your app.
ng-include, ngSrc, iframe, object, etc
$sce.JS JavaScript that is safe to render in application.
[currently unused by AngularJS core]
C U S T O M
N G - B I N D - H T M L
<h2>ng-bind-html (trusted w/ filter)</h2>
<div ng-bind-html="snippet|trustedHtml"></div>
Generally a RISKY idea
$scope.$watch('snippet', function(value) {
value = value.replace(' onmouseover="this.textContent='PWN3D!'"', '');
$scope.snippetCustomSanitized = $sce.trustAsHtml(value);
});
L O N G L I V E
N G - B I N D - H T M L - U N S A F E
Demo…
var app = angular.module('myApp', ['ngSanitize']);
!
app.filter('trustedHtml', ['$sce', function($sce) {
return function(value) {
return $sce.trustAsHtml(value);
};
}]);
!
<h2>ng-bind-html (trusted w/ filter)</h2>
<div ng-bind-html="snippet|trustedHtml"></div>
Generally a BAD idea
C U S T O M I Z I N G T H E H T M L PA R S E R
• Not easy
• Dart recently introduced an injectable dom.NodeValidator
• Re-implement $sanitize htmlParser for global customization
• Write new htmlParser that returns $sce.trustAsHtml(parsedValue)
/**
* HTML Parser By Misko Hevery (misko@hevery.com)
* based on: HTML Parser By John Resig (ejohn.org)
* Original code by Erik Arvidsson, Mozilla Public License
*/
S C E R E S O U R C E _ U R L
app.config(function($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
'self',
// Allow loading from our assets domain. Notice the difference between * and **.
'http://cdn*.assets.example.com/**'
]);
});
!
!
!
!
!
‘*’ matches 0 or more occurrences of any character EXCEPT ':', '/', '.', '?', '&' and ‘;'
!
‘**’ matches 0 or more of ANY character - be careful,
generally only use at the end of a whitelist url

Contenu connexe

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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?
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

AngularJS Strict Contextual Escaping ($sce)

  • 1. $ S C E A N G U L A R J S
  • 2. J o s h S c h u m a c h e r @ j o s h s c h u m a c h e r h t t p s : / / p l u s . g o o g l e . c o m / + J o s h S c h u m a c h e r s H a s O ff e r s
  • 3. S T R I C T C O N T E X T U A L E S C A P I N G
  • 4. – N O O N E E V E R “We can trust our users and the input they provide.”
  • 5. A N G U L A R 1 . 0 . 8 • ng-bind • ng-bind-html • ng-bind-html-unsafe <script> function snippetController($scope) { $scope.snippet = '<p style="color:blue">n an htmln' + ' <em onmouseover="this.textContent='PWN3D!'">click here</em>' + ' snippetn</p>'; } </script> ! <div ng-controller="snippetController" class="container"> <form> <h1>User Input</h1> <textarea class="form-control" rows="4" ng-model="snippet"></textarea> </form> ! <h2>ng-bind</h2> <pre ng-bind="snippet"></pre> ! ! <h2>ng-bind-html</h2> <div ng-bind-html="snippet"></div> ! ! <h2>ng-bind-html-unsafe</h2> <div ng-bind-html-unsafe="snippet"></div> ! </div> Demo…
  • 6. G O O D B Y E N G - B I N D - H T M L - U N S A F E
  • 7. A N G U L A R 1 . 2 • ng-bind • ng-bind-html • ng-bind-html-unsafe <script> function snippetController($scope) { $scope.snippet = '<p style="color:blue">n an htmln' + ' <em onmouseover="this.textContent='PWN3D!'">click here</em>' + ' snippetn</p>'; } </script> ! <div ng-controller="snippetController" class="container"> <form> <h1>User Input</h1> <textarea class="form-control" rows="4" ng-model="snippet"></textarea> </form> ! <h2>ng-bind</h2> <pre ng-bind="snippet"></pre> ! ! <h2>ng-bind-html</h2> <div ng-bind-html="snippet"></div> ! </div>
  • 8. Y O U ’ R E N O T T H AT L U C K Y Error: [$sce:unsafe] http://errors.angularjs.org/1.2.14/$sce/unsafe at Error (native) at http://code.angularjs.org/1.2.14/angular.min.js:6:450 at e (http://code.angularjs.org/1.2.14/angular.min.js:110:34) at getTrusted (http://code.angularjs.org/1.2.14/angular.min.js:111:327) at Object.e.(anonymous function) [as getTrustedHtml] 
 (http://code.angularjs.org/1.2.14/angular.min.js:113:71) at Object.fn (http://code.angularjs.org/1.2.14/angular.min.js:182:71) at h.$digest (http://code.angularjs.org/1.2.14/angular.min.js:102:370) at h.$apply (http://code.angularjs.org/1.2.14/angular.min.js:105:173) at http://code.angularjs.org/1.2.14/angular.min.js:18:23 at Object.d [as invoke] (http://code.angularjs.org/1.2.14/angular.min.js:30:452)
  • 9. L O N G L I V E n g S A N I T I Z E var app = angular.module('myApp', ['ngSanitize']); <script src="http://code.angularjs.org/1.2.14/angular-sanitize.min.js"></script> Demo…
  • 10. var ngBindHtmlDirective = ['$sce', function($sce) { return function(scope, element, attr) { scope.$watch(attr.ngBindHtml, function ngBindHtmlWatchAction(value) { element.html($sce.getTrustedHtml(value) || ''); }); }; }]; Bread and Butter <div ng-bind-html="snippet"></div>
  • 11. $sce.getTrustedHtml(value); → $sceDelegate.getTrusted($sce.HTML, value) → $sceDelegate.getTrusted($sce.URL, value) → $sceDelegate.getTrusted($sce.RESOURCE_URL, value) → $sceDelegate.getTrusted($sce.JS, value) → $sceDelegate.getTrusted($sce.CSS, value)
  • 12. var ngBindHtmlDirective = ['$sce', function($sce) { return function(scope, element, attr) { scope.$watch(attr.ngBindHtml, function ngBindHtmlWatchAction(value) { element.html($sce.getTrustedHtml(value) || ''); }); }; }]; return value.$$unwrapTrustedValue(); if (type === SCE_CONTEXTS.HTML) { return htmlSanitizer(value); } {$sceDelegate. getTrusted()
  • 13. S O W H Y WA S N ’ T I L U C K Y B E F O R E ? var htmlSanitizer = function htmlSanitizer(html) { throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.'); }; ! if ($injector.has('$sanitize')) { htmlSanitizer = $injector.get('$sanitize'); } $sceDelegateProvider
  • 14. return value.$$unwrapTrustedValue(); ????? var app = angular.module('myApp'); ! app.controller('snippetController', function($scope, $sce) { $scope.$watch('snippet', function(value) { $scope.snippetHarmful = $sce.trustAsHtml(value); }); }); function TrustedValueHolderType(trustedValue) { this.$$unwrapTrustedValue = function() { return trustedValue; }; }; Demo…
  • 15. Context Notes $sce.HTML HTML that is safe to render in application. $sce.CSS CSS that is safe to render in application. [currently unused by AngularJS core] $sce.URL URLs that are safe to follow as links. <a href= and <img src= don’t use $sce [currently unused by AngularJS core] $sce.RESOURCE_URL URLs whose contents are safe to include in your app. ng-include, ngSrc, iframe, object, etc $sce.JS JavaScript that is safe to render in application. [currently unused by AngularJS core]
  • 16. C U S T O M N G - B I N D - H T M L <h2>ng-bind-html (trusted w/ filter)</h2> <div ng-bind-html="snippet|trustedHtml"></div> Generally a RISKY idea $scope.$watch('snippet', function(value) { value = value.replace(' onmouseover="this.textContent='PWN3D!'"', ''); $scope.snippetCustomSanitized = $sce.trustAsHtml(value); });
  • 17. L O N G L I V E N G - B I N D - H T M L - U N S A F E Demo… var app = angular.module('myApp', ['ngSanitize']); ! app.filter('trustedHtml', ['$sce', function($sce) { return function(value) { return $sce.trustAsHtml(value); }; }]); ! <h2>ng-bind-html (trusted w/ filter)</h2> <div ng-bind-html="snippet|trustedHtml"></div> Generally a BAD idea
  • 18. C U S T O M I Z I N G T H E H T M L PA R S E R • Not easy • Dart recently introduced an injectable dom.NodeValidator • Re-implement $sanitize htmlParser for global customization • Write new htmlParser that returns $sce.trustAsHtml(parsedValue) /** * HTML Parser By Misko Hevery (misko@hevery.com) * based on: HTML Parser By John Resig (ejohn.org) * Original code by Erik Arvidsson, Mozilla Public License */
  • 19. S C E R E S O U R C E _ U R L app.config(function($sceDelegateProvider) { $sceDelegateProvider.resourceUrlWhitelist([ 'self', // Allow loading from our assets domain. Notice the difference between * and **. 'http://cdn*.assets.example.com/**' ]); }); ! ! ! ! ! ‘*’ matches 0 or more occurrences of any character EXCEPT ':', '/', '.', '?', '&' and ‘;' ! ‘**’ matches 0 or more of ANY character - be careful, generally only use at the end of a whitelist url