Skip to content

[Security] Use of insecure MD5 hash in tests/common.p #92

@woshitaiyang1204-prog

Description

@woshitaiyang1204-prog

Description: While performing a security audit using the automated tool Bandit, I identified the use of a weak hash function (MD5) in tests/common.py.

Location: File: tests/common.py, Line: 123

Python
m = hashlib.md5()
Risk: According to CWE-327, MD5 is cryptographically broken and should not be used for security-sensitive contexts. Even in test scripts, it is best practice to use more secure alternatives like SHA-256 to avoid potential risks or setting a bad example for the codebase.

Recommendation: Replace hashlib.md5() with hashlib.sha256() or explicitly set usedforsecurity=False if it's strictly for non-security purposes in newer Python versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions