Download the PHP package itools/svgsecuritycheck without Composer

On this page you can find all versions of the php package itools/svgsecuritycheck. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package svgsecuritycheck

SvgSecurityCheck: Reject SVG Uploads That Could Run Script

SvgSecurityCheck checks an uploaded SVG file and rejects it if it could run script, load an outside resource, or hang a renderer. Chrome's <img> mode turns off script and outside loads only while the file is shown through <img>. These rules check the file itself against allowlists, so an accepted file runs no script and loads nothing from another server, even when its URL is opened directly or it is served as text/html. The file is never rewritten: you store the bytes that were uploaded, or tell the uploader why the file was rejected.

Why Reject Instead of Clean

A sanitizer returns a changed file, and a logo that renders differently from what the designer exported is a support ticket nobody can explain. SvgSecurityCheck never rewrites the file: a rejection with a reason costs a re-export, and a cleaned file that still holds something the sanitizer did not know about costs an XSS. Elements, attributes, namespaces, URL forms and CSS functions are all checked against allowlists, so a new one is rejected until it is added.

Documentation

Full docs (browse on GitHub):

Quick Start

Requires PHP 8.1+ with ext-xmlreader and ext-libxml (both enabled by default).

The rest of the API:

What It Blocks

What It Does Not Check

Additional Protection

An accepted file is safe to serve with only Content-Type: image/svg+xml. Two more headers add a second layer in case a rule is ever bypassed:

If Apache or nginx serves the upload folder directly, set them there for .svg files.

When You Might Not Want SvgSecurityCheck

Security

Because every list is an allowlist, what the rules cannot anticipate is a browser changing how it handles something already allowed. Update when a new release comes out, and report a file that gets through as described in SECURITY.md.

Related Libraries

Questions?

This library was developed for CMS Builder. Post a message in our "CMS Builder" forum here: https://www.interactivetools.com/forum/

License

MIT


All versions of svgsecuritycheck with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-libxml Version *
ext-xmlreader Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package itools/svgsecuritycheck contains the following files

Loading the files please wait ...