Skip to content

Commit

Permalink
add nosec B301
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu-g committed Aug 17, 2023
1 parent a0961ad commit 28e2de2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/units/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,12 +907,12 @@ def test_eq_raw_text() -> None:
@pytest.mark.parametrize("case", CASES)
def test_pickle_unpickle(case: Dict[str, str]) -> None:
doc1 = Document.from_knp(case["knp"])
doc2 = pickle.loads(pickle.dumps(doc1))
doc2 = pickle.loads(pickle.dumps(doc1)) # nosec B301

Check warning on line 910 in tests/units/test_document.py

View check run for this annotation

codefactor.io / CodeFactor

tests/units/test_document.py#L910

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue. (B301)
assert doc1.to_knp() == doc2.to_knp()


@pytest.mark.parametrize("path", Path("tests/data").glob("*.knp"))
def test_pickle_unpickle_annotated_corpora(path: Path) -> None:
doc1 = Document.from_knp(path.read_text())
doc2 = pickle.loads(pickle.dumps(doc1))
doc2 = pickle.loads(pickle.dumps(doc1)) # nosec B301

Check warning on line 917 in tests/units/test_document.py

View check run for this annotation

codefactor.io / CodeFactor

tests/units/test_document.py#L917

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue. (B301)
assert doc1.to_knp() == doc2.to_knp()
2 changes: 1 addition & 1 deletion tests/units/test_sentence.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,5 +768,5 @@ def test_eq_raw_text(case: Dict[str, str]) -> None:
@pytest.mark.parametrize("case", CASES)
def test_pickle_unpickle(case: Dict[str, str]) -> None:
sent1 = Sentence.from_knp(case["knp"])
sent2 = pickle.loads(pickle.dumps(sent1))
sent2 = pickle.loads(pickle.dumps(sent1)) # nosec B301

Check warning on line 771 in tests/units/test_sentence.py

View check run for this annotation

codefactor.io / CodeFactor

tests/units/test_sentence.py#L771

Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue. (B301)
assert sent1.to_knp() == sent2.to_knp()

0 comments on commit 28e2de2

Please sign in to comment.