PyCQA / PyCQA/bandit

Error parsing pyproject.tml

Open
#733 4 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

Hi ! I'm following the documentation** to provide a custom setup for bandit to exclude some tests (B101) in our testing framework but I get the following error:

[config]        ERROR   expected '<document start>', but found '<scalar>'
  in "pyproject.toml", line 2, column 1
[main]  ERROR   pyproject.toml : Error parsing file

Where the ppyproject.toml is the following

[tool.black]
line-length = 120
skip-string-normalization = true
skip-magic-trailing-comma = true


[tool.bandit.assert_used]
exclude = ["*_test.py", "test_*.py"]

**https://bandit.readthedocs.io/en/latest/config.html

Reproduction steps
1. bandit --recursive -c pyproject.toml test
Expected behavior

Not crash

Bandit version

1.7.0 (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

Reproduce the failure with the reported pyproject.toml and bandit --recursive -c pyproject.toml test command. Trace the configuration parsing entry point and verify that the shown Bandit settings are accepted without the parsing error and that the exclude patterns take effect.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.