PyCQA / PyCQA/bandit

Use .gitignore as basis of default excludes

Open
#826 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
8.3k
Forks
836
Avg merge
5d 3h
Merged PRs (30d)
1

Description

Is your feature request related to a problem? Please describe.
Currently, constants.py defines some standard excludes hardcoded in a file. While this hasn't generally been an issue thus far, it does get complicated if someone wishes to override those values.

Describe the solution you'd like
Rather than hardcode in Bandit source, make use of a project's defined .gitignore file instead. It's very common to only scan the source that is part of the git repo anyway.

Describe alternatives you've considered
This solution would apply only to Git source control. So if someone uses SVN, CVS, etc, it may not be of much help.

Additional context
https://git-scm.com/docs/gitignore
https://github.com/PyCQA/bandit/blob/7fbf9d517b900936ac97e7debbd16dc7e532bc27/bandit/core/constants.py

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with bandit/core/constants.py and the linked gitignore documentation to understand the current hardcoded excludes and the proposed source of defaults. Trace where those constants are consumed, then verify that a project's .gitignore supplies the default exclusions while the existing behavior remains usable for non-Git projects.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
security, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.