Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Brakeman ignore certain paths

I'm trying to configure Brakeman for my Rails projects and I want it to ignore certain directories and files. I can't find an option to specify paths to exclude. Does anyone know if this is possible?

like image 566
fourthnen Avatar asked Dec 05 '25 20:12

fourthnen


2 Answers

There is now support for skipping entire directories. See https://www.rubydoc.info/gems/brakeman/4.3.1

brakeman --skip-files file1,/path1/,path2/

like image 73
Raam Chauhan Avatar answered Dec 08 '25 13:12

Raam Chauhan


You can use the flag (also known as 'option') --skip-files to ignore specific files; however, there is no support for skipping entire directories.

Furthermore, there is the inverse flag --only-files which does accept directories, and there is the option to use --skip-libs to only skip the lib directory.

I recommend that you check the output of brakeman --help for more options.

If you really want to skip an entire directory, you could do something like the following command line.

ls app/some/dir/ | paste -s -d , - | xargs brakeman --skip-files

If you are using Brakeman as a library, then you can pass the files by running :skip_files as follows.

Brakeman.run(:app_path => "my_app", :skip_files => Dir["my_app/bad/path/*"])
like image 26
Justin Avatar answered Dec 08 '25 13:12

Justin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!