bgalek / safe-svg

Simple and lightweight library that helps to validate SVG files in security manners.

Home Page:https://detektywi.it/2019/03/bezpieczny-svg/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Additional example svgs that are fine

spand opened this issue · comments

hi @spand! Sure, we can add them to tests sources!
Do You want me to make PR or maybe You want to contribute? :)

@spand are those graphic royalty free? I don't want to have any images-right issues ;)

commented

They are trademarks so I am not sure if they are subject to any issues.

Ok, I'll add them today ;)

@spand it won't be as easy as i thought :( first image uses deprecated svg filter: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/enable-background. I see three options:

  • add option to enable custom parameters/attributes (i think it could lead to security issues)
  • user of the library could ignore some of found errors
  • create some additional rules and validate enable-background property

Is this crucial for you that theese images pass validations?

commented

Thanks for taking a look.

In a sense yes but maybe you are aiming for a different level of "validity" than my task requires so I will not ask you to implement this. I just need to check if its a harmful svg or not. I would not particularly care how broken an svg it is.

@spand I agree with you. This library purpose should be focused on security only. If you give me few days I would be happy to help you out and add support for provided use cases. What do You think about it? :)

commented

That would be nice !

@spand I'll do my best to create a PR as fast as possible ;)

@spand https://github.com/bgalek/safe-svg/pull/5/files I've added your examples, and created an easy way for this library to cover upcoming unusal properties ;)

@spand just released 1.1.1 It will be available in few hours ;)

commented

👍 I will try to see how it works with the rest of our collection of logos.

maybe optimizing/normalization of svg would help with your examples?
https://jakearchibald.github.io/svgomg/ ?