Skip to content

Commit 7699473

Browse files
committed
📝 Switch from uv-secure to uv audit'
1 parent 6e801fe commit 7699473

2 files changed

Lines changed: 65 additions & 12 deletions

File tree

docs/productive/git/advanced/hooks/scripts.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ Linters and formatters
7373
`prettier <https://github.com/pre-commit/mirrors-prettier>`_
7474
provides `prettier <https://github.com/prettier/prettier>`__
7575

76+
`ruff-pre-commit <https://github.com/astral-sh/ruff-pre-commit>`_
77+
pre-commit-Hook für :doc:`../../../qa/ruff`
78+
7679
`black <https://github.com/psf/black>`_
7780
for formatting Python code
7881

docs/productive/security.rst

Lines changed: 62 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,76 @@ This check determines whether the project has open, unfixed vulnerabilities in
2929
its own code base or in its dependencies. An open vulnerability can be easily
3030
exploited and should be closed as soon as possible.
3131

32-
For such a check, you can use for example `uv-secure
33-
<https://pypi.org/project/uv-secure/>`_. Alternatively, you can use `osv
34-
<https://pypi.org/project/osv/>`_ or `pip-audit
35-
<https://pypi.org/project/pip-audit/>`_, which uses the `Open Source
36-
Vulnerability Database <https://osv.dev>`_.
32+
For such a check, you can use for example ``uv audit`` Alternatively, you can
33+
use `osv <https://pypi.org/project/osv/>`_ or `pip-audit
34+
<https://pypi.org/project/pip-audit/>`_.
35+
36+
``uv audit`` is a new command introduced in uv≥0.11.19 that checks the
37+
dependencies in your project for known vulnerabilities in the `OSV
38+
<https://osv.dev>`_ database and ‘undesirable’ project statuses, such as
39+
*deprecated*:
40+
41+
.. code-block:: console
42+
43+
$ uv audit
44+
warning: `uv audit` is experimental and may change without warning. Pass `--preview-features audit-command` to disable this warning.
45+
Resolved 115 packages in 16ms
46+
Found 12 known vulnerabilities and no adverse project statuses in 114 packages
47+
48+
Vulnerabilities:
49+
50+
idna 3.12 has 1 known vulnerability:
51+
- GHSA-65pc-fj4g-8rjx: Internationalized Domain Names in Applications (IDNA): Specially crafted inputs to idna.encode() can bypass CVE-2024-3651 fix
52+
Fixed in: 3.15
53+
Advisory information: https://github.com/kjd/idna/security/advisories/GHSA-65pc-fj4g-8rjx
54+
55+
56+
``uv add``, ``uv sync``, and so on can now be run during every synchronisation
57+
process to check for previously identified malware. This feature is not enabled
58+
by default, but it can be easily enabled by setting ``UV_MALWARE_CHECK=1`` in
59+
the shell.
60+
61+
.. seealso::
62+
* `uv audit <https://docs.astral.sh/uv/reference/cli/#uv-audit>`_
63+
* `uv audit settings <https://docs.astral.sh/uv/reference/settings/#audit>`_
3764

3865
If a vulnerability is found in a dependency, you should update to a
3966
non-vulnerable version; if no update is available, you should consider removing
4067
the dependency.
4168

42-
If you believe that the vulnerability does not affect your project, an
43-
:file:`osv-scanner.toml` file can be created for ``osv``, including the ID to
44-
ignore and a reason, for example:
69+
If you believe that the security vulnerability does not affect your project, you
70+
can define exceptions for ``uv audit`` in the :file:`pyproject.toml` file, for
71+
example:
4572

4673
.. code-block:: toml
74+
:caption: pyproject.toml
75+
76+
[tool.uv.audit]
77+
ignore = ["PYSEC-2022-43017", "GHSA-5239-wwwm-4pmq"]
78+
79+
or better still:
80+
81+
.. code-block:: toml
82+
:caption: pyproject.toml
83+
84+
[tool.uv.audit]
85+
ignore-until-fixed = ["PYSEC-2022-43017"]
86+
87+
.. seealso::
88+
* `ignore <https://docs.astral.sh/uv/reference/settings/#audit_ignore>`_
89+
* `ignore-until-fixed
90+
<https://docs.astral.sh/uv/reference/settings/#audit_ignore-until-fixed>`_
91+
92+
You can also add the vulnerability analysis using ``uv-audit`` to your
93+
:doc:`pre-commit <git/advanced/hooks/pre-commit>` checks:
94+
95+
.. code-block:: yaml
4796
48-
[[IgnoredVulns]]
49-
id = "GO-2022-1059"
50-
# ignoreUntil = 2022-11-09 # Optional exception expiry date
51-
reason = "No external http servers are written in Go lang."
97+
- repo: https://github.com/astral-sh/uv-pre-commit
98+
rev: 73c2d77a42a113aee9e4b748c24937f09557b82d # 0.11.24
99+
hooks:
100+
- id: uv-audit
101+
files: ^(uv\.lock|pyproject\.toml)$
52102
53103
Maintenance
54104
-----------

0 commit comments

Comments
 (0)