Skip to content

[AssetMapper] Add audit command #18992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions frontend/asset_mapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,38 @@ re-calculated when you expect it to, you can run:

This will force the AssetMapper component to re-calculate the content of all files.

Run Security Audits on Your Dependencies
----------------------------------------

Just like ``npm`` and ``yarn``, the AssetMapper component comes bundled with a
command allowing you to quickly have a look at security vulnerability advisories
that may exist in the dependencies you're using in your application:

.. code-block:: terminal

$ php bin/console importmap:audit

This command will result in an output similar to this:

.. image:: /_images/components/assetmapper/01-importmap-audit.png
:alt: Console output showing a table of security vulnerabilities that exist
in the dependencies used in the application.

Additionally, the command takes a ``--format`` option to chose in which format
the output should be. The values supported by this options are the following:

* ``txt``
* ``json``

The command will return the ``0`` exit code if no vulnerability is found, or
the ``-1`` exit code otherwise. This means that you can seamlessly integrate this
command as part of your CI to be warned anytime a new vulnerability is found
in the packages you use.

.. versionadded:: 6.4

The ``importmap:audit`` command was introduced in Symfony 6.4.

.. _latest asset-mapper recipe: https://github.com/symfony/recipes/tree/main/symfony/asset-mapper
.. _import statement: https://caniuse.com/es6-module-dynamic-import
.. _ES6: https://caniuse.com/es6
Expand Down