Skip to content
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

Add ignore file option #27

Merged
merged 6 commits into from
Mar 19, 2024
Merged

Add ignore file option #27

merged 6 commits into from
Mar 19, 2024

Conversation

baldarn
Copy link
Contributor

@baldarn baldarn commented Mar 11, 2024

📖 Description and reason

Add an option to use a file for ignoring CVEs
Similar to bundler audit config file
https://github.com/rubysec/bundler-audit?tab=readme-ov-file#configuration-file

👷 Work done

[x] add option to get ignore-file path
[x] default file (if found) in .mix-audit-skips, similar to to sobelow lib (feel free to propose a better name)
[ ] tests
[x] Documentation

Additional notes

I would like to add some tests, but as far as I understood there are not so many covering the cli. Do you think is important to add some tests?

🎉 Result

Correctly ignoring CVEs stored in .mix-audit-skips file (if correctly formatted)

🦀 Dispatch

#dispatch/elixir

lib/mix_audit/cli/audit.ex Outdated Show resolved Hide resolved
@baldarn baldarn marked this pull request as ready for review March 12, 2024 07:47
@mirego-builds
Copy link

🦀 Requesting reviewers for this pull request:

🦀 Mentionning users for this pull request:

@baldarn baldarn changed the title Add ignore file flow Add ignore file option Mar 12, 2024
defp ignored_ids_from_file(opts) do
opts
|> Keyword.get(:ignore_file, ".mix-audit-skips")
|> File.read!()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user doesn’t specify the --ignore-file option, it will still try to read the .mix-audit-skips file. But if it doesn’t exist, it will raise an error?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should read from file only if the option if specified...

Copy link
Contributor Author

@baldarn baldarn Mar 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied bundle audit system.
the file will be evaluated only if the option is passed

see a92312e

what do you think?

@remi
Copy link
Member

remi commented Mar 15, 2024

Awesome idea 🙌 I just left a small comment regarding the backward-compatibility (ie. what if the .mix-audit-skips doesn’t exist.

@remi
Copy link
Member

remi commented Mar 15, 2024

I would like to add some tests, but as far as I understood there are not so many covering the cli. Do you think is important to add some tests?

You’re right, tests for the CLI part are non-existent. I should get on that 🙂 So no tests is fine for this PR.

@baldarn baldarn requested a review from remi March 15, 2024 08:01
@remi remi merged commit befe14e into mirego:main Mar 19, 2024
5 checks passed
@remi
Copy link
Member

remi commented Mar 19, 2024

@baldarn @sgessa Thank you guys! 2.1.3 has now been released with --ignore-file 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants