Skip to content

Commit

Permalink
Silence unsafe YAML loader warning (#21)
Browse files Browse the repository at this point in the history
Our `UniqueKeyLoader` inherits from the `yaml.SafeLoader` class, but it
is flagged as unsafe by Bandit.
This silences the false positive.
  • Loading branch information
ruicoelhopedro authored Apr 19, 2024
1 parent 80d82fd commit 7f7f27a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion piglot/utils/yaml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def parse_config_file(config_file: str) -> Dict[str, Any]:
"""
try:
with open(config_file, 'r', encoding='utf8') as file:
config = yaml.load(file, Loader=UniqueKeyLoader)
config = yaml.load(file, Loader=UniqueKeyLoader) # nosec B506
except (ParserError, ScannerError) as exc:
raise RuntimeError("Failed to parse the config file: YAML syntax seems invalid.") from exc
# Check required terms
Expand Down

0 comments on commit 7f7f27a

Please sign in to comment.