Skip to content

fix: mark MD5 usage as non-security (B324)#53

Merged
deacon-mp merged 1 commit intomasterfrom
fix/cve-md5-usedforsecurity
Mar 18, 2026
Merged

fix: mark MD5 usage as non-security (B324)#53
deacon-mp merged 1 commit intomasterfrom
fix/cve-md5-usedforsecurity

Conversation

@deacon-mp
Copy link
Copy Markdown
Contributor

Summary

Add usedforsecurity=False to hashlib.md5() calls that are used for non-cryptographic purposes.

Changes

  • app/atomic_svc.py:124 — MD5 used for payload file deduplication (collision avoidance prefix)
  • app/atomic_svc.py:304 — MD5 used for ability ID generation from test content

Neither usage is for security/authentication. The usedforsecurity=False parameter (Python 3.9+) clarifies intent and suppresses security scanner warnings.

Security Reference

  • B324: Use of weak MD5 hash for security purposes

Test plan

  • Verify atomic plugin loads without errors
  • Verify ability import still generates correct IDs
  • Verify payload attachment deduplication still works

Add usedforsecurity=False to hashlib.md5() calls in atomic_svc.py.
These usages are for file deduplication and ability ID generation,
not for cryptographic security purposes.

Fixes: B324 (Use of weak MD5 hash for security)
Detected by: bandit
@deacon-mp deacon-mp merged commit f96d103 into master Mar 18, 2026
1 of 2 checks passed
@deacon-mp deacon-mp deleted the fix/cve-md5-usedforsecurity branch March 18, 2026 03:03
@deacon-mp deacon-mp requested a review from Copilot March 18, 2026 03:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates MD5 hashing calls in AtomicService to explicitly mark them as not used for security purposes (likely to address environments enforcing stricter crypto policies).

Changes:

  • Add usedforsecurity=False to hashlib.md5() when hashing attachment contents.
  • Add usedforsecurity=False to hashlib.md5() when generating deterministic ability IDs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# to avoid collisions between payloads with the same name
with open(attachment_path, 'rb') as f:
h = hashlib.md5(f.read()).hexdigest()
h = hashlib.md5(f.read(), usedforsecurity=False).hexdigest()
Return True if an ability was saved.
"""
ability_id = hashlib.md5(json.dumps(test).encode()).hexdigest()
ability_id = hashlib.md5(json.dumps(test).encode(), usedforsecurity=False).hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants