question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: sanitizer bypass method

See original GitHub issue

Feature Request

Ionic version:

[x] 4.x

Describe the Feature Request

We recently introduced a basic sanitizer which should help Ionic users avoid unintentional XSS vulnerabilities in their applications. Similar to Angular’s sanitizer, there exists methods to bypass the sanitize method if a user wants to do something particularly complex that the sanitizer would typically not allow.

Because our sanitizer does not allow every possible combination of markup + styling, it would be good to give users the option to bypass the sanitizer in the event that a) they are certain there are no XSS vulnerabilities (or at least, they know they are responsible for ensuring their code is safe) and b) want to do something complex that the sanitizer can’t reliably make sanitary.

Describe Preferred Solution

I would expect the sanitizer to be bypassed if it received an IonicSafeCode as input. Here is how it would look for ion-alert:

const alert = await alertController.create({
  header: 'Alert',
  subHeader: 'Subtitle',
  message: new IonicSafeCode('<a href="https://ionicframework.com" target="_blank">Hello World!</a>')
  buttons: ['Cancel', 'Open Modal', 'Delete']
});

Then the sanitizer method would need to check to see if the content it is receiving is of type IonicSafeCode and allow it to pass through.

(I’m open to other class names. IonicSafeCode was the first one that came to mind)

Additional Context

See: https://angular.io/api/platform-browser/DomSanitizer

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
liamdebeasicommented, May 30, 2019

this.domSanitizer.bypassSecurityTrustHtml is something that is Angular-specific and will not work with other frameworks. There is likely some research to be done into how IonicSafeCode will interact with Angular’s own sanitizer.

Regarding the icons in header, this discussion is best suited for a separate issue.

There is already a issue open for HTML content with toasts: https://github.com/ionic-team/ionic/issues/18204

0reactions
ionitron-bot[bot]commented, May 27, 2020

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

feat: sanitizer bypass method · Issue #18277 - GitHub
We recently introduced a basic sanitizer which should help Ionic users avoid unintentional XSS vulnerabilities in their applications. Similar to ...
Read more >
XSS Filter Bypass | HTML Sanitizing | Part 8 - YouTube
Thank you for watching the video about XSS Filter Bypass | HTML Sanitizing | Part 8HTML encoding is a one- way application filters...
Read more >
Validating, sanitizing, and escaping
Sanitizing : Cleaning user input​​ Sanitization is a more liberal approach to accepting user data and is the best approach when there is...
Read more >
µSBS: Static Binary Sanitization of Bare-metal Embedded ...
Dynamic binary sanitizers allow instrumentation of an application at runtime. However, such techniques are not widely deployable on the bare- ...
Read more >
EP2890281A1 - Method and apparatus for dispensing sanitizer fluid ...
Apparati and methods for dispensing sanitizer fluid via handles on doors and equipment, ... the user can bypass its use when, for example,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found