angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

ngSanitize remove valids SVG elements

Open ItsBenCodes opened this issue 12 years ago • 4 comments

ngSanitize does not support some very basics SVG elements.

An example of something not working with ng-bind-html:

ng-bind-html="data"

$scope.data = '<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />';

Their is many legits SVG elements that are not supported.

Their is an extensive list here: https://developer.mozilla.org/en-US/docs/Web/SVG/Element

I think ngSanitize should keep all of them. I can't think of any security reasons why we shouldn't.

The only though I have is wether we want to keep ngSanitize only for html5 or should we support more. SVG is being used a lot with angular now.

ItsBenCodes avatar Oct 12 '14 15:10 ItsBenCodes

yeah this sounds reasonable. anyone wants to send a clean PR that whitelists legit svg elements.

IgorMinar avatar Oct 13 '14 18:10 IgorMinar

Perfect! I will take care of it and follow the PR checklist :)

ItsBenCodes avatar Oct 13 '14 20:10 ItsBenCodes

Well you've been faster than me. Thank you for the fix :-)

ItsBenCodes avatar Oct 23 '14 21:10 ItsBenCodes

@eXon You're welcome. That was a nice task to accomplish during ngEurope. ;-)

christianliebel avatar Oct 23 '14 21:10 christianliebel