feat: add uv audit in check vulnerability - #1498
Conversation
3b783ca to
362e02e
Compare
4fef6ba to
2ea8f7a
Compare
9b0b223 to
b32d7f6
Compare
4c4269c to
9c8a1e1
Compare
…om:ansys/actions into feat/use-uv-audit-in-check-vulnerabilities
AlejandroFernandezLuces
left a comment
There was a problem hiding this comment.
This is a great addition, thanks for taking care of it! I have a question about this. What do you think of integrating the uv audit as a pre-commit hook rather than in the vulnerability action? Or maybe even having it in both places?
From my pov, it looks doable and potentially keeps the vulnerability from reaching public code, since users should have pre-commit installed in local generally.
That's a very good remark, I just checked and feels like it would be doable astral-sh/uv-pre-commit#65. However, here are some remarks:
Tbh I think dependabot & safety are doing a great job atm and the main value of
=> I think we can let people know about the hook if this PR ever gets merged and we present it :) |
If you ask me... I would only run it if the repo already has a checked in "uv.lock" file. Anything else is problematic:
So.. I agree with @SMoraisAnsys - if it is not detected, I would throw out an error. |
|
Changes are working as expected https://github.com/ansys/pyaedt/actions/runs/33410581239?pr=8024 |
|
@ansys/pyansys-core can I have some reviews ? :) |
moe-ad
left a comment
There was a problem hiding this comment.
@SMoraisAnsys shouldn't we document this for local runs, similar to bandit and safety?
I think we should. If you agree, we just need to update generate_advisory_files with an initial run of uv audit ..., so that info_uv_audit.log will be generated. Otherwise, this line would cause failure locally. And of course update the documentation section above.
Other than the above comments, the rest LGTM and I am approving.
|
@RobPasMue @moe-ad @MaxJPRey changes performed to handle your comments, please have a look and resolve the discussion if the changes are fine with you :) |
moe-ad
left a comment
There was a problem hiding this comment.
I left a comment regarding UV_MALWARE_CHECK env variable vs audit.malware-check in pyproject.toml. Those two are essentially the same thing based on my understanding. So if we are already forcing UV_MALWARE_CHECK=1, then we shouldn't need to have any logic relating to detecting the value of audit.malware-check, right?
Unless I am misunderstanding something, in which case the PR should be good to go.
This PR allows users additionally run
uv auditinansys/actions/check-vulnerabilities.While
uv auditis still experimental, it can surface both known vulnerabilities and project risk signals (like adverse project status/malware-related checks). The current implementation also assumes that one has auvlockfile available to avoid resolving the dependencies before checking them. If not, the action will fail. The current parsing is simple because the feature is still experimental.If required (e.g. false positive), vulnerabilities can be ignored. For example, I get an expected failure when testing this branch in here and using
allows the
uv auditcommand to pass locally without failing.Close #1458
Note
Even if they
safetyanduv auditdo not use the same DB (PyUp Safety vs OSV), we might think about replacing the former with the latter to answer #1342, see also #641 for more information on thissafetyreplacement topic. However, projects without a lockfile would lose coverage entirely so this might be for laterrrrrr. Maybe we could rediscuss that when the audit feature is no longer considered experimental ? :)