PyCQA / PyCQA/bandit

-c setup.cfg error [config] ERROR expected '<document start>', but found '<scalar>'

Open
#1,035 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

Bandit throws error when giving explicitly config file setup.cfg

Reproduction steps
  1. set setup.cfg file:
[isort]
profile = black

...

[tool.bandit]
skips = ["B101", "B601"]

or

...
[tool.bandit.assert_used]
skips = ['*_test.py', '*/test_*.py']
  1. run $ bandit -c setup.cfg -r .
  2. output:
[config]        ERROR   expected '<document start>', but found '<scalar>'
  in "setup.cfg", line 2, column 1
[main]  ERROR   setup.cfg : Error parsing file.
Expected behavior

Running properly with given config file in according to https://bandit.readthedocs.io/en/latest/config.html#bandit-settings

Bandit version

1.7.5 (Default)

Python version

3.8

Additional context

No response

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 by reproducing the issue with setup.cfg and bandit -c setup.cfg -r ., using the shown [tool.bandit] and [tool.bandit.assert_used] examples. Trace the configuration parsing entry point and verify that a valid setup.cfg is accepted without the YAML parsing error. Done means Bandit runs with the supplied skips settings and reports findings normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.